"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.EcommerceOrder$inboundSchema = exports.FulfillmentStatus$inboundSchema = exports.EcommerceOrderPaymentStatus$inboundSchema = exports.FulfillmentStatus = exports.EcommerceOrderPaymentStatus = void 0;
exports.ecommerceOrderFromJSON = ecommerceOrderFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const openEnums = __importStar(require("../../types/enums.js"));
const types = __importStar(require("../../types/primitives.js"));
const currency_js_1 = require("./currency.js");
const ecommerceaddress_js_1 = require("./ecommerceaddress.js");
const ecommercediscount_js_1 = require("./ecommercediscount.js");
const ecommerceorderlineitem_js_1 = require("./ecommerceorderlineitem.js");
const ecommerceorderrefund_js_1 = require("./ecommerceorderrefund.js");
const ecommerceorderstatus_js_1 = require("./ecommerceorderstatus.js");
const linkedecommercecustomer_js_1 = require("./linkedecommercecustomer.js");
const trackingitem_js_1 = require("./trackingitem.js");
/**
 * Current payment status of the order.
 */
exports.EcommerceOrderPaymentStatus = {
    Pending: "pending",
    Authorized: "authorized",
    Paid: "paid",
    Partial: "partial",
    Refunded: "refunded",
    Voided: "voided",
    Unknown: "unknown",
    PartiallyRefunded: "partially_refunded",
};
/**
 * Current fulfillment status of the order.
 */
exports.FulfillmentStatus = {
    Pending: "pending",
    Shipped: "shipped",
    Partial: "partial",
    Delivered: "delivered",
    Cancelled: "cancelled",
    Returned: "returned",
    Unknown: "unknown",
};
/** @internal */
exports.EcommerceOrderPaymentStatus$inboundSchema = openEnums.inboundSchema(exports.EcommerceOrderPaymentStatus);
/** @internal */
exports.FulfillmentStatus$inboundSchema = openEnums.inboundSchema(exports.FulfillmentStatus);
/** @internal */
exports.EcommerceOrder$inboundSchema = z.object({
    id: types.string(),
    order_number: z.nullable(types.string()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    discounts: types.optional(z.array(ecommercediscount_js_1.EcommerceDiscount$inboundSchema)),
    sub_total: z.nullable(types.string()).optional(),
    shipping_cost: z.nullable(types.string()).optional(),
    coupon_discount: z.nullable(types.string()).optional(),
    total_discount: z.nullable(types.string()).optional(),
    total_tax: z.nullable(types.string()).optional(),
    total_amount: z.nullable(types.string()).optional(),
    refunded_amount: z.nullable(types.string()).optional(),
    status: z.nullable(ecommerceorderstatus_js_1.EcommerceOrderStatus$inboundSchema).optional(),
    payment_status: z.nullable(exports.EcommerceOrderPaymentStatus$inboundSchema)
        .optional(),
    fulfillment_status: z.nullable(exports.FulfillmentStatus$inboundSchema).optional(),
    payment_method: z.nullable(types.string()).optional(),
    customer: types.optional(linkedecommercecustomer_js_1.LinkedEcommerceCustomer$inboundSchema),
    billing_address: types.optional(ecommerceaddress_js_1.EcommerceAddress$inboundSchema),
    shipping_address: types.optional(ecommerceaddress_js_1.EcommerceAddress$inboundSchema),
    tracking: types.optional(z.array(trackingitem_js_1.TrackingItem$inboundSchema)),
    line_items: types.optional(z.array(ecommerceorderlineitem_js_1.EcommerceOrderLineItem$inboundSchema)),
    note: z.nullable(types.string()).optional(),
    refunds: types.optional(z.array(ecommerceorderrefund_js_1.EcommerceOrderRefund$inboundSchema)),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    created_at: z.nullable(types.date()).optional(),
    updated_at: z.nullable(types.date()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "order_number": "orderNumber",
        "sub_total": "subTotal",
        "shipping_cost": "shippingCost",
        "coupon_discount": "couponDiscount",
        "total_discount": "totalDiscount",
        "total_tax": "totalTax",
        "total_amount": "totalAmount",
        "refunded_amount": "refundedAmount",
        "payment_status": "paymentStatus",
        "fulfillment_status": "fulfillmentStatus",
        "payment_method": "paymentMethod",
        "billing_address": "billingAddress",
        "shipping_address": "shippingAddress",
        "line_items": "lineItems",
        "custom_mappings": "customMappings",
        "created_at": "createdAt",
        "updated_at": "updatedAt",
    });
});
function ecommerceOrderFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.EcommerceOrder$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'EcommerceOrder' from JSON`);
}
//# sourceMappingURL=ecommerceorder.js.map