"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.CustomerInput$outboundSchema = exports.Customer$inboundSchema = exports.CustomerStatusStatus$outboundSchema = exports.CustomerStatusStatus$inboundSchema = exports.CustomerStatusStatus = void 0;
exports.customerFromJSON = customerFromJSON;
exports.customerInputToJSON = customerInputToJSON;
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 linkedparentcustomer_js_1 = require("./linkedparentcustomer.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
const phonenumber_js_1 = require("./phonenumber.js");
const website_js_1 = require("./website.js");
/**
 * Customer status
 */
exports.CustomerStatusStatus = {
    Active: "active",
    Inactive: "inactive",
    Archived: "archived",
    GdprErasureRequest: "gdpr-erasure-request",
    Unknown: "unknown",
};
/** @internal */
exports.CustomerStatusStatus$inboundSchema = z.nativeEnum(exports.CustomerStatusStatus);
/** @internal */
exports.CustomerStatusStatus$outboundSchema = exports.CustomerStatusStatus$inboundSchema;
/** @internal */
exports.Customer$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(),
    customer_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(),
    project: 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(),
    parent: z.nullable(linkedparentcustomer_js_1.LinkedParentCustomer$inboundSchema).optional(),
    status: z.nullable(exports.CustomerStatusStatus$inboundSchema).optional(),
    payment_method: z.nullable(z.string()).optional(),
    terms: z.nullable(z.string()).optional(),
    channel: z.nullable(z.string()).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
    custom_mappings: z.nullable(z.record(z.any())).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(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "display_id": "displayId",
        "display_name": "displayName",
        "company_name": "companyName",
        "company_id": "companyId",
        "customer_category": "customerCategory",
        "first_name": "firstName",
        "middle_name": "middleName",
        "last_name": "lastName",
        "phone_numbers": "phoneNumbers",
        "bank_accounts": "bankAccounts",
        "tax_rate": "taxRate",
        "tax_number": "taxNumber",
        "payment_method": "paymentMethod",
        "custom_fields": "customFields",
        "custom_mappings": "customMappings",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "row_version": "rowVersion",
        "pass_through": "passThrough",
    });
});
function customerFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Customer$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Customer' from JSON`);
}
/** @internal */
exports.CustomerInput$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(),
    customerCategory: 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(),
    project: 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(),
    parent: z.nullable(linkedparentcustomer_js_1.LinkedParentCustomer$outboundSchema).optional(),
    status: z.nullable(exports.CustomerStatusStatus$outboundSchema).optional(),
    paymentMethod: z.nullable(z.string()).optional(),
    terms: z.nullable(z.string()).optional(),
    channel: z.nullable(z.string()).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
    rowVersion: z.nullable(z.string()).optional(),
    passThrough: z.array(passthroughbody_js_1.PassThroughBody$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        displayName: "display_name",
        companyName: "company_name",
        companyId: "company_id",
        customerCategory: "customer_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",
        customFields: "custom_fields",
        rowVersion: "row_version",
        passThrough: "pass_through",
    });
});
function customerInputToJSON(customerInput) {
    return JSON.stringify(exports.CustomerInput$outboundSchema.parse(customerInput));
}
//# sourceMappingURL=customer.js.map