"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.writeResultApiModelFromJSON = exports.writeResultApiModelToJSON = exports.WriteResultApiModel$ = exports.WriteResultApiModel$outboundSchema = exports.WriteResultApiModel$inboundSchema = void 0;
const z = __importStar(require("zod"));
const primitives_js_1 = require("../../../lib/primitives.js");
const schemas_js_1 = require("../../../lib/schemas.js");
const providererrorapimodel_js_1 = require("./providererrorapimodel.js");
const unifiedwarningapimodel_js_1 = require("./unifiedwarningapimodel.js");
/** @internal */
exports.WriteResultApiModel$inboundSchema = z.object({
    message: z.nullable(z.string()).optional(),
    provider_errors: z.nullable(z.array(providererrorapimodel_js_1.ProviderErrorApiModel$inboundSchema))
        .optional(),
    statusCode: z.nullable(z.number()).optional(),
    timestamp: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    unified_warnings: z.nullable(z.array(unifiedwarningapimodel_js_1.UnifiedWarningApiModel$inboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "provider_errors": "providerErrors",
        "unified_warnings": "unifiedWarnings",
    });
});
/** @internal */
exports.WriteResultApiModel$outboundSchema = z.object({
    message: z.nullable(z.string()).optional(),
    providerErrors: z.nullable(z.array(providererrorapimodel_js_1.ProviderErrorApiModel$outboundSchema))
        .optional(),
    statusCode: z.nullable(z.number()).optional(),
    timestamp: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    unifiedWarnings: z.nullable(z.array(unifiedwarningapimodel_js_1.UnifiedWarningApiModel$outboundSchema))
        .optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        providerErrors: "provider_errors",
        unifiedWarnings: "unified_warnings",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var WriteResultApiModel$;
(function (WriteResultApiModel$) {
    /** @deprecated use `WriteResultApiModel$inboundSchema` instead. */
    WriteResultApiModel$.inboundSchema = exports.WriteResultApiModel$inboundSchema;
    /** @deprecated use `WriteResultApiModel$outboundSchema` instead. */
    WriteResultApiModel$.outboundSchema = exports.WriteResultApiModel$outboundSchema;
})(WriteResultApiModel$ || (exports.WriteResultApiModel$ = WriteResultApiModel$ = {}));
function writeResultApiModelToJSON(writeResultApiModel) {
    return JSON.stringify(exports.WriteResultApiModel$outboundSchema.parse(writeResultApiModel));
}
exports.writeResultApiModelToJSON = writeResultApiModelToJSON;
function writeResultApiModelFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.WriteResultApiModel$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WriteResultApiModel' from JSON`);
}
exports.writeResultApiModelFromJSON = writeResultApiModelFromJSON;
//# sourceMappingURL=writeresultapimodel.js.map