"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.MetadataField$ = exports.MetadataField$outboundSchema = exports.MetadataField$inboundSchema = exports.Datasource$ = exports.Datasource$outboundSchema = exports.Datasource$inboundSchema = exports.Value$ = exports.Value$outboundSchema = exports.Value$inboundSchema = exports.MetadataFieldState$ = exports.MetadataFieldState$outboundSchema = exports.MetadataFieldState$inboundSchema = exports.Restrictions$ = exports.Restrictions$outboundSchema = exports.Restrictions$inboundSchema = exports.Validation$ = exports.Validation$outboundSchema = exports.Validation$inboundSchema = exports.DefaultValue$ = exports.DefaultValue$outboundSchema = exports.DefaultValue$inboundSchema = exports.MetadataFieldType$ = exports.MetadataFieldType$outboundSchema = exports.MetadataFieldType$inboundSchema = exports.MetadataFieldState = exports.MetadataFieldType = void 0;
exports.defaultValueToJSON = defaultValueToJSON;
exports.defaultValueFromJSON = defaultValueFromJSON;
exports.validationToJSON = validationToJSON;
exports.validationFromJSON = validationFromJSON;
exports.restrictionsToJSON = restrictionsToJSON;
exports.restrictionsFromJSON = restrictionsFromJSON;
exports.valueToJSON = valueToJSON;
exports.valueFromJSON = valueFromJSON;
exports.datasourceToJSON = datasourceToJSON;
exports.datasourceFromJSON = datasourceFromJSON;
exports.metadataFieldToJSON = metadataFieldToJSON;
exports.metadataFieldFromJSON = metadataFieldFromJSON;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
/**
 * The type of the metadata field.
 */
exports.MetadataFieldType = {
    String: "string",
    Integer: "integer",
    Date: "date",
    Enum: "enum",
    Set: "set",
};
/**
 * The state of the option.
 */
exports.MetadataFieldState = {
    Active: "active",
    Inactive: "inactive",
};
/** @internal */
exports.MetadataFieldType$inboundSchema = z.nativeEnum(exports.MetadataFieldType);
/** @internal */
exports.MetadataFieldType$outboundSchema = exports.MetadataFieldType$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var MetadataFieldType$;
(function (MetadataFieldType$) {
    /** @deprecated use `MetadataFieldType$inboundSchema` instead. */
    MetadataFieldType$.inboundSchema = exports.MetadataFieldType$inboundSchema;
    /** @deprecated use `MetadataFieldType$outboundSchema` instead. */
    MetadataFieldType$.outboundSchema = exports.MetadataFieldType$outboundSchema;
})(MetadataFieldType$ || (exports.MetadataFieldType$ = MetadataFieldType$ = {}));
/** @internal */
exports.DefaultValue$inboundSchema = z.union([z.string(), z.number().int()]);
/** @internal */
exports.DefaultValue$outboundSchema = z.union([z.string(), z.number().int()]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var DefaultValue$;
(function (DefaultValue$) {
    /** @deprecated use `DefaultValue$inboundSchema` instead. */
    DefaultValue$.inboundSchema = exports.DefaultValue$inboundSchema;
    /** @deprecated use `DefaultValue$outboundSchema` instead. */
    DefaultValue$.outboundSchema = exports.DefaultValue$outboundSchema;
})(DefaultValue$ || (exports.DefaultValue$ = DefaultValue$ = {}));
function defaultValueToJSON(defaultValue) {
    return JSON.stringify(exports.DefaultValue$outboundSchema.parse(defaultValue));
}
function defaultValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.DefaultValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'DefaultValue' from JSON`);
}
/** @internal */
exports.Validation$inboundSchema = z.object({});
/** @internal */
exports.Validation$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 Validation$;
(function (Validation$) {
    /** @deprecated use `Validation$inboundSchema` instead. */
    Validation$.inboundSchema = exports.Validation$inboundSchema;
    /** @deprecated use `Validation$outboundSchema` instead. */
    Validation$.outboundSchema = exports.Validation$outboundSchema;
})(Validation$ || (exports.Validation$ = Validation$ = {}));
function validationToJSON(validation) {
    return JSON.stringify(exports.Validation$outboundSchema.parse(validation));
}
function validationFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Validation$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Validation' from JSON`);
}
/** @internal */
exports.Restrictions$inboundSchema = z.object({
    readonly_ui: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "readonly_ui": "readonlyUi",
    });
});
/** @internal */
exports.Restrictions$outboundSchema = z.object({
    readonlyUi: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        readonlyUi: "readonly_ui",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Restrictions$;
(function (Restrictions$) {
    /** @deprecated use `Restrictions$inboundSchema` instead. */
    Restrictions$.inboundSchema = exports.Restrictions$inboundSchema;
    /** @deprecated use `Restrictions$outboundSchema` instead. */
    Restrictions$.outboundSchema = exports.Restrictions$outboundSchema;
})(Restrictions$ || (exports.Restrictions$ = Restrictions$ = {}));
function restrictionsToJSON(restrictions) {
    return JSON.stringify(exports.Restrictions$outboundSchema.parse(restrictions));
}
function restrictionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Restrictions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Restrictions' from JSON`);
}
/** @internal */
exports.MetadataFieldState$inboundSchema = z.nativeEnum(exports.MetadataFieldState);
/** @internal */
exports.MetadataFieldState$outboundSchema = exports.MetadataFieldState$inboundSchema;
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var MetadataFieldState$;
(function (MetadataFieldState$) {
    /** @deprecated use `MetadataFieldState$inboundSchema` instead. */
    MetadataFieldState$.inboundSchema = exports.MetadataFieldState$inboundSchema;
    /** @deprecated use `MetadataFieldState$outboundSchema` instead. */
    MetadataFieldState$.outboundSchema = exports.MetadataFieldState$outboundSchema;
})(MetadataFieldState$ || (exports.MetadataFieldState$ = MetadataFieldState$ = {}));
/** @internal */
exports.Value$inboundSchema = z
    .object({
    external_id: z.string().optional(),
    value: z.string().optional(),
    position: z.number().int().optional(),
    state: exports.MetadataFieldState$inboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "external_id": "externalId",
    });
});
/** @internal */
exports.Value$outboundSchema = z.object({
    externalId: z.string().optional(),
    value: z.string().optional(),
    position: z.number().int().optional(),
    state: exports.MetadataFieldState$outboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        externalId: "external_id",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Value$;
(function (Value$) {
    /** @deprecated use `Value$inboundSchema` instead. */
    Value$.inboundSchema = exports.Value$inboundSchema;
    /** @deprecated use `Value$outboundSchema` instead. */
    Value$.outboundSchema = exports.Value$outboundSchema;
})(Value$ || (exports.Value$ = Value$ = {}));
function valueToJSON(value) {
    return JSON.stringify(exports.Value$outboundSchema.parse(value));
}
function valueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Value$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Value' from JSON`);
}
/** @internal */
exports.Datasource$inboundSchema = z.object({
    values: z.array(z.lazy(() => exports.Value$inboundSchema)).optional(),
});
/** @internal */
exports.Datasource$outboundSchema = z.object({
    values: z.array(z.lazy(() => exports.Value$outboundSchema)).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var Datasource$;
(function (Datasource$) {
    /** @deprecated use `Datasource$inboundSchema` instead. */
    Datasource$.inboundSchema = exports.Datasource$inboundSchema;
    /** @deprecated use `Datasource$outboundSchema` instead. */
    Datasource$.outboundSchema = exports.Datasource$outboundSchema;
})(Datasource$ || (exports.Datasource$ = Datasource$ = {}));
function datasourceToJSON(datasource) {
    return JSON.stringify(exports.Datasource$outboundSchema.parse(datasource));
}
function datasourceFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Datasource$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Datasource' from JSON`);
}
/** @internal */
exports.MetadataField$inboundSchema = z.object({
    type: exports.MetadataFieldType$inboundSchema,
    external_id: z.string().optional(),
    label: z.string(),
    mandatory: z.nullable(z.boolean()).optional(),
    default_value: z.nullable(z.union([z.string(), z.number().int()])).optional(),
    default_disabled: z.nullable(z.boolean()).optional(),
    validation: z.nullable(z.lazy(() => exports.Validation$inboundSchema)).optional(),
    restrictions: z.nullable(z.lazy(() => exports.Restrictions$inboundSchema)).optional(),
    datasource: z.nullable(z.lazy(() => exports.Datasource$inboundSchema)).optional(),
    allow_dynamic_list_values: z.nullable(z.boolean()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "external_id": "externalId",
        "default_value": "defaultValue",
        "default_disabled": "defaultDisabled",
        "allow_dynamic_list_values": "allowDynamicListValues",
    });
});
/** @internal */
exports.MetadataField$outboundSchema = z.object({
    type: exports.MetadataFieldType$outboundSchema,
    externalId: z.string().optional(),
    label: z.string(),
    mandatory: z.nullable(z.boolean()).optional(),
    defaultValue: z.nullable(z.union([z.string(), z.number().int()])).optional(),
    defaultDisabled: z.nullable(z.boolean()).optional(),
    validation: z.nullable(z.lazy(() => exports.Validation$outboundSchema)).optional(),
    restrictions: z.nullable(z.lazy(() => exports.Restrictions$outboundSchema))
        .optional(),
    datasource: z.nullable(z.lazy(() => exports.Datasource$outboundSchema)).optional(),
    allowDynamicListValues: z.nullable(z.boolean()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        externalId: "external_id",
        defaultValue: "default_value",
        defaultDisabled: "default_disabled",
        allowDynamicListValues: "allow_dynamic_list_values",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var MetadataField$;
(function (MetadataField$) {
    /** @deprecated use `MetadataField$inboundSchema` instead. */
    MetadataField$.inboundSchema = exports.MetadataField$inboundSchema;
    /** @deprecated use `MetadataField$outboundSchema` instead. */
    MetadataField$.outboundSchema = exports.MetadataField$outboundSchema;
})(MetadataField$ || (exports.MetadataField$ = MetadataField$ = {}));
function metadataFieldToJSON(metadataField) {
    return JSON.stringify(exports.MetadataField$outboundSchema.parse(metadataField));
}
function metadataFieldFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.MetadataField$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'MetadataField' from JSON`);
}
//# sourceMappingURL=metadatafield.js.map