/**
 * Pipedrive Node - Version 1
 * Discriminator: resource=deal, operation=search
 */


interface Credentials {
  pipedriveApi: CredentialReference;
  pipedriveOAuth2Api: CredentialReference;
}

/** Search a deal */
export type PipedriveV1DealSearchParams = {
  resource: 'deal';
  operation: 'search';
  authentication?: 'apiToken' | 'oAuth2' | Expression<string>;
/**
 * The search term to look for. Minimum 2 characters (or 1 if using exact_match).
 */
    term?: string | Expression<string> | PlaceholderValue;
/**
 * Whether only full exact matches against the given term are returned. It is not case sensitive.
 * @default false
 */
    exactMatch?: boolean | Expression<boolean>;
/**
 * Whether to return all results or only up to a given limit
 * @default false
 */
    returnAll?: boolean | Expression<boolean>;
/**
 * Max number of results to return
 * @displayOptions.show { returnAll: [false] }
 * @default 100
 */
    limit?: number | Expression<number>;
/**
 * Additional Fields
 * @default {}
 */
    additionalFields?: {
    /** Supports including optional fields in the results which are not provided by default. Example: deal.cc_email.
     */
    includeFields?: string | Expression<string> | PlaceholderValue;
    /** Will filter Deals by the provided Organization ID
     */
    organizationId?: string | Expression<string> | PlaceholderValue;
    /** Will filter Deals by the provided Person ID
     */
    personId?: string | Expression<string> | PlaceholderValue;
    /** A comma-separated string array. The fields to perform the search from. Defaults to all of them.
     * @default ["custom_fields","notes","title"]
     */
    fields?: Array<'custom_fields' | 'notes' | 'title'>;
    /** The status of the deal. If not provided it will automatically be set to "open".
     * @default open
     */
    status?: 'open' | 'won' | 'lost' | Expression<string>;
  };
};

export type PipedriveV1DealSearchOutput = {
  currency?: string;
  id?: number;
  notes?: Array<string>;
  organization?: {
    id?: number;
    name?: string;
  };
  owner?: {
    id?: number;
  };
  person?: {
    id?: number;
    name?: string;
  };
  result_score?: number;
  stage?: {
    id?: number;
    name?: string;
  };
  status?: string;
  title?: string;
  type?: string;
  visible_to?: number;
};

export type PipedriveV1DealSearchNode = {
  type: 'n8n-nodes-base.pipedrive';
  version: 1;
  credentials?: Credentials;
  config: NodeConfig<PipedriveV1DealSearchParams>;
  output?: Items<PipedriveV1DealSearchOutput>;
};