"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.SupplierInput$outboundSchema = exports.Supplier$inboundSchema = exports.SupplierStatus$outboundSchema = exports.SupplierStatus$inboundSchema = exports.SupplierStatus = void 0;
exports.supplierFromJSON = supplierFromJSON;
exports.supplierInputToJSON = supplierInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const address_js_1 = require("./address.js");
const bankaccount_js_1 = require("./bankaccount.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const email_js_1 = require("./email.js");
const linkedledgeraccount_js_1 = require("./linkedledgeraccount.js");
const linkedtaxdetail_js_1 = require("./linkedtaxdetail.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const linkedtaxstatusdetail_js_1 = require("./linkedtaxstatusdetail.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
const phonenumber_js_1 = require("./phonenumber.js");
const website_js_1 = require("./website.js");
/**
 * Supplier status
 */
exports.SupplierStatus = {
    Active: "active",
    Inactive: "inactive",
    Archived: "archived",
    GdprErasureRequest: "gdpr-erasure-request",
    Unknown: "unknown",
};
/** @internal */
exports.SupplierStatus$inboundSchema = z.nativeEnum(exports.SupplierStatus);
/** @internal */
exports.SupplierStatus$outboundSchema = exports.SupplierStatus$inboundSchema;
/** @internal */
exports.Supplier$inboundSchema = z.object({
    id: z.string(),
    downstream_id: z.nullable(z.string()).optional(),
    display_id: z.nullable(z.string()).optional(),
    display_name: z.nullable(z.string()).optional(),
    company_name: z.nullable(z.string()).optional(),
    company_id: z.nullable(z.string()).optional(),
    supplier_category: z.nullable(z.string()).optional(),
    title: z.nullable(z.string()).optional(),
    first_name: z.nullable(z.string()).optional(),
    middle_name: z.nullable(z.string()).optional(),
    last_name: z.nullable(z.string()).optional(),
    suffix: z.nullable(z.string()).optional(),
    individual: z.nullable(z.boolean()).optional(),
    addresses: z.array(address_js_1.Address$inboundSchema).optional(),
    phone_numbers: z.array(phonenumber_js_1.PhoneNumber$inboundSchema).optional(),
    emails: z.array(email_js_1.Email$inboundSchema).optional(),
    websites: z.array(website_js_1.Website$inboundSchema).optional(),
    bank_accounts: z.array(bankaccount_js_1.BankAccount$inboundSchema).optional(),
    notes: z.nullable(z.string()).optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
    tax_number: z.nullable(z.string()).optional(),
    taxable: z.nullable(z.boolean()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$inboundSchema).optional(),
    status: z.nullable(exports.SupplierStatus$inboundSchema).optional(),
    payment_method: z.nullable(z.string()).optional(),
    terms: z.nullable(z.string()).optional(),
    channel: z.nullable(z.string()).optional(),
    issued_method: z.nullable(z.string()).optional(),
    issued_email: z.nullable(z.string()).optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
    tax_details: z.array(z.nullable(linkedtaxdetail_js_1.LinkedTaxDetail$inboundSchema)).optional(),
    tax_status_details: z.array(z.nullable(linkedtaxstatusdetail_js_1.LinkedTaxStatusDetail$inboundSchema))
        .optional(),
    updated_by: z.nullable(z.string()).optional(),
    created_by: z.nullable(z.string()).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    row_version: z.nullable(z.string()).optional(),
    pass_through: z.array(passthroughbody_js_1.PassThroughBody$inboundSchema).optional(),
    subsidiary_id: z.string().optional(),
    integration_system_id: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "display_id": "displayId",
        "display_name": "displayName",
        "company_name": "companyName",
        "company_id": "companyId",
        "supplier_category": "supplierCategory",
        "first_name": "firstName",
        "middle_name": "middleName",
        "last_name": "lastName",
        "phone_numbers": "phoneNumbers",
        "bank_accounts": "bankAccounts",
        "tax_rate": "taxRate",
        "tax_number": "taxNumber",
        "payment_method": "paymentMethod",
        "issued_method": "issuedMethod",
        "issued_email": "issuedEmail",
        "custom_mappings": "customMappings",
        "custom_fields": "customFields",
        "tax_details": "taxDetails",
        "tax_status_details": "taxStatusDetails",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "row_version": "rowVersion",
        "pass_through": "passThrough",
        "subsidiary_id": "subsidiaryId",
        "integration_system_id": "integrationSystemId",
    });
});
function supplierFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Supplier$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Supplier' from JSON`);
}
/** @internal */
exports.SupplierInput$outboundSchema = z.object({
    displayId: z.nullable(z.string()).optional(),
    displayName: z.nullable(z.string()).optional(),
    companyName: z.nullable(z.string()).optional(),
    companyId: z.nullable(z.string()).optional(),
    supplierCategory: z.nullable(z.string()).optional(),
    title: z.nullable(z.string()).optional(),
    firstName: z.nullable(z.string()).optional(),
    middleName: z.nullable(z.string()).optional(),
    lastName: z.nullable(z.string()).optional(),
    suffix: z.nullable(z.string()).optional(),
    individual: z.nullable(z.boolean()).optional(),
    addresses: z.array(address_js_1.Address$outboundSchema).optional(),
    phoneNumbers: z.array(phonenumber_js_1.PhoneNumber$outboundSchema).optional(),
    emails: z.array(email_js_1.Email$outboundSchema).optional(),
    websites: z.array(website_js_1.Website$outboundSchema).optional(),
    bankAccounts: z.array(bankaccount_js_1.BankAccount$outboundSchema).optional(),
    notes: z.nullable(z.string()).optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
    taxNumber: z.nullable(z.string()).optional(),
    taxable: z.nullable(z.boolean()).optional(),
    currency: z.nullable(currency_js_1.Currency$outboundSchema).optional(),
    account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema).optional(),
    status: z.nullable(exports.SupplierStatus$outboundSchema).optional(),
    paymentMethod: z.nullable(z.string()).optional(),
    terms: z.nullable(z.string()).optional(),
    channel: z.nullable(z.string()).optional(),
    issuedMethod: z.nullable(z.string()).optional(),
    issuedEmail: z.nullable(z.string()).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
    taxDetails: z.array(z.nullable(linkedtaxdetail_js_1.LinkedTaxDetail$outboundSchema)).optional(),
    taxStatusDetails: z.array(z.nullable(linkedtaxstatusdetail_js_1.LinkedTaxStatusDetail$outboundSchema))
        .optional(),
    rowVersion: z.nullable(z.string()).optional(),
    passThrough: z.array(passthroughbody_js_1.PassThroughBody$outboundSchema).optional(),
    subsidiaryId: z.string().optional(),
    integrationSystemId: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        displayName: "display_name",
        companyName: "company_name",
        companyId: "company_id",
        supplierCategory: "supplier_category",
        firstName: "first_name",
        middleName: "middle_name",
        lastName: "last_name",
        phoneNumbers: "phone_numbers",
        bankAccounts: "bank_accounts",
        taxRate: "tax_rate",
        taxNumber: "tax_number",
        paymentMethod: "payment_method",
        issuedMethod: "issued_method",
        issuedEmail: "issued_email",
        customFields: "custom_fields",
        taxDetails: "tax_details",
        taxStatusDetails: "tax_status_details",
        rowVersion: "row_version",
        passThrough: "pass_through",
        subsidiaryId: "subsidiary_id",
        integrationSystemId: "integration_system_id",
    });
});
function supplierInputToJSON(supplierInput) {
    return JSON.stringify(exports.SupplierInput$outboundSchema.parse(supplierInput));
}
//# sourceMappingURL=supplier.js.map