/**
 * Common Salesforce Provider Types
 * 
 * Generic Salesforce API response structures used across multiple domains.
 */

import { z } from "zod";

// ============================================================================
// Salesforce Query Result (Generic SOQL Response)
// ============================================================================

/**
 * Salesforce SOQL query result wrapper schema
 * Can be used with any record schema for validation
 */
export const salesforceQueryResultSchema = <TRecord extends z.ZodTypeAny>(recordSchema: TRecord) =>
  z.object({
    totalSize: z.number(),
    done: z.boolean(),
    records: z.array(recordSchema),
  });

/**
 * Generic type for Salesforce query results
 * All SOQL queries return this structure regardless of SObject type
 * 
 * Usage: SalesforceQueryResult<SalesforceOrderRecord>
 */
export interface SalesforceQueryResult<TRecord = unknown> {
  totalSize: number;
  done: boolean;
  records: TRecord[];
}
