"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.listFromJSON = exports.listToJSON = exports.List$ = exports.List$outboundSchema = exports.List$inboundSchema = exports.listTypeFromJSON = exports.listTypeToJSON = exports.ListType$ = exports.ListType$outboundSchema = exports.ListType$inboundSchema = exports.ListValue$ = exports.ListValue$outboundSchema = exports.ListValue$inboundSchema = exports.listSourceValueFromJSON = exports.listSourceValueToJSON = exports.ListSourceValue$ = exports.ListSourceValue$outboundSchema = exports.ListSourceValue$inboundSchema = exports.list4FromJSON = exports.list4ToJSON = exports.List4$ = exports.List4$outboundSchema = exports.List4$inboundSchema = exports.ListValue = 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 listitem_js_1 = require("./listitem.js");
/**
 * The type of the list.
 */
var ListValue;
(function (ListValue) {
    ListValue["Candidates"] = "candidates";
    ListValue["Contacts"] = "contacts";
    ListValue["Companies"] = "companies";
    ListValue["UnmappedValue"] = "unmapped_value";
})(ListValue || (exports.ListValue = ListValue = {}));
/** @internal */
exports.List4$inboundSchema = z
    .object({});
/** @internal */
exports.List4$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 List4$;
(function (List4$) {
    /** @deprecated use `List4$inboundSchema` instead. */
    List4$.inboundSchema = exports.List4$inboundSchema;
    /** @deprecated use `List4$outboundSchema` instead. */
    List4$.outboundSchema = exports.List4$outboundSchema;
})(List4$ || (exports.List4$ = List4$ = {}));
function list4ToJSON(list4) {
    return JSON.stringify(exports.List4$outboundSchema.parse(list4));
}
exports.list4ToJSON = list4ToJSON;
function list4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.List4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'List4' from JSON`);
}
exports.list4FromJSON = list4FromJSON;
/** @internal */
exports.ListSourceValue$inboundSchema = z.union([
    z.lazy(() => exports.List4$inboundSchema),
    z.string(),
    z.number(),
    z.boolean(),
    z.array(z.any()),
]);
/** @internal */
exports.ListSourceValue$outboundSchema = z.union([
    z.lazy(() => exports.List4$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 ListSourceValue$;
(function (ListSourceValue$) {
    /** @deprecated use `ListSourceValue$inboundSchema` instead. */
    ListSourceValue$.inboundSchema = exports.ListSourceValue$inboundSchema;
    /** @deprecated use `ListSourceValue$outboundSchema` instead. */
    ListSourceValue$.outboundSchema = exports.ListSourceValue$outboundSchema;
})(ListSourceValue$ || (exports.ListSourceValue$ = ListSourceValue$ = {}));
function listSourceValueToJSON(listSourceValue) {
    return JSON.stringify(exports.ListSourceValue$outboundSchema.parse(listSourceValue));
}
exports.listSourceValueToJSON = listSourceValueToJSON;
function listSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListSourceValue' from JSON`);
}
exports.listSourceValueFromJSON = listSourceValueFromJSON;
/** @internal */
exports.ListValue$inboundSchema = z
    .union([
    z.nativeEnum(ListValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.ListValue$outboundSchema = z.union([
    z.nativeEnum(ListValue),
    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 ListValue$;
(function (ListValue$) {
    /** @deprecated use `ListValue$inboundSchema` instead. */
    ListValue$.inboundSchema = exports.ListValue$inboundSchema;
    /** @deprecated use `ListValue$outboundSchema` instead. */
    ListValue$.outboundSchema = exports.ListValue$outboundSchema;
})(ListValue$ || (exports.ListValue$ = ListValue$ = {}));
/** @internal */
exports.ListType$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.lazy(() => exports.List4$inboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.ListValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.ListType$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.lazy(() => exports.List4$outboundSchema),
        z.string(),
        z.number(),
        z.boolean(),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.ListValue$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 ListType$;
(function (ListType$) {
    /** @deprecated use `ListType$inboundSchema` instead. */
    ListType$.inboundSchema = exports.ListType$inboundSchema;
    /** @deprecated use `ListType$outboundSchema` instead. */
    ListType$.outboundSchema = exports.ListType$outboundSchema;
})(ListType$ || (exports.ListType$ = ListType$ = {}));
function listTypeToJSON(listType) {
    return JSON.stringify(exports.ListType$outboundSchema.parse(listType));
}
exports.listTypeToJSON = listTypeToJSON;
function listTypeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListType$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListType' from JSON`);
}
exports.listTypeFromJSON = listTypeFromJSON;
/** @internal */
exports.List$inboundSchema = z
    .object({
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    id: z.nullable(z.string()).optional(),
    items: z.nullable(z.array(listitem_js_1.ListItem$inboundSchema)).optional(),
    name: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.ListType$inboundSchema)).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, {
        "created_at": "createdAt",
        "remote_id": "remoteId",
        "unified_custom_fields": "unifiedCustomFields",
        "updated_at": "updatedAt",
    });
});
/** @internal */
exports.List$outboundSchema = z.object({
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    id: z.nullable(z.string()).optional(),
    items: z.nullable(z.array(listitem_js_1.ListItem$outboundSchema)).optional(),
    name: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    type: z.nullable(z.lazy(() => exports.ListType$outboundSchema)).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, {
        createdAt: "created_at",
        remoteId: "remote_id",
        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 List$;
(function (List$) {
    /** @deprecated use `List$inboundSchema` instead. */
    List$.inboundSchema = exports.List$inboundSchema;
    /** @deprecated use `List$outboundSchema` instead. */
    List$.outboundSchema = exports.List$outboundSchema;
})(List$ || (exports.List$ = List$ = {}));
function listToJSON(list) {
    return JSON.stringify(exports.List$outboundSchema.parse(list));
}
exports.listToJSON = listToJSON;
function listFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.List$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'List' from JSON`);
}
exports.listFromJSON = listFromJSON;
//# sourceMappingURL=list.js.map