import * as HttpClient from "effect/unstable/http/HttpClient";
import * as redacted from "effect/Redacted";
import * as S from "effect/Schema";
import * as stream from "effect/Stream";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import * as C from "../category.js";
import { SensitiveString } from "../sensitive.js";
const svc = T.AwsApiService({
    sdkId: "Invoicing",
    serviceShapeName: "Invoicing",
});
const auth = T.AwsAuthSigv4({ name: "invoicing" });
const ver = T.ServiceVersion("2024-12-01");
const proto = T.AwsProtocolsAwsJson1_0();
const rules = T.EndpointResolver((p, _) => {
    const { UseFIPS = false, Endpoint, Region } = p;
    const e = (u, p = {}, h = {}) => ({
        type: "endpoint",
        endpoint: { url: u, properties: p, headers: h },
    });
    const err = (m) => ({
        type: "error",
        message: m,
    });
    const _p0 = (_0) => ({
        authSchemes: [
            {
                name: "sigv4",
                signingRegion: `${_.getAttr(_0, "implicitGlobalRegion")}`,
            },
        ],
    });
    if (Endpoint != null) {
        if (UseFIPS === true) {
            return err("Invalid Configuration: FIPS and custom endpoint are not supported");
        }
        return e(Endpoint);
    }
    if (Region != null) {
        {
            const PartitionResult = _.partition(Region);
            if (PartitionResult != null && PartitionResult !== false) {
                if (UseFIPS === true) {
                    return e(`https://invoicing-fips.${_.getAttr(PartitionResult, "implicitGlobalRegion")}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`, _p0(PartitionResult), {});
                }
                return e(`https://invoicing.${_.getAttr(PartitionResult, "implicitGlobalRegion")}.${_.getAttr(PartitionResult, "dualStackDnsSuffix")}`, _p0(PartitionResult), {});
            }
        }
    }
    return err("Invalid Configuration: Missing Region");
});
export const AccountIdList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const BatchGetInvoiceProfileRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ AccountIds: AccountIdList }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "BatchGetInvoiceProfileRequest",
});
export const ReceiverAddress = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AddressLine1: S.optional(S.String),
    AddressLine2: S.optional(S.String),
    AddressLine3: S.optional(S.String),
    DistrictOrCounty: S.optional(S.String),
    City: S.optional(S.String),
    StateOrRegion: S.optional(S.String),
    CountryCode: S.optional(S.String),
    CompanyName: S.optional(S.String),
    PostalCode: S.optional(S.String),
})).annotate({
    identifier: "ReceiverAddress",
});
export const InvoiceProfile = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AccountId: S.optional(S.String),
    ReceiverName: S.optional(S.String),
    ReceiverAddress: S.optional(ReceiverAddress),
    ReceiverEmail: S.optional(SensitiveString),
    Issuer: S.optional(S.String),
    TaxRegistrationNumber: S.optional(SensitiveString),
})).annotate({ identifier: "InvoiceProfile" });
export const ProfileList = /*@__PURE__*/ /*#__PURE__*/ S.Array(InvoiceProfile);
export const BatchGetInvoiceProfileResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Profiles: S.optional(ProfileList) })).annotate({
    identifier: "BatchGetInvoiceProfileResponse",
});
export const ValidationExceptionReason = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const ValidationExceptionField = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ name: S.String, message: S.String })).annotate({
    identifier: "ValidationExceptionField",
});
export const ValidationExceptionFieldList = /*@__PURE__*/ /*#__PURE__*/ S.Array(ValidationExceptionField);
export const RuleAccountIdList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const InvoiceUnitRule = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    LinkedAccounts: S.optional(RuleAccountIdList),
    BillSourceAccounts: S.optional(RuleAccountIdList),
})).annotate({
    identifier: "InvoiceUnitRule",
});
export const ResourceTag = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Key: S.String, Value: S.String })).annotate({ identifier: "ResourceTag" });
export const ResourceTagList = /*@__PURE__*/ /*#__PURE__*/ S.Array(ResourceTag);
export const CreateInvoiceUnitRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Name: S.String,
    InvoiceReceiver: S.String,
    Description: S.optional(S.String),
    TaxInheritanceDisabled: S.optional(S.Boolean),
    Rule: InvoiceUnitRule,
    ResourceTags: S.optional(ResourceTagList),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "CreateInvoiceUnitRequest",
});
export const CreateInvoiceUnitResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoiceUnitArn: S.optional(S.String) })).annotate({
    identifier: "CreateInvoiceUnitResponse",
});
export const ProcurementPortalName = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const BuyerDomain = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const SupplierDomain = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const InvoiceUnitArns = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const SellerOfRecords = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const ProcurementPortalPreferenceSelector = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnitArns: S.optional(InvoiceUnitArns),
    SellerOfRecords: S.optional(SellerOfRecords),
})).annotate({
    identifier: "ProcurementPortalPreferenceSelector",
});
export const TestEnvPreferenceInput = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    BuyerDomain: BuyerDomain,
    BuyerIdentifier: S.String,
    SupplierDomain: SupplierDomain,
    SupplierIdentifier: S.String,
    ProcurementPortalSharedSecret: S.optional(S.String),
    ProcurementPortalInstanceEndpoint: S.optional(S.String),
})).annotate({
    identifier: "TestEnvPreferenceInput",
});
export const EinvoiceDeliveryDocumentType = 
/*@__PURE__*/ /*#__PURE__*/ S.String;
export const EinvoiceDeliveryDocumentTypes = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(EinvoiceDeliveryDocumentType);
export const EinvoiceDeliveryAttachmentType = 
/*@__PURE__*/ /*#__PURE__*/ S.String;
export const EinvoiceDeliveryAttachmentTypes = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(EinvoiceDeliveryAttachmentType);
export const Protocol = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const PurchaseOrderDataSourceType = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const PurchaseOrderDataSource = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    EinvoiceDeliveryDocumentType: S.optional(EinvoiceDeliveryDocumentType),
    PurchaseOrderDataSourceType: S.optional(PurchaseOrderDataSourceType),
})).annotate({
    identifier: "PurchaseOrderDataSource",
});
export const PurchaseOrderDataSources = /*@__PURE__*/ /*#__PURE__*/ S.Array(PurchaseOrderDataSource);
export const ConnectionTestingMethod = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const EinvoiceDeliveryPreference = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    EinvoiceDeliveryDocumentTypes: EinvoiceDeliveryDocumentTypes,
    EinvoiceDeliveryAttachmentTypes: S.optional(EinvoiceDeliveryAttachmentTypes),
    Protocol: Protocol,
    PurchaseOrderDataSources: PurchaseOrderDataSources,
    ConnectionTestingMethod: ConnectionTestingMethod,
    EinvoiceDeliveryActivationDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
})).annotate({
    identifier: "EinvoiceDeliveryPreference",
});
export const Contact = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Name: S.optional(S.String), Email: S.optional(S.String) })).annotate({ identifier: "Contact" });
export const Contacts = /*@__PURE__*/ /*#__PURE__*/ S.Array(Contact);
export const CreateProcurementPortalPreferenceRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ProcurementPortalName: ProcurementPortalName,
    BuyerDomain: BuyerDomain,
    BuyerIdentifier: S.String,
    SupplierDomain: SupplierDomain,
    SupplierIdentifier: S.String,
    Selector: S.optional(ProcurementPortalPreferenceSelector),
    ProcurementPortalSharedSecret: S.optional(SensitiveString),
    ProcurementPortalInstanceEndpoint: S.optional(S.String),
    TestEnvPreference: S.optional(TestEnvPreferenceInput),
    EinvoiceDeliveryEnabled: S.Boolean,
    EinvoiceDeliveryPreference: S.optional(EinvoiceDeliveryPreference),
    PurchaseOrderRetrievalEnabled: S.Boolean,
    Contacts: Contacts,
    ResourceTags: S.optional(ResourceTagList),
    ClientToken: S.optional(S.String).pipe(T.IdempotencyToken()),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "CreateProcurementPortalPreferenceRequest",
});
export const CreateProcurementPortalPreferenceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String })).annotate({
    identifier: "CreateProcurementPortalPreferenceResponse",
});
export const DeleteInvoiceUnitRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoiceUnitArn: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "DeleteInvoiceUnitRequest",
});
export const DeleteInvoiceUnitResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoiceUnitArn: S.optional(S.String) })).annotate({
    identifier: "DeleteInvoiceUnitResponse",
});
export const DeleteProcurementPortalPreferenceRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "DeleteProcurementPortalPreferenceRequest",
});
export const DeleteProcurementPortalPreferenceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String })).annotate({
    identifier: "DeleteProcurementPortalPreferenceResponse",
});
export const GetInvoicePDFRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoiceId: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetInvoicePDFRequest",
});
export const SupplementalDocument = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    DocumentUrl: S.optional(S.String),
    DocumentUrlExpirationDate: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
})).annotate({
    identifier: "SupplementalDocument",
});
export const SupplementalDocuments = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(SupplementalDocument);
export const InvoicePDF = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceId: S.optional(S.String),
    DocumentUrl: S.optional(S.String),
    DocumentUrlExpirationDate: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    SupplementalDocuments: S.optional(SupplementalDocuments),
})).annotate({ identifier: "InvoicePDF" });
export const GetInvoicePDFResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoicePDF: S.optional(InvoicePDF) })).annotate({
    identifier: "GetInvoicePDFResponse",
});
export const GetInvoiceUnitRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnitArn: S.String,
    AsOf: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetInvoiceUnitRequest",
});
export const GetInvoiceUnitResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnitArn: S.optional(S.String),
    InvoiceReceiver: S.optional(S.String),
    Name: S.optional(S.String),
    Description: S.optional(S.String),
    TaxInheritanceDisabled: S.optional(S.Boolean),
    Rule: S.optional(InvoiceUnitRule),
    LastModified: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
})).annotate({
    identifier: "GetInvoiceUnitResponse",
});
export const GetProcurementPortalPreferenceRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "GetProcurementPortalPreferenceRequest",
});
export const TestEnvPreference = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    BuyerDomain: BuyerDomain,
    BuyerIdentifier: S.String,
    SupplierDomain: SupplierDomain,
    SupplierIdentifier: S.String,
    ProcurementPortalSharedSecret: S.optional(S.String),
    ProcurementPortalInstanceEndpoint: S.optional(S.String),
    PurchaseOrderRetrievalEndpoint: S.optional(S.String),
})).annotate({
    identifier: "TestEnvPreference",
});
export const ProcurementPortalPreferenceStatus = 
/*@__PURE__*/ /*#__PURE__*/ S.String;
export const ProcurementPortalPreference = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AwsAccountId: S.String,
    ProcurementPortalPreferenceArn: S.String,
    ProcurementPortalName: ProcurementPortalName,
    BuyerDomain: BuyerDomain,
    BuyerIdentifier: S.String,
    SupplierDomain: SupplierDomain,
    SupplierIdentifier: S.String,
    Selector: S.optional(ProcurementPortalPreferenceSelector),
    ProcurementPortalSharedSecret: S.optional(S.String),
    ProcurementPortalInstanceEndpoint: S.optional(S.String),
    PurchaseOrderRetrievalEndpoint: S.optional(S.String),
    TestEnvPreference: S.optional(TestEnvPreference),
    EinvoiceDeliveryEnabled: S.Boolean,
    EinvoiceDeliveryPreference: S.optional(EinvoiceDeliveryPreference),
    PurchaseOrderRetrievalEnabled: S.Boolean,
    Contacts: S.optional(Contacts),
    EinvoiceDeliveryPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    EinvoiceDeliveryPreferenceStatusReason: S.optional(S.String),
    PurchaseOrderRetrievalPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    PurchaseOrderRetrievalPreferenceStatusReason: S.optional(S.String),
    Version: S.Number,
    CreateDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    LastUpdateDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
})).annotate({
    identifier: "ProcurementPortalPreference",
});
export const GetProcurementPortalPreferenceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreference: ProcurementPortalPreference })).annotate({
    identifier: "GetProcurementPortalPreferenceResponse",
});
export const ListInvoiceSummariesResourceType = 
/*@__PURE__*/ /*#__PURE__*/ S.String;
export const InvoiceSummariesSelector = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ResourceType: ListInvoiceSummariesResourceType,
    Value: S.String,
})).annotate({
    identifier: "InvoiceSummariesSelector",
});
export const DateInterval = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    StartDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    EndDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
})).annotate({ identifier: "DateInterval" });
export const BillingPeriod = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ Month: S.Number, Year: S.Number })).annotate({ identifier: "BillingPeriod" });
export const InvoiceSummariesFilter = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    TimeInterval: S.optional(DateInterval),
    BillingPeriod: S.optional(BillingPeriod),
    InvoicingEntity: S.optional(S.String),
})).annotate({
    identifier: "InvoiceSummariesFilter",
});
export const ListInvoiceSummariesRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Selector: InvoiceSummariesSelector,
    Filter: S.optional(InvoiceSummariesFilter),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListInvoiceSummariesRequest",
});
export const Entity = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoicingEntity: S.optional(S.String) })).annotate({ identifier: "Entity" });
export const InvoiceType = /*@__PURE__*/ /*#__PURE__*/ S.String;
export const DiscountsBreakdownAmount = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Description: S.optional(S.String),
    Amount: S.optional(S.String),
    Rate: S.optional(S.String),
})).annotate({
    identifier: "DiscountsBreakdownAmount",
});
export const DiscountsBreakdownAmountList = /*@__PURE__*/ /*#__PURE__*/ S.Array(DiscountsBreakdownAmount);
export const DiscountsBreakdown = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Breakdown: S.optional(DiscountsBreakdownAmountList),
    TotalAmount: S.optional(S.String),
})).annotate({
    identifier: "DiscountsBreakdown",
});
export const TaxesBreakdownAmount = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Description: S.optional(S.String),
    Amount: S.optional(S.String),
    Rate: S.optional(S.String),
})).annotate({
    identifier: "TaxesBreakdownAmount",
});
export const TaxesBreakdownAmountList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(TaxesBreakdownAmount);
export const TaxesBreakdown = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Breakdown: S.optional(TaxesBreakdownAmountList),
    TotalAmount: S.optional(S.String),
})).annotate({ identifier: "TaxesBreakdown" });
export const FeesBreakdownAmount = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Description: S.optional(S.String),
    Amount: S.optional(S.String),
    Rate: S.optional(S.String),
})).annotate({
    identifier: "FeesBreakdownAmount",
});
export const FeesBreakdownAmountList = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(FeesBreakdownAmount);
export const FeesBreakdown = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Breakdown: S.optional(FeesBreakdownAmountList),
    TotalAmount: S.optional(S.String),
})).annotate({ identifier: "FeesBreakdown" });
export const AmountBreakdown = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    SubTotalAmount: S.optional(S.String),
    Discounts: S.optional(DiscountsBreakdown),
    Taxes: S.optional(TaxesBreakdown),
    Fees: S.optional(FeesBreakdown),
})).annotate({
    identifier: "AmountBreakdown",
});
export const CurrencyExchangeDetails = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    SourceCurrencyCode: S.optional(S.String),
    TargetCurrencyCode: S.optional(S.String),
    Rate: S.optional(S.String),
})).annotate({
    identifier: "CurrencyExchangeDetails",
});
export const InvoiceCurrencyAmount = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    TotalAmount: S.optional(S.String),
    TotalAmountBeforeTax: S.optional(S.String),
    CurrencyCode: S.optional(S.String),
    AmountBreakdown: S.optional(AmountBreakdown),
    CurrencyExchangeDetails: S.optional(CurrencyExchangeDetails),
})).annotate({
    identifier: "InvoiceCurrencyAmount",
});
export const InvoiceSummary = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AccountId: S.optional(S.String),
    InvoiceId: S.optional(S.String),
    IssuedDate: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    DueDate: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
    Entity: S.optional(Entity),
    BillingPeriod: S.optional(BillingPeriod),
    InvoiceType: S.optional(InvoiceType),
    OriginalInvoiceId: S.optional(S.String),
    PurchaseOrderNumber: S.optional(S.String),
    BaseCurrencyAmount: S.optional(InvoiceCurrencyAmount),
    TaxCurrencyAmount: S.optional(InvoiceCurrencyAmount),
    PaymentCurrencyAmount: S.optional(InvoiceCurrencyAmount),
})).annotate({ identifier: "InvoiceSummary" });
export const InvoiceSummaries = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(InvoiceSummary);
export const ListInvoiceSummariesResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceSummaries: InvoiceSummaries,
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "ListInvoiceSummariesResponse",
});
export const InvoiceUnitNames = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const Filters = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Names: S.optional(InvoiceUnitNames),
    InvoiceReceivers: S.optional(AccountIdList),
    Accounts: S.optional(AccountIdList),
    BillSourceAccounts: S.optional(AccountIdList),
})).annotate({ identifier: "Filters" });
export const ListInvoiceUnitsRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    Filters: S.optional(Filters),
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
    AsOf: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListInvoiceUnitsRequest",
});
export const InvoiceUnit = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnitArn: S.optional(S.String),
    InvoiceReceiver: S.optional(S.String),
    Name: S.optional(S.String),
    Description: S.optional(S.String),
    TaxInheritanceDisabled: S.optional(S.Boolean),
    Rule: S.optional(InvoiceUnitRule),
    LastModified: S.optional(S.Date.pipe(T.TimestampFormat("epoch-seconds"))),
})).annotate({ identifier: "InvoiceUnit" });
export const InvoiceUnits = /*@__PURE__*/ /*#__PURE__*/ S.Array(InvoiceUnit);
export const ListInvoiceUnitsResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnits: S.optional(InvoiceUnits),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "ListInvoiceUnitsResponse",
});
export const ListProcurementPortalPreferencesRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    NextToken: S.optional(S.String),
    MaxResults: S.optional(S.Number),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListProcurementPortalPreferencesRequest",
});
export const ProcurementPortalPreferenceSummary = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    AwsAccountId: S.String,
    ProcurementPortalPreferenceArn: S.String,
    ProcurementPortalName: ProcurementPortalName,
    BuyerDomain: BuyerDomain,
    BuyerIdentifier: S.String,
    SupplierDomain: SupplierDomain,
    SupplierIdentifier: S.String,
    Selector: S.optional(ProcurementPortalPreferenceSelector),
    EinvoiceDeliveryEnabled: S.Boolean,
    PurchaseOrderRetrievalEnabled: S.Boolean,
    EinvoiceDeliveryPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    EinvoiceDeliveryPreferenceStatusReason: S.optional(S.String),
    PurchaseOrderRetrievalPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    PurchaseOrderRetrievalPreferenceStatusReason: S.optional(S.String),
    Version: S.Number,
    CreateDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
    LastUpdateDate: S.Date.pipe(T.TimestampFormat("epoch-seconds")),
})).annotate({
    identifier: "ProcurementPortalPreferenceSummary",
});
export const ProcurementPortalPreferenceSummaries = 
/*@__PURE__*/ /*#__PURE__*/ S.Array(ProcurementPortalPreferenceSummary);
export const ListProcurementPortalPreferencesResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ProcurementPortalPreferences: S.optional(ProcurementPortalPreferenceSummaries),
    NextToken: S.optional(S.String),
})).annotate({
    identifier: "ListProcurementPortalPreferencesResponse",
});
export const ListTagsForResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ResourceArn: S.String }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "ListTagsForResourceRequest",
});
export const ListTagsForResourceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ResourceTags: S.optional(ResourceTagList) })).annotate({
    identifier: "ListTagsForResourceResponse",
});
export const PutProcurementPortalPreferenceRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ProcurementPortalPreferenceArn: S.String,
    Selector: S.optional(ProcurementPortalPreferenceSelector),
    ProcurementPortalSharedSecret: S.optional(SensitiveString),
    ProcurementPortalInstanceEndpoint: S.optional(S.String),
    TestEnvPreference: S.optional(TestEnvPreferenceInput),
    EinvoiceDeliveryEnabled: S.Boolean,
    EinvoiceDeliveryPreference: S.optional(EinvoiceDeliveryPreference),
    PurchaseOrderRetrievalEnabled: S.Boolean,
    Contacts: Contacts,
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "PutProcurementPortalPreferenceRequest",
});
export const PutProcurementPortalPreferenceResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String })).annotate({
    identifier: "PutProcurementPortalPreferenceResponse",
});
export const TagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ResourceArn: S.String, ResourceTags: ResourceTagList }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "TagResourceRequest",
});
export const TagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "TagResourceResponse",
});
export const ResourceTagKeyList = /*@__PURE__*/ /*#__PURE__*/ S.Array(S.String);
export const UntagResourceRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ResourceArn: S.String, ResourceTagKeys: ResourceTagKeyList }).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UntagResourceRequest",
});
export const UntagResourceResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({})).annotate({
    identifier: "UntagResourceResponse",
});
export const UpdateInvoiceUnitRequest = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    InvoiceUnitArn: S.String,
    Description: S.optional(S.String),
    TaxInheritanceDisabled: S.optional(S.Boolean),
    Rule: S.optional(InvoiceUnitRule),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UpdateInvoiceUnitRequest",
});
export const UpdateInvoiceUnitResponse = /*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ InvoiceUnitArn: S.optional(S.String) })).annotate({
    identifier: "UpdateInvoiceUnitResponse",
});
export const UpdateProcurementPortalPreferenceStatusRequest = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({
    ProcurementPortalPreferenceArn: S.String,
    EinvoiceDeliveryPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    EinvoiceDeliveryPreferenceStatusReason: S.optional(S.String),
    PurchaseOrderRetrievalPreferenceStatus: S.optional(ProcurementPortalPreferenceStatus),
    PurchaseOrderRetrievalPreferenceStatusReason: S.optional(S.String),
}).pipe(T.all(T.Http({ method: "POST", uri: "/" }), svc, auth, proto, ver, rules))).annotate({
    identifier: "UpdateProcurementPortalPreferenceStatusRequest",
});
export const UpdateProcurementPortalPreferenceStatusResponse = 
/*@__PURE__*/ /*#__PURE__*/ S.suspend(() => S.Struct({ ProcurementPortalPreferenceArn: S.String })).annotate({
    identifier: "UpdateProcurementPortalPreferenceStatusResponse",
});
//# Errors
export class AccessDeniedException extends S.TaggedErrorClass()("AccessDeniedException", { message: S.optional(S.String), resourceName: S.optional(S.String) }, T.AwsQueryError({ code: "InvoicingAccessDenied", httpResponseCode: 403 })).pipe(C.withAuthError) {
}
export class InternalServerException extends S.TaggedErrorClass()("InternalServerException", {
    retryAfterSeconds: S.optional(S.Number).pipe(T.HttpHeader("Retry-After")),
    message: S.optional(S.String),
}, T.AwsQueryError({ code: "InvoicingInternalServer", httpResponseCode: 500 })).pipe(C.withServerError) {
}
export class ResourceNotFoundException extends S.TaggedErrorClass()("ResourceNotFoundException", { message: S.optional(S.String), resourceName: S.optional(S.String) }, T.AwsQueryError({ code: "InvoicingResourceNotFound", httpResponseCode: 404 })).pipe(C.withBadRequestError) {
}
export class ThrottlingException extends S.TaggedErrorClass()("ThrottlingException", { message: S.optional(S.String) }, T.AwsQueryError({ code: "InvoicingThrottling", httpResponseCode: 429 })).pipe(C.withThrottlingError) {
}
export class ValidationException extends S.TaggedErrorClass()("ValidationException", {
    message: S.optional(S.String),
    resourceName: S.optional(S.String),
    reason: S.optional(ValidationExceptionReason),
    fieldList: S.optional(ValidationExceptionFieldList),
}, T.AwsQueryError({ code: "InvoicingValidation", httpResponseCode: 400 })).pipe(C.withBadRequestError) {
}
export class ConflictException extends S.TaggedErrorClass()("ConflictException", {
    message: S.optional(S.String),
    resourceId: S.optional(S.String),
    resourceType: S.optional(S.String),
}, T.AwsQueryError({ code: "InvoicingConflict", httpResponseCode: 409 })).pipe(C.withConflictError) {
}
export class ServiceQuotaExceededException extends S.TaggedErrorClass()("ServiceQuotaExceededException", { message: S.String }, T.AwsQueryError({
    code: "InvoicingServiceQuotaExceeded",
    httpResponseCode: 402,
})).pipe(C.withQuotaError) {
}
/**
 * This gets the invoice profile associated with a set of accounts. The accounts must be linked accounts under the requester management account organization.
 */
export const batchGetInvoiceProfile = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: BatchGetInvoiceProfileRequest,
    output: BatchGetInvoiceProfileResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * This creates a new invoice unit with the provided definition.
 */
export const createInvoiceUnit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateInvoiceUnitRequest,
    output: CreateInvoiceUnitResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Creates a procurement portal preference configuration for e-invoice delivery and purchase order retrieval. This preference defines how invoices are delivered to a procurement portal and how purchase orders are retrieved.
 */
export const createProcurementPortalPreference = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateProcurementPortalPreferenceRequest,
    output: CreateProcurementPortalPreferenceResponse,
    errors: [
        AccessDeniedException,
        ConflictException,
        InternalServerException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * This deletes an invoice unit with the provided invoice unit ARN.
 */
export const deleteInvoiceUnit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteInvoiceUnitRequest,
    output: DeleteInvoiceUnitResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Deletes an existing procurement portal preference. This action cannot be undone. Active e-invoice delivery and PO retrieval configurations will be terminated.
 */
export const deleteProcurementPortalPreference = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteProcurementPortalPreferenceRequest,
    output: DeleteProcurementPortalPreferenceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Returns a URL to download the invoice document and supplemental documents associated with an invoice. The URLs are pre-signed and have expiration time. For special cases like Brazil, where Amazon Web Services generated invoice identifiers and government provided identifiers do not match, use the Amazon Web Services generated invoice identifier when making API requests. To grant IAM permission to use this operation, the caller needs the `invoicing:GetInvoicePDF` policy action.
 */
export const getInvoicePDF = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetInvoicePDFRequest,
    output: GetInvoicePDFResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * This retrieves the invoice unit definition.
 */
export const getInvoiceUnit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetInvoiceUnitRequest,
    output: GetInvoiceUnitResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Retrieves the details of a specific procurement portal preference configuration.
 */
export const getProcurementPortalPreference = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetProcurementPortalPreferenceRequest,
    output: GetProcurementPortalPreferenceResponse,
    errors: [
        AccessDeniedException,
        ConflictException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Retrieves your invoice details programmatically, without line item details.
 */
export const listInvoiceSummaries = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListInvoiceSummariesRequest,
    output: ListInvoiceSummariesResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "InvoiceSummaries",
        pageSize: "MaxResults",
    },
}));
/**
 * This fetches a list of all invoice unit definitions for a given account, as of the provided `AsOf` date.
 */
export const listInvoiceUnits = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListInvoiceUnitsRequest,
    output: ListInvoiceUnitsResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ThrottlingException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "InvoiceUnits",
        pageSize: "MaxResults",
    },
}));
/**
 * Retrieves a list of procurement portal preferences associated with the Amazon Web Services account.
 */
export const listProcurementPortalPreferences = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListProcurementPortalPreferencesRequest,
    output: ListProcurementPortalPreferencesResponse,
    errors: [
        AccessDeniedException,
        ConflictException,
        InternalServerException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
    pagination: {
        inputToken: "NextToken",
        outputToken: "NextToken",
        items: "ProcurementPortalPreferences",
        pageSize: "MaxResults",
    },
}));
/**
 * Lists the tags for a resource.
 */
export const listTagsForResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListTagsForResourceRequest,
    output: ListTagsForResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Updates an existing procurement portal preference configuration. This operation can modify settings for e-invoice delivery and purchase order retrieval.
 */
export const putProcurementPortalPreference = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PutProcurementPortalPreferenceRequest,
    output: PutProcurementPortalPreferenceResponse,
    errors: [
        AccessDeniedException,
        ConflictException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Adds a tag to a resource.
 */
export const tagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: TagResourceRequest,
    output: TagResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Removes a tag from a resource.
 */
export const untagResource = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UntagResourceRequest,
    output: UntagResourceResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * You can update the invoice unit configuration at any time, and Amazon Web Services will use the latest configuration at the end of the month.
 */
export const updateInvoiceUnit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateInvoiceUnitRequest,
    output: UpdateInvoiceUnitResponse,
    errors: [
        AccessDeniedException,
        InternalServerException,
        ResourceNotFoundException,
        ThrottlingException,
        ValidationException,
    ],
}));
/**
 * Updates the status of a procurement portal preference, including the activation state of e-invoice delivery and purchase order retrieval features.
 */
export const updateProcurementPortalPreferenceStatus = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateProcurementPortalPreferenceStatusRequest,
    output: UpdateProcurementPortalPreferenceStatusResponse,
    errors: [
        AccessDeniedException,
        ConflictException,
        InternalServerException,
        ResourceNotFoundException,
        ServiceQuotaExceededException,
        ThrottlingException,
        ValidationException,
    ],
}));
//# sourceMappingURL=invoicing.js.map