"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.fieldFromJSON = exports.fieldToJSON = exports.Field$ = exports.Field$outboundSchema = exports.Field$inboundSchema = exports.FieldType$ = exports.FieldType$outboundSchema = exports.FieldType$inboundSchema = exports.requiredFromJSON = exports.requiredToJSON = exports.RequiredT$ = exports.RequiredT$outboundSchema = exports.RequiredT$inboundSchema = exports.Field2$ = exports.Field2$outboundSchema = exports.Field2$inboundSchema = exports.FieldType = exports.Field2 = 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");
var Field2;
(function (Field2) {
    Field2["True"] = "true";
    Field2["False"] = "false";
})(Field2 || (exports.Field2 = Field2 = {}));
/**
 * The type of the field
 */
var FieldType;
(function (FieldType) {
    FieldType["ShortText"] = "short_text";
    FieldType["LongText"] = "long_text";
    FieldType["MultiSelect"] = "multi_select";
    FieldType["SingleSelect"] = "single_select";
    FieldType["Boolean"] = "boolean";
    FieldType["Number"] = "number";
    FieldType["Date"] = "date";
    FieldType["Phone"] = "phone";
    FieldType["Email"] = "email";
    FieldType["Score"] = "score";
    FieldType["Location"] = "location";
    FieldType["UnmappedValue"] = "unmapped_value";
})(FieldType || (exports.FieldType = FieldType = {}));
/** @internal */
exports.Field2$inboundSchema = z
    .nativeEnum(Field2);
/** @internal */
exports.Field2$outboundSchema = exports.Field2$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Field2$;
(function (Field2$) {
    /** @deprecated use `Field2$inboundSchema` instead. */
    Field2$.inboundSchema = exports.Field2$inboundSchema;
    /** @deprecated use `Field2$outboundSchema` instead. */
    Field2$.outboundSchema = exports.Field2$outboundSchema;
})(Field2$ || (exports.Field2$ = Field2$ = {}));
/** @internal */
exports.RequiredT$inboundSchema = z.union([z.boolean(), exports.Field2$inboundSchema]);
/** @internal */
exports.RequiredT$outboundSchema = z.union([z.boolean(), exports.Field2$outboundSchema]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var RequiredT$;
(function (RequiredT$) {
    /** @deprecated use `RequiredT$inboundSchema` instead. */
    RequiredT$.inboundSchema = exports.RequiredT$inboundSchema;
    /** @deprecated use `RequiredT$outboundSchema` instead. */
    RequiredT$.outboundSchema = exports.RequiredT$outboundSchema;
})(RequiredT$ || (exports.RequiredT$ = RequiredT$ = {}));
function requiredToJSON(requiredT) {
    return JSON.stringify(exports.RequiredT$outboundSchema.parse(requiredT));
}
exports.requiredToJSON = requiredToJSON;
function requiredFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.RequiredT$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'RequiredT' from JSON`);
}
exports.requiredFromJSON = requiredFromJSON;
/** @internal */
exports.FieldType$inboundSchema = z
    .union([
    z.nativeEnum(FieldType),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.FieldType$outboundSchema = z.union([
    z.nativeEnum(FieldType),
    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 FieldType$;
(function (FieldType$) {
    /** @deprecated use `FieldType$inboundSchema` instead. */
    FieldType$.inboundSchema = exports.FieldType$inboundSchema;
    /** @deprecated use `FieldType$outboundSchema` instead. */
    FieldType$.outboundSchema = exports.FieldType$outboundSchema;
})(FieldType$ || (exports.FieldType$ = FieldType$ = {}));
/** @internal */
exports.Field$inboundSchema = z
    .object({
    id: z.nullable(z.string()).optional(),
    label: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    required: z.nullable(z.union([z.boolean(), exports.Field2$inboundSchema]))
        .optional(),
    type: z.nullable(exports.FieldType$inboundSchema).optional(),
    values: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "remote_id": "remoteId",
    });
});
/** @internal */
exports.Field$outboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    label: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    required: z.nullable(z.union([z.boolean(), exports.Field2$outboundSchema]))
        .optional(),
    type: z.nullable(exports.FieldType$outboundSchema).optional(),
    values: z.nullable(z.array(z.string())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        remoteId: "remote_id",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Field$;
(function (Field$) {
    /** @deprecated use `Field$inboundSchema` instead. */
    Field$.inboundSchema = exports.Field$inboundSchema;
    /** @deprecated use `Field$outboundSchema` instead. */
    Field$.outboundSchema = exports.Field$outboundSchema;
})(Field$ || (exports.Field$ = Field$ = {}));
function fieldToJSON(field) {
    return JSON.stringify(exports.Field$outboundSchema.parse(field));
}
exports.fieldToJSON = fieldToJSON;
function fieldFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Field$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Field' from JSON`);
}
exports.fieldFromJSON = fieldFromJSON;
//# sourceMappingURL=field.js.map