"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.Opportunity$inboundSchema = void 0;
exports.opportunityFromJSON = opportunityFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const rfcdate_js_1 = require("../../types/rfcdate.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
/** @internal */
exports.Opportunity$inboundSchema = z.object({
    id: z.string().optional(),
    title: z.string(),
    primary_contact_id: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(z.string()).optional(),
    monetary_amount: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    win_probability: z.nullable(z.number()).optional(),
    expected_revenue: z.nullable(z.number()).optional(),
    close_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v))).optional(),
    loss_reason_id: z.nullable(z.string()).optional(),
    loss_reason: z.nullable(z.string()).optional(),
    won_reason_id: z.nullable(z.string()).optional(),
    won_reason: z.nullable(z.string()).optional(),
    pipeline_id: z.nullable(z.string()).optional(),
    pipeline_stage_id: z.nullable(z.string()).optional(),
    source_id: z.nullable(z.string()).optional(),
    lead_id: z.nullable(z.string()).optional(),
    lead_source: z.nullable(z.string()).optional(),
    contact_id: z.nullable(z.string()).optional(),
    contact_ids: z.array(z.string()).optional(),
    company_id: z.nullable(z.string()).optional(),
    company_name: z.nullable(z.string()).optional(),
    owner_id: z.nullable(z.string()).optional(),
    priority: z.nullable(z.string()).optional(),
    status: z.nullable(z.string()).optional(),
    status_id: z.nullable(z.string()).optional(),
    tags: z.nullable(z.array(z.string())).optional(),
    interaction_count: z.nullable(z.number()).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
    stage_last_changed_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    last_activity_at: z.nullable(z.string()).optional(),
    deleted: z.boolean().optional(),
    date_stage_changed: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    date_last_contacted: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    date_lead_created: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    updated_by: z.nullable(z.string()).optional(),
    created_by: z.nullable(z.string()).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    pass_through: z.array(passthroughbody_js_1.PassThroughBody$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "primary_contact_id": "primaryContactId",
        "monetary_amount": "monetaryAmount",
        "win_probability": "winProbability",
        "expected_revenue": "expectedRevenue",
        "close_date": "closeDate",
        "loss_reason_id": "lossReasonId",
        "loss_reason": "lossReason",
        "won_reason_id": "wonReasonId",
        "won_reason": "wonReason",
        "pipeline_id": "pipelineId",
        "pipeline_stage_id": "pipelineStageId",
        "source_id": "sourceId",
        "lead_id": "leadId",
        "lead_source": "leadSource",
        "contact_id": "contactId",
        "contact_ids": "contactIds",
        "company_id": "companyId",
        "company_name": "companyName",
        "owner_id": "ownerId",
        "status_id": "statusId",
        "interaction_count": "interactionCount",
        "custom_fields": "customFields",
        "stage_last_changed_at": "stageLastChangedAt",
        "last_activity_at": "lastActivityAt",
        "date_stage_changed": "dateStageChanged",
        "date_last_contacted": "dateLastContacted",
        "date_lead_created": "dateLeadCreated",
        "custom_mappings": "customMappings",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "pass_through": "passThrough",
    });
});
function opportunityFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Opportunity$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Opportunity' from JSON`);
}
//# sourceMappingURL=opportunity.js.map