"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.QuoteInput$outboundSchema = exports.Quote$inboundSchema = exports.QuoteStatus$outboundSchema = exports.QuoteStatus$inboundSchema = exports.QuoteStatus = void 0;
exports.quoteFromJSON = quoteFromJSON;
exports.quoteInputToJSON = quoteInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const rfcdate_js_1 = require("../../types/rfcdate.js");
const address_js_1 = require("./address.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const linkedcustomer_js_1 = require("./linkedcustomer.js");
const linkedcustomerinput_js_1 = require("./linkedcustomerinput.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
const quotelineitem_js_1 = require("./quotelineitem.js");
/**
 * Quote status
 */
exports.QuoteStatus = {
    Draft: "draft",
    Sent: "sent",
    Accepted: "accepted",
    Rejected: "rejected",
    Expired: "expired",
    Converted: "converted",
    Void: "void",
    Deleted: "deleted",
};
/** @internal */
exports.QuoteStatus$inboundSchema = z
    .nativeEnum(exports.QuoteStatus);
/** @internal */
exports.QuoteStatus$outboundSchema = exports.QuoteStatus$inboundSchema;
/** @internal */
exports.Quote$inboundSchema = z
    .object({
    id: z.string().optional(),
    downstream_id: z.nullable(z.string()).optional(),
    number: z.nullable(z.string()).optional(),
    customer: z.nullable(linkedcustomer_js_1.LinkedCustomer$inboundSchema).optional(),
    invoice_id: z.string().optional(),
    sales_order_id: z.nullable(z.string()).optional(),
    company_id: z.nullable(z.string()).optional(),
    department_id: z.nullable(z.string()).optional(),
    project_id: z.string().optional(),
    quote_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v)))
        .optional(),
    expiry_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v)))
        .optional(),
    terms: z.nullable(z.string()).optional(),
    reference: z.nullable(z.string()).optional(),
    status: z.nullable(exports.QuoteStatus$inboundSchema).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    currency_rate: z.nullable(z.number()).optional(),
    tax_inclusive: z.nullable(z.boolean()).optional(),
    sub_total: z.nullable(z.number()).optional(),
    total_tax: z.nullable(z.number()).optional(),
    tax_code: z.nullable(z.string()).optional(),
    discount_percentage: z.nullable(z.number()).optional(),
    discount_amount: z.nullable(z.number()).optional(),
    total: z.nullable(z.number()).optional(),
    customer_memo: z.nullable(z.string()).optional(),
    line_items: z.array(quotelineitem_js_1.QuoteLineItem$inboundSchema).optional(),
    billing_address: address_js_1.Address$inboundSchema.optional(),
    shipping_address: address_js_1.Address$inboundSchema.optional(),
    tracking_categories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$inboundSchema))).optional(),
    template_id: z.nullable(z.string()).optional(),
    source_document_url: z.nullable(z.string()).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).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(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "invoice_id": "invoiceId",
        "sales_order_id": "salesOrderId",
        "company_id": "companyId",
        "department_id": "departmentId",
        "project_id": "projectId",
        "quote_date": "quoteDate",
        "expiry_date": "expiryDate",
        "currency_rate": "currencyRate",
        "tax_inclusive": "taxInclusive",
        "sub_total": "subTotal",
        "total_tax": "totalTax",
        "tax_code": "taxCode",
        "discount_percentage": "discountPercentage",
        "discount_amount": "discountAmount",
        "customer_memo": "customerMemo",
        "line_items": "lineItems",
        "billing_address": "billingAddress",
        "shipping_address": "shippingAddress",
        "tracking_categories": "trackingCategories",
        "template_id": "templateId",
        "source_document_url": "sourceDocumentUrl",
        "custom_fields": "customFields",
        "row_version": "rowVersion",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "pass_through": "passThrough",
    });
});
function quoteFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Quote$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Quote' from JSON`);
}
/** @internal */
exports.QuoteInput$outboundSchema = z.object({
    number: z.nullable(z.string()).optional(),
    customer: z.nullable(linkedcustomerinput_js_1.LinkedCustomerInput$outboundSchema).optional(),
    salesOrderId: z.nullable(z.string()).optional(),
    companyId: z.nullable(z.string()).optional(),
    departmentId: z.nullable(z.string()).optional(),
    projectId: z.string().optional(),
    quoteDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    expiryDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    terms: z.nullable(z.string()).optional(),
    reference: z.nullable(z.string()).optional(),
    status: z.nullable(exports.QuoteStatus$outboundSchema).optional(),
    currency: z.nullable(currency_js_1.Currency$outboundSchema).optional(),
    currencyRate: z.nullable(z.number()).optional(),
    taxInclusive: z.nullable(z.boolean()).optional(),
    subTotal: z.nullable(z.number()).optional(),
    totalTax: z.nullable(z.number()).optional(),
    taxCode: z.nullable(z.string()).optional(),
    discountPercentage: z.nullable(z.number()).optional(),
    discountAmount: z.nullable(z.number()).optional(),
    total: z.nullable(z.number()).optional(),
    customerMemo: z.nullable(z.string()).optional(),
    lineItems: z.array(quotelineitem_js_1.QuoteLineItemInput$outboundSchema).optional(),
    billingAddress: address_js_1.Address$outboundSchema.optional(),
    shippingAddress: address_js_1.Address$outboundSchema.optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$outboundSchema))).optional(),
    templateId: z.nullable(z.string()).optional(),
    sourceDocumentUrl: 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, {
        salesOrderId: "sales_order_id",
        companyId: "company_id",
        departmentId: "department_id",
        projectId: "project_id",
        quoteDate: "quote_date",
        expiryDate: "expiry_date",
        currencyRate: "currency_rate",
        taxInclusive: "tax_inclusive",
        subTotal: "sub_total",
        totalTax: "total_tax",
        taxCode: "tax_code",
        discountPercentage: "discount_percentage",
        discountAmount: "discount_amount",
        customerMemo: "customer_memo",
        lineItems: "line_items",
        billingAddress: "billing_address",
        shippingAddress: "shipping_address",
        trackingCategories: "tracking_categories",
        templateId: "template_id",
        sourceDocumentUrl: "source_document_url",
        customFields: "custom_fields",
        rowVersion: "row_version",
        passThrough: "pass_through",
    });
});
function quoteInputToJSON(quoteInput) {
    return JSON.stringify(exports.QuoteInput$outboundSchema.parse(quoteInput));
}
//# sourceMappingURL=quote.js.map