import * as Schema from "effect/Schema";
import { API } from "../client";
import * as T from "../traits";
// Input Schema
export const PostInvoicesInvoiceAttachPaymentInput = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    invoice: Schema.String.pipe(T.PathParam()),
    expand: Schema.optional(Schema.Array(Schema.String)),
    payment_intent: Schema.optional(Schema.String),
    payment_record: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "POST",
    path: "/v1/invoices/{invoice}/attach_payment",
    contentType: "form-urlencoded",
}));
// Output Schema
export const PostInvoicesInvoiceAttachPaymentOutput = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    account_country: Schema.NullOr(Schema.String),
    account_name: Schema.NullOr(Schema.String),
    account_tax_ids: Schema.NullOr(Schema.Array(Schema.Unknown)),
    amount_due: Schema.Number,
    amount_overpaid: Schema.Number,
    amount_paid: Schema.Number,
    amount_remaining: Schema.Number,
    amount_shipping: Schema.Number,
    application: Schema.Unknown,
    attempt_count: Schema.Number,
    attempted: Schema.Boolean,
    auto_advance: Schema.optional(Schema.Boolean),
    automatic_tax: Schema.Struct({
        disabled_reason: Schema.NullOr(Schema.Literals([
            "finalization_requires_location_inputs",
            "finalization_system_error",
        ])),
        enabled: Schema.Boolean,
        liability: Schema.Unknown,
        provider: Schema.NullOr(Schema.String),
        status: Schema.NullOr(Schema.Literals(["complete", "failed", "requires_location_inputs"])),
    }),
    automatically_finalizes_at: Schema.NullOr(Schema.Number),
    billing_reason: Schema.NullOr(Schema.Literals([
        "automatic_pending_invoice_item_invoice",
        "manual",
        "quote_accept",
        "subscription",
        "subscription_create",
        "subscription_cycle",
        "subscription_threshold",
        "subscription_update",
        "upcoming",
    ])),
    collection_method: Schema.Literals([
        "charge_automatically",
        "send_invoice",
    ]),
    confirmation_secret: Schema.optional(Schema.Unknown),
    created: Schema.Number,
    currency: Schema.String,
    custom_fields: Schema.NullOr(Schema.Array(Schema.Struct({
        name: Schema.String,
        value: Schema.String,
    }))),
    customer: Schema.Unknown,
    customer_account: Schema.NullOr(Schema.String),
    customer_address: Schema.Unknown,
    customer_email: Schema.NullOr(Schema.String),
    customer_name: Schema.NullOr(Schema.String),
    customer_phone: Schema.NullOr(Schema.String),
    customer_shipping: Schema.Unknown,
    customer_tax_exempt: Schema.NullOr(Schema.Literals(["exempt", "none", "reverse"])),
    customer_tax_ids: Schema.optional(Schema.NullOr(Schema.Array(Schema.Struct({
        type: Schema.Literals([
            "ad_nrt",
            "ae_trn",
            "al_tin",
            "am_tin",
            "ao_tin",
            "ar_cuit",
            "au_abn",
            "au_arn",
            "aw_tin",
            "az_tin",
            "ba_tin",
            "bb_tin",
            "bd_bin",
            "bf_ifu",
            "bg_uic",
            "bh_vat",
            "bj_ifu",
            "bo_tin",
            "br_cnpj",
            "br_cpf",
            "bs_tin",
            "by_tin",
            "ca_bn",
            "ca_gst_hst",
            "ca_pst_bc",
            "ca_pst_mb",
            "ca_pst_sk",
            "ca_qst",
            "cd_nif",
            "ch_uid",
            "ch_vat",
            "cl_tin",
            "cm_niu",
            "cn_tin",
            "co_nit",
            "cr_tin",
            "cv_nif",
            "de_stn",
            "do_rcn",
            "ec_ruc",
            "eg_tin",
            "es_cif",
            "et_tin",
            "eu_oss_vat",
            "eu_vat",
            "gb_vat",
            "ge_vat",
            "gn_nif",
            "hk_br",
            "hr_oib",
            "hu_tin",
            "id_npwp",
            "il_vat",
            "in_gst",
            "is_vat",
            "jp_cn",
            "jp_rn",
            "jp_trn",
            "ke_pin",
            "kg_tin",
            "kh_tin",
            "kr_brn",
            "kz_bin",
            "la_tin",
            "li_uid",
            "li_vat",
            "lk_vat",
            "ma_vat",
            "md_vat",
            "me_pib",
            "mk_vat",
            "mr_nif",
            "mx_rfc",
            "my_frp",
            "my_itn",
            "my_sst",
            "ng_tin",
            "no_vat",
            "no_voec",
            "np_pan",
            "nz_gst",
            "om_vat",
            "pe_ruc",
            "ph_tin",
            "pl_nip",
            "ro_tin",
            "rs_pib",
            "ru_inn",
            "ru_kpp",
            "sa_vat",
            "sg_gst",
            "sg_uen",
            "si_tin",
            "sn_ninea",
            "sr_fin",
            "sv_nit",
            "th_vat",
            "tj_tin",
            "tr_tin",
            "tw_vat",
            "tz_vat",
            "ua_vat",
            "ug_tin",
            "unknown",
            "us_ein",
            "uy_ruc",
            "uz_tin",
            "uz_vat",
            "ve_rif",
            "vn_tin",
            "za_vat",
            "zm_tin",
            "zw_tin",
        ]),
        value: Schema.NullOr(Schema.String),
    })))),
    default_payment_method: Schema.Unknown,
    default_source: Schema.Unknown,
    default_tax_rates: Schema.Array(Schema.Struct({
        active: Schema.Boolean,
        country: Schema.NullOr(Schema.String),
        created: Schema.Number,
        description: Schema.NullOr(Schema.String),
        display_name: Schema.String,
        effective_percentage: Schema.NullOr(Schema.Number),
        flat_amount: Schema.Unknown,
        id: Schema.String,
        inclusive: Schema.Boolean,
        jurisdiction: Schema.NullOr(Schema.String),
        jurisdiction_level: Schema.NullOr(Schema.Literals([
            "city",
            "country",
            "county",
            "district",
            "multiple",
            "state",
        ])),
        livemode: Schema.Boolean,
        metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.String)),
        object: Schema.Literals(["tax_rate"]),
        percentage: Schema.Number,
        rate_type: Schema.NullOr(Schema.Literals(["flat_amount", "percentage"])),
        state: Schema.NullOr(Schema.String),
        tax_type: Schema.NullOr(Schema.Literals([
            "amusement_tax",
            "communications_tax",
            "gst",
            "hst",
            "igst",
            "jct",
            "lease_tax",
            "pst",
            "qst",
            "retail_delivery_fee",
            "rst",
            "sales_tax",
            "service_tax",
            "vat",
        ])),
    })),
    description: Schema.NullOr(Schema.String),
    discounts: Schema.Array(Schema.Unknown),
    due_date: Schema.NullOr(Schema.Number),
    effective_at: Schema.NullOr(Schema.Number),
    ending_balance: Schema.NullOr(Schema.Number),
    footer: Schema.NullOr(Schema.String),
    from_invoice: Schema.Unknown,
    hosted_invoice_url: Schema.optional(Schema.NullOr(Schema.String)),
    id: Schema.optional(Schema.String),
    invoice_pdf: Schema.optional(Schema.NullOr(Schema.String)),
    issuer: Schema.Struct({
        account: Schema.optional(Schema.Unknown),
        type: Schema.Literals(["account", "self"]),
    }),
    last_finalization_error: Schema.Unknown,
    latest_revision: Schema.Unknown,
    lines: Schema.Struct({
        data: Schema.Array(Schema.Struct({
            amount: Schema.Number,
            currency: Schema.String,
            description: Schema.NullOr(Schema.String),
            discount_amounts: Schema.NullOr(Schema.Array(Schema.Struct({
                amount: Schema.Number,
                discount: Schema.Unknown,
            }))),
            discountable: Schema.Boolean,
            discounts: Schema.Array(Schema.Unknown),
            id: Schema.String,
            invoice: Schema.NullOr(Schema.String),
            livemode: Schema.Boolean,
            metadata: Schema.Record(Schema.String, Schema.String),
            object: Schema.Literals(["line_item"]),
            parent: Schema.Unknown,
            period: Schema.Struct({
                end: Schema.Number,
                start: Schema.Number,
            }),
            pretax_credit_amounts: Schema.NullOr(Schema.Array(Schema.Struct({
                amount: Schema.Number,
                credit_balance_transaction: Schema.optional(Schema.Unknown),
                discount: Schema.optional(Schema.Unknown),
                type: Schema.Literals([
                    "credit_balance_transaction",
                    "discount",
                ]),
            }))),
            pricing: Schema.Unknown,
            quantity: Schema.NullOr(Schema.Number),
            quantity_decimal: Schema.NullOr(Schema.String),
            subscription: Schema.Unknown,
            subtotal: Schema.Number,
            taxes: Schema.NullOr(Schema.Array(Schema.Struct({
                amount: Schema.Number,
                tax_behavior: Schema.Literals(["exclusive", "inclusive"]),
                tax_rate_details: Schema.Unknown,
                taxability_reason: Schema.Literals([
                    "customer_exempt",
                    "not_available",
                    "not_collecting",
                    "not_subject_to_tax",
                    "not_supported",
                    "portion_product_exempt",
                    "portion_reduced_rated",
                    "portion_standard_rated",
                    "product_exempt",
                    "product_exempt_holiday",
                    "proportionally_rated",
                    "reduced_rated",
                    "reverse_charge",
                    "standard_rated",
                    "taxable_basis_reduced",
                    "zero_rated",
                ]),
                taxable_amount: Schema.NullOr(Schema.Number),
                type: Schema.Literals(["tax_rate_details"]),
            }))),
        })),
        has_more: Schema.Boolean,
        object: Schema.Literals(["list"]),
        url: Schema.String,
    }),
    livemode: Schema.Boolean,
    metadata: Schema.NullOr(Schema.Record(Schema.String, Schema.String)),
    next_payment_attempt: Schema.NullOr(Schema.Number),
    number: Schema.NullOr(Schema.String),
    object: Schema.Literals(["invoice"]),
    on_behalf_of: Schema.Unknown,
    parent: Schema.Unknown,
    payment_settings: Schema.Struct({
        default_mandate: Schema.NullOr(Schema.String),
        payment_method_options: Schema.Unknown,
        payment_method_types: Schema.NullOr(Schema.Array(Schema.Literals([
            "ach_credit_transfer",
            "ach_debit",
            "acss_debit",
            "affirm",
            "amazon_pay",
            "au_becs_debit",
            "bacs_debit",
            "bancontact",
            "boleto",
            "card",
            "cashapp",
            "crypto",
            "custom",
            "customer_balance",
            "eps",
            "fpx",
            "giropay",
            "grabpay",
            "ideal",
            "jp_credit_transfer",
            "kakao_pay",
            "klarna",
            "konbini",
            "kr_card",
            "link",
            "multibanco",
            "naver_pay",
            "nz_bank_account",
            "p24",
            "pay_by_bank",
            "payco",
            "paynow",
            "paypal",
            "payto",
            "promptpay",
            "revolut_pay",
            "sepa_credit_transfer",
            "sepa_debit",
            "sofort",
            "swish",
            "us_bank_account",
            "wechat_pay",
        ]))),
    }),
    payments: Schema.optional(Schema.Struct({
        data: Schema.Array(Schema.Struct({
            amount_paid: Schema.NullOr(Schema.Number),
            amount_requested: Schema.Number,
            created: Schema.Number,
            currency: Schema.String,
            id: Schema.String,
            invoice: Schema.Unknown,
            is_default: Schema.Boolean,
            livemode: Schema.Boolean,
            object: Schema.Literals(["invoice_payment"]),
            payment: Schema.Struct({
                charge: Schema.optional(Schema.Unknown),
                payment_intent: Schema.optional(Schema.Unknown),
                payment_record: Schema.optional(Schema.Unknown),
                type: Schema.Literals([
                    "charge",
                    "payment_intent",
                    "payment_record",
                ]),
            }),
            status: Schema.String,
            status_transitions: Schema.Struct({
                canceled_at: Schema.NullOr(Schema.Number),
                paid_at: Schema.NullOr(Schema.Number),
            }),
        })),
        has_more: Schema.Boolean,
        object: Schema.Literals(["list"]),
        url: Schema.String,
    })),
    period_end: Schema.Number,
    period_start: Schema.Number,
    post_payment_credit_notes_amount: Schema.Number,
    pre_payment_credit_notes_amount: Schema.Number,
    receipt_number: Schema.NullOr(Schema.String),
    rendering: Schema.Unknown,
    shipping_cost: Schema.Unknown,
    shipping_details: Schema.Unknown,
    starting_balance: Schema.Number,
    statement_descriptor: Schema.NullOr(Schema.String),
    status: Schema.NullOr(Schema.Literals(["draft", "open", "paid", "uncollectible", "void"])),
    status_transitions: Schema.Struct({
        finalized_at: Schema.NullOr(Schema.Number),
        marked_uncollectible_at: Schema.NullOr(Schema.Number),
        paid_at: Schema.NullOr(Schema.Number),
        voided_at: Schema.NullOr(Schema.Number),
    }),
    subscription: Schema.optional(Schema.Unknown),
    subtotal: Schema.Number,
    subtotal_excluding_tax: Schema.NullOr(Schema.Number),
    test_clock: Schema.Unknown,
    threshold_reason: Schema.optional(Schema.Struct({
        amount_gte: Schema.NullOr(Schema.Number),
        item_reasons: Schema.Array(Schema.Struct({
            line_item_ids: Schema.Array(Schema.String),
            usage_gte: Schema.Number,
        })),
    })),
    total: Schema.Number,
    total_discount_amounts: Schema.NullOr(Schema.Array(Schema.Struct({
        amount: Schema.Number,
        discount: Schema.Unknown,
    }))),
    total_excluding_tax: Schema.NullOr(Schema.Number),
    total_pretax_credit_amounts: Schema.NullOr(Schema.Array(Schema.Struct({
        amount: Schema.Number,
        credit_balance_transaction: Schema.optional(Schema.Unknown),
        discount: Schema.optional(Schema.Unknown),
        type: Schema.Literals(["credit_balance_transaction", "discount"]),
    }))),
    total_taxes: Schema.NullOr(Schema.Array(Schema.Struct({
        amount: Schema.Number,
        tax_behavior: Schema.Literals(["exclusive", "inclusive"]),
        tax_rate_details: Schema.Unknown,
        taxability_reason: Schema.Literals([
            "customer_exempt",
            "not_available",
            "not_collecting",
            "not_subject_to_tax",
            "not_supported",
            "portion_product_exempt",
            "portion_reduced_rated",
            "portion_standard_rated",
            "product_exempt",
            "product_exempt_holiday",
            "proportionally_rated",
            "reduced_rated",
            "reverse_charge",
            "standard_rated",
            "taxable_basis_reduced",
            "zero_rated",
        ]),
        taxable_amount: Schema.NullOr(Schema.Number),
        type: Schema.Literals(["tax_rate_details"]),
    }))),
    webhooks_delivered_at: Schema.NullOr(Schema.Number),
});
// The operation
/**
 * Attach a payment to an Invoice
 *
 * <p>Attaches a PaymentIntent or an Out of Band Payment to the invoice, adding it to the list of <code>payments</code>.</p>
 * <p>For the PaymentIntent, when the PaymentIntent’s status changes to <code>succeeded</code>, the payment is credited
 * to the invoice, increasing its <code>amount_paid</code>. When the invoice is fully paid, the
 * invoice’s status becomes <code>paid</code>.</p>
 * <p>If the PaymentIntent’s status is already <code>succeeded</code> when it’s attached, it’s
 * credited to the invoice immediately.</p>
 * <p>See: <a href="/docs/invoicing/partial-payments">Partial payments</a> to learn more.</p>
 */
export const PostInvoicesInvoiceAttachPayment = 
/*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    inputSchema: PostInvoicesInvoiceAttachPaymentInput,
    outputSchema: PostInvoicesInvoiceAttachPaymentOutput,
}));
//# sourceMappingURL=PostInvoicesInvoiceAttachPayment.js.map