"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 (mod) {
    if (mod && mod.__esModule) return mod;
    var result = {};
    if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
    __setModuleDefault(result, mod);
    return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.offerFromJSON = exports.offerToJSON = exports.Offer$ = exports.Offer$outboundSchema = exports.Offer$inboundSchema = exports.offerOfferStatusFromJSON = exports.offerOfferStatusToJSON = exports.OfferOfferStatus$ = exports.OfferOfferStatus$outboundSchema = exports.OfferOfferStatus$inboundSchema = exports.OfferValue$ = exports.OfferValue$outboundSchema = exports.OfferValue$inboundSchema = exports.offerSourceValueFromJSON = exports.offerSourceValueToJSON = exports.OfferSourceValue$ = exports.OfferSourceValue$outboundSchema = exports.OfferSourceValue$inboundSchema = exports.offer4FromJSON = exports.offer4ToJSON = exports.Offer4$ = exports.Offer4$outboundSchema = exports.Offer4$inboundSchema = exports.OfferValue = void 0;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../../lib/primitives.js");
const schemas_js_1 = require("../../../lib/schemas.js");
const enums_js_1 = require("../../types/enums.js");
const offerhistory_js_1 = require("./offerhistory.js");
/**
 * The status of the offer.
 */
var OfferValue;
(function (OfferValue) {
    OfferValue["Pending"] = "pending";
    OfferValue["Retracted"] = "retracted";
    OfferValue["Accepted"] = "accepted";
    OfferValue["Rejected"] = "rejected";
    OfferValue["Created"] = "created";
    OfferValue["Approved"] = "approved";
    OfferValue["NotApproved"] = "not_approved";
    OfferValue["UnmappedValue"] = "unmapped_value";
})(OfferValue || (exports.OfferValue = OfferValue = {}));
/** @internal */
exports.Offer4$inboundSchema = z
    .object({});
/** @internal */
exports.Offer4$outboundSchema = z.object({});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Offer4$;
(function (Offer4$) {
    /** @deprecated use `Offer4$inboundSchema` instead. */
    Offer4$.inboundSchema = exports.Offer4$inboundSchema;
    /** @deprecated use `Offer4$outboundSchema` instead. */
    Offer4$.outboundSchema = exports.Offer4$outboundSchema;
})(Offer4$ || (exports.Offer4$ = Offer4$ = {}));
function offer4ToJSON(offer4) {
    return JSON.stringify(exports.Offer4$outboundSchema.parse(offer4));
}
exports.offer4ToJSON = offer4ToJSON;
function offer4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Offer4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Offer4' from JSON`);
}
exports.offer4FromJSON = offer4FromJSON;
/** @internal */
exports.OfferSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.Offer4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.OfferSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.Offer4$outboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var OfferSourceValue$;
(function (OfferSourceValue$) {
    /** @deprecated use `OfferSourceValue$inboundSchema` instead. */
    OfferSourceValue$.inboundSchema = exports.OfferSourceValue$inboundSchema;
    /** @deprecated use `OfferSourceValue$outboundSchema` instead. */
    OfferSourceValue$.outboundSchema = exports.OfferSourceValue$outboundSchema;
})(OfferSourceValue$ || (exports.OfferSourceValue$ = OfferSourceValue$ = {}));
function offerSourceValueToJSON(offerSourceValue) {
    return JSON.stringify(exports.OfferSourceValue$outboundSchema.parse(offerSourceValue));
}
exports.offerSourceValueToJSON = offerSourceValueToJSON;
function offerSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OfferSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OfferSourceValue' from JSON`);
}
exports.offerSourceValueFromJSON = offerSourceValueFromJSON;
/** @internal */
exports.OfferValue$inboundSchema = z
    .union([
    z.nativeEnum(OfferValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.OfferValue$outboundSchema = z.union([
    z.nativeEnum(OfferValue),
    z.string().and(z.custom()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var OfferValue$;
(function (OfferValue$) {
    /** @deprecated use `OfferValue$inboundSchema` instead. */
    OfferValue$.inboundSchema = exports.OfferValue$inboundSchema;
    /** @deprecated use `OfferValue$outboundSchema` instead. */
    OfferValue$.outboundSchema = exports.OfferValue$outboundSchema;
})(OfferValue$ || (exports.OfferValue$ = OfferValue$ = {}));
/** @internal */
exports.OfferOfferStatus$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.Offer4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.OfferValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.OfferOfferStatus$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.Offer4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.OfferValue$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        sourceValue: "source_value",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var OfferOfferStatus$;
(function (OfferOfferStatus$) {
    /** @deprecated use `OfferOfferStatus$inboundSchema` instead. */
    OfferOfferStatus$.inboundSchema = exports.OfferOfferStatus$inboundSchema;
    /** @deprecated use `OfferOfferStatus$outboundSchema` instead. */
    OfferOfferStatus$.outboundSchema = exports.OfferOfferStatus$outboundSchema;
})(OfferOfferStatus$ || (exports.OfferOfferStatus$ = OfferOfferStatus$ = {}));
function offerOfferStatusToJSON(offerOfferStatus) {
    return JSON.stringify(exports.OfferOfferStatus$outboundSchema.parse(offerOfferStatus));
}
exports.offerOfferStatusToJSON = offerOfferStatusToJSON;
function offerOfferStatusFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OfferOfferStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OfferOfferStatus' from JSON`);
}
exports.offerOfferStatusFromJSON = offerOfferStatusFromJSON;
/** @internal */
exports.Offer$inboundSchema = z
    .object({
    application_id: z.nullable(z.string()).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    currency: z.nullable(z.string()).optional(),
    id: z.nullable(z.string()).optional(),
    offer_history: z.nullable(z.array(offerhistory_js_1.OfferHistory$inboundSchema)).optional(),
    offer_status: z.nullable(z.lazy(() => exports.OfferOfferStatus$inboundSchema))
        .optional(),
    remote_application_id: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    salary: z.nullable(z.number()).optional(),
    start_date: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    unified_custom_fields: z.nullable(z.record(z.any())).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "application_id": "applicationId",
        "created_at": "createdAt",
        "offer_history": "offerHistory",
        "offer_status": "offerStatus",
        "remote_application_id": "remoteApplicationId",
        "remote_id": "remoteId",
        "start_date": "startDate",
        "unified_custom_fields": "unifiedCustomFields",
        "updated_at": "updatedAt",
    });
});
/** @internal */
exports.Offer$outboundSchema = z.object({
    applicationId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    currency: z.nullable(z.string()).optional(),
    id: z.nullable(z.string()).optional(),
    offerHistory: z.nullable(z.array(offerhistory_js_1.OfferHistory$outboundSchema)).optional(),
    offerStatus: z.nullable(z.lazy(() => exports.OfferOfferStatus$outboundSchema))
        .optional(),
    remoteApplicationId: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    salary: z.nullable(z.number()).optional(),
    startDate: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    unifiedCustomFields: z.nullable(z.record(z.any())).optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        applicationId: "application_id",
        createdAt: "created_at",
        offerHistory: "offer_history",
        offerStatus: "offer_status",
        remoteApplicationId: "remote_application_id",
        remoteId: "remote_id",
        startDate: "start_date",
        unifiedCustomFields: "unified_custom_fields",
        updatedAt: "updated_at",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Offer$;
(function (Offer$) {
    /** @deprecated use `Offer$inboundSchema` instead. */
    Offer$.inboundSchema = exports.Offer$inboundSchema;
    /** @deprecated use `Offer$outboundSchema` instead. */
    Offer$.outboundSchema = exports.Offer$outboundSchema;
})(Offer$ || (exports.Offer$ = Offer$ = {}));
function offerToJSON(offer) {
    return JSON.stringify(exports.Offer$outboundSchema.parse(offer));
}
exports.offerToJSON = offerToJSON;
function offerFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Offer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Offer' from JSON`);
}
exports.offerFromJSON = offerFromJSON;
//# sourceMappingURL=offer.js.map