"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.TaxRateInput$outboundSchema = exports.TaxRate$inboundSchema = exports.Subsidiaries$outboundSchema = exports.Subsidiaries$inboundSchema = exports.TaxRateStatus$outboundSchema = exports.TaxRateStatus$inboundSchema = exports.Components$outboundSchema = exports.Components$inboundSchema = exports.TaxRateStatus = void 0;
exports.componentsToJSON = componentsToJSON;
exports.componentsFromJSON = componentsFromJSON;
exports.subsidiariesToJSON = subsidiariesToJSON;
exports.subsidiariesFromJSON = subsidiariesFromJSON;
exports.taxRateFromJSON = taxRateFromJSON;
exports.taxRateInputToJSON = taxRateInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const customfield_js_1 = require("./customfield.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
/**
 * Tax rate status
 */
exports.TaxRateStatus = {
    Active: "active",
    Inactive: "inactive",
    Archived: "archived",
};
/** @internal */
exports.Components$inboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    name: z.string().optional(),
    rate: z.nullable(z.number()).optional(),
    compound: z.nullable(z.boolean()).optional(),
});
/** @internal */
exports.Components$outboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    name: z.string().optional(),
    rate: z.nullable(z.number()).optional(),
    compound: z.nullable(z.boolean()).optional(),
});
function componentsToJSON(components) {
    return JSON.stringify(exports.Components$outboundSchema.parse(components));
}
function componentsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Components$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Components' from JSON`);
}
/** @internal */
exports.TaxRateStatus$inboundSchema = z.nativeEnum(exports.TaxRateStatus);
/** @internal */
exports.TaxRateStatus$outboundSchema = exports.TaxRateStatus$inboundSchema;
/** @internal */
exports.Subsidiaries$inboundSchema = z.object({
    id: z.string().optional(),
});
/** @internal */
exports.Subsidiaries$outboundSchema = z.object({
    id: z.string().optional(),
});
function subsidiariesToJSON(subsidiaries) {
    return JSON.stringify(exports.Subsidiaries$outboundSchema.parse(subsidiaries));
}
function subsidiariesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Subsidiaries$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Subsidiaries' from JSON`);
}
/** @internal */
exports.TaxRate$inboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    display_id: z.nullable(z.string()).optional(),
    name: z.string().optional(),
    code: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    effective_tax_rate: z.nullable(z.number()).optional(),
    country: z.nullable(z.string()).optional(),
    total_tax_rate: z.nullable(z.number()).optional(),
    tax_payable_account_id: z.nullable(z.string()).optional(),
    tax_remitted_account_id: z.nullable(z.string()).optional(),
    components: z.nullable(z.array(z.lazy(() => exports.Components$inboundSchema)))
        .optional(),
    type: z.nullable(z.string()).optional(),
    report_tax_type: z.nullable(z.string()).optional(),
    original_tax_rate_id: z.nullable(z.string()).optional(),
    status: z.nullable(exports.TaxRateStatus$inboundSchema).optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    row_version: z.nullable(z.string()).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(),
    pass_through: z.array(passthroughbody_js_1.PassThroughBody$inboundSchema).optional(),
    subsidiaries: z.array(z.lazy(() => exports.Subsidiaries$inboundSchema)).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "display_id": "displayId",
        "effective_tax_rate": "effectiveTaxRate",
        "total_tax_rate": "totalTaxRate",
        "tax_payable_account_id": "taxPayableAccountId",
        "tax_remitted_account_id": "taxRemittedAccountId",
        "report_tax_type": "reportTaxType",
        "original_tax_rate_id": "originalTaxRateId",
        "custom_mappings": "customMappings",
        "row_version": "rowVersion",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "pass_through": "passThrough",
        "custom_fields": "customFields",
    });
});
function taxRateFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.TaxRate$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'TaxRate' from JSON`);
}
/** @internal */
exports.TaxRateInput$outboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    displayId: z.nullable(z.string()).optional(),
    name: z.string().optional(),
    code: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    effectiveTaxRate: z.nullable(z.number()).optional(),
    country: z.nullable(z.string()).optional(),
    totalTaxRate: z.nullable(z.number()).optional(),
    taxPayableAccountId: z.nullable(z.string()).optional(),
    taxRemittedAccountId: z.nullable(z.string()).optional(),
    components: z.nullable(z.array(z.lazy(() => exports.Components$outboundSchema)))
        .optional(),
    type: z.nullable(z.string()).optional(),
    reportTaxType: z.nullable(z.string()).optional(),
    originalTaxRateId: z.nullable(z.string()).optional(),
    status: z.nullable(exports.TaxRateStatus$outboundSchema).optional(),
    rowVersion: z.nullable(z.string()).optional(),
    passThrough: z.array(passthroughbody_js_1.PassThroughBody$outboundSchema).optional(),
    subsidiaries: z.array(z.lazy(() => exports.Subsidiaries$outboundSchema)).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        effectiveTaxRate: "effective_tax_rate",
        totalTaxRate: "total_tax_rate",
        taxPayableAccountId: "tax_payable_account_id",
        taxRemittedAccountId: "tax_remitted_account_id",
        reportTaxType: "report_tax_type",
        originalTaxRateId: "original_tax_rate_id",
        rowVersion: "row_version",
        passThrough: "pass_through",
        customFields: "custom_fields",
    });
});
function taxRateInputToJSON(taxRateInput) {
    return JSON.stringify(exports.TaxRateInput$outboundSchema.parse(taxRateInput));
}
//# sourceMappingURL=taxrate.js.map