From 8e09f6da179858ecd4dda1f893917f4da5a3d674 Mon Sep 17 00:00:00 2001 From: Peter Turi Date: Thu, 24 Oct 2024 22:02:10 +0200 Subject: [PATCH] feat(billing): pending line item creation (#1738) --- api/api.gen.go | 2606 ++++--- api/client/go/client.gen.go | 1891 +++-- api/openapi.yaml | 1326 ++-- api/spec/src/app/app.tsp | 10 + api/spec/src/billing/customeroverride.tsp | 12 +- api/spec/src/billing/invoices.tsp | 142 +- api/spec/src/billing/invoices/invoice.tsp | 133 +- api/spec/src/billing/invoices/org.tsp | 4 +- api/spec/src/billing/profile.tsp | 45 +- api/spec/src/cloud/main.tsp | 4 +- cmd/server/main.go | 1 + openmeter/billing/adapter.go | 50 +- openmeter/billing/adapter/customeroverride.go | 24 +- openmeter/billing/adapter/invoice.go | 307 + openmeter/billing/adapter/invoiceitems.go | 94 - openmeter/billing/adapter/invoicelines.go | 123 + openmeter/billing/adapter/profile.go | 59 +- openmeter/billing/customeroverride.go | 35 + openmeter/billing/entity/invoice.go | 62 +- openmeter/billing/entity/invoiceitem.go | 102 - openmeter/billing/entity/invoiceline.go | 170 + openmeter/billing/entity/profile.go | 18 +- openmeter/billing/entity/tax.go | 1 + openmeter/billing/errors.go | 1 + openmeter/billing/gobldriver/errors.go | 28 - openmeter/billing/gobldriver/invoice.go | 328 - openmeter/billing/gobldriver/invoice_test.go | 119 - openmeter/billing/gobldriver/metadata.go | 31 - .../gobldriver/validationcomplement.go | 124 - openmeter/billing/httpdriver/defaults.go | 1 + openmeter/billing/httpdriver/errors.go | 13 +- openmeter/billing/httpdriver/handler.go | 10 + openmeter/billing/httpdriver/invoice.go | 212 + openmeter/billing/httpdriver/invoiceline.go | 223 + openmeter/billing/httpdriver/profile.go | 145 +- openmeter/billing/invoice.go | 133 + openmeter/billing/invoiceitem.go | 28 - openmeter/billing/invoiceline.go | 59 + openmeter/billing/profile.go | 36 +- openmeter/billing/service.go | 13 +- openmeter/billing/service/customeroverride.go | 36 +- openmeter/billing/service/invoice.go | 111 +- openmeter/billing/service/invoiceitem.go | 23 - openmeter/billing/service/invoiceline.go | 138 + openmeter/billing/service/profile.go | 108 +- openmeter/billing/service/service.go | 26 + openmeter/customer/entity/customer.go | 31 + openmeter/ent/db/app.go | 104 +- openmeter/ent/db/app/app.go | 192 +- openmeter/ent/db/app/where.go | 105 +- openmeter/ent/db/app_create.go | 148 +- openmeter/ent/db/app_query.go | 354 +- openmeter/ent/db/app_update.go | 775 +- openmeter/ent/db/billingcustomeroverride.go | 18 +- .../billingcustomeroverride.go | 12 +- .../ent/db/billingcustomeroverride/where.go | 96 +- .../ent/db/billingcustomeroverride_create.go | 72 +- .../ent/db/billingcustomeroverride_update.go | 52 +- openmeter/ent/db/billinginvoice.go | 549 +- .../ent/db/billinginvoice/billinginvoice.go | 418 +- openmeter/ent/db/billinginvoice/where.go | 2438 ++++++- openmeter/ent/db/billinginvoice_create.go | 2746 +++++-- openmeter/ent/db/billinginvoice_query.go | 414 +- openmeter/ent/db/billinginvoice_update.go | 1590 ++++- openmeter/ent/db/billinginvoiceitem/where.go | 907 --- openmeter/ent/db/billinginvoiceitem_create.go | 1344 ---- openmeter/ent/db/billinginvoiceitem_delete.go | 88 - openmeter/ent/db/billinginvoiceitem_query.go | 646 -- openmeter/ent/db/billinginvoiceitem_update.go | 777 -- ...nginvoiceitem.go => billinginvoiceline.go} | 297 +- .../billinginvoiceline.go} | 142 +- openmeter/ent/db/billinginvoiceline/where.go | 925 +++ openmeter/ent/db/billinginvoiceline_create.go | 1422 ++++ openmeter/ent/db/billinginvoiceline_delete.go | 88 + openmeter/ent/db/billinginvoiceline_query.go | 726 ++ openmeter/ent/db/billinginvoiceline_update.go | 918 +++ .../ent/db/billinginvoicemanuallineconfig.go | 115 + .../billinginvoicemanuallineconfig.go | 62 + .../billinginvoicemanuallineconfig/where.go | 194 + .../billinginvoicemanuallineconfig_create.go | 532 ++ .../billinginvoicemanuallineconfig_delete.go | 88 + .../billinginvoicemanuallineconfig_query.go | 564 ++ .../billinginvoicemanuallineconfig_update.go | 210 + .../ent/db/billingprofile/billingprofile.go | 2 +- openmeter/ent/db/billingprofile_query.go | 6 +- openmeter/ent/db/billingworkflowconfig.go | 16 +- .../billingworkflowconfig.go | 12 +- .../ent/db/billingworkflowconfig/where.go | 84 +- .../ent/db/billingworkflowconfig_create.go | 52 +- .../ent/db/billingworkflowconfig_update.go | 32 +- openmeter/ent/db/client.go | 501 +- openmeter/ent/db/customer.go | 18 +- openmeter/ent/db/customer/customer.go | 30 + openmeter/ent/db/customer/where.go | 23 + openmeter/ent/db/customer_create.go | 37 + openmeter/ent/db/customer_query.go | 76 +- openmeter/ent/db/customer_update.go | 173 + openmeter/ent/db/ent.go | 6 +- openmeter/ent/db/expose.go | 4 +- openmeter/ent/db/hook/hook.go | 24 +- openmeter/ent/db/migrate/schema.go | 192 +- openmeter/ent/db/mutation.go | 6291 ++++++++++++----- openmeter/ent/db/paginate.go | 62 +- openmeter/ent/db/predicate/predicate.go | 7 +- openmeter/ent/db/runtime.go | 152 +- openmeter/ent/db/setorclear.go | 374 +- openmeter/ent/db/tx.go | 9 +- openmeter/ent/schema/app.go | 9 +- openmeter/ent/schema/billing.go | 218 +- openmeter/ent/schema/customer.go | 1 + openmeter/server/router/billing.go | 33 +- pkg/currencyx/currency.go | 11 + pkg/timezone/tz.go | 5 + test/billing/invoice_test.go | 286 +- test/billing/profile_test.go | 29 +- test/billing/suite_test.go | 1 + .../20240917172257_billing-entities.down.sql | 2 - ...40926164233_pending-invoice-items.down.sql | 2 - ...0240926164233_pending-invoice-items.up.sql | 3 - .../20241024122007_line-item-fixes.down.sql | 60 + .../20241024122007_line-item-fixes.up.sql | 73 + tools/migrate/migrations/atlas.sum | 56 +- 122 files changed, 26920 insertions(+), 11376 deletions(-) delete mode 100644 openmeter/billing/adapter/invoiceitems.go create mode 100644 openmeter/billing/adapter/invoicelines.go delete mode 100644 openmeter/billing/entity/invoiceitem.go create mode 100644 openmeter/billing/entity/invoiceline.go delete mode 100644 openmeter/billing/gobldriver/errors.go delete mode 100644 openmeter/billing/gobldriver/invoice.go delete mode 100644 openmeter/billing/gobldriver/invoice_test.go delete mode 100644 openmeter/billing/gobldriver/metadata.go delete mode 100644 openmeter/billing/gobldriver/validationcomplement.go create mode 100644 openmeter/billing/httpdriver/invoice.go create mode 100644 openmeter/billing/httpdriver/invoiceline.go create mode 100644 openmeter/billing/invoice.go delete mode 100644 openmeter/billing/invoiceitem.go create mode 100644 openmeter/billing/invoiceline.go delete mode 100644 openmeter/billing/service/invoiceitem.go create mode 100644 openmeter/billing/service/invoiceline.go delete mode 100644 openmeter/ent/db/billinginvoiceitem/where.go delete mode 100644 openmeter/ent/db/billinginvoiceitem_create.go delete mode 100644 openmeter/ent/db/billinginvoiceitem_delete.go delete mode 100644 openmeter/ent/db/billinginvoiceitem_query.go delete mode 100644 openmeter/ent/db/billinginvoiceitem_update.go rename openmeter/ent/db/{billinginvoiceitem.go => billinginvoiceline.go} (50%) rename openmeter/ent/db/{billinginvoiceitem/billinginvoiceitem.go => billinginvoiceline/billinginvoiceline.go} (66%) create mode 100644 openmeter/ent/db/billinginvoiceline/where.go create mode 100644 openmeter/ent/db/billinginvoiceline_create.go create mode 100644 openmeter/ent/db/billinginvoiceline_delete.go create mode 100644 openmeter/ent/db/billinginvoiceline_query.go create mode 100644 openmeter/ent/db/billinginvoiceline_update.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig/billinginvoicemanuallineconfig.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig/where.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig_create.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig_delete.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig_query.go create mode 100644 openmeter/ent/db/billinginvoicemanuallineconfig_update.go create mode 100644 tools/migrate/migrations/20241024122007_line-item-fixes.down.sql create mode 100644 tools/migrate/migrations/20241024122007_line-item-fixes.up.sql diff --git a/api/api.gen.go b/api/api.gen.go index 086288276..028984828 100644 --- a/api/api.gen.go +++ b/api/api.gen.go @@ -62,13 +62,28 @@ const ( BillingDocumentRefTypeCreditNodeOriginalInvoice BillingDocumentRefType = "credit_node_original_invoice" ) +// Defines values for BillingFlatFeeLineType. +const ( + BillingFlatFeeLineTypeFlatFee BillingFlatFeeLineType = "flat_fee" +) + +// Defines values for BillingFlatFeeLineCreateItemType. +const ( + BillingFlatFeeLineCreateItemTypeFlatFee BillingFlatFeeLineCreateItemType = "flat_fee" +) + +// Defines values for BillingFlatFeeLineCreateOrUpdateType. +const ( + BillingFlatFeeLineCreateOrUpdateTypeFlatFee BillingFlatFeeLineCreateOrUpdateType = "flat_fee" +) + // Defines values for BillingInvoiceExpand. const ( - BillingInvoiceExpandAsterisk BillingInvoiceExpand = "*" - BillingInvoiceExpandCustomer BillingInvoiceExpand = "customer" - BillingInvoiceExpandLines BillingInvoiceExpand = "lines" - BillingInvoiceExpandPreceding BillingInvoiceExpand = "preceding" - BillingInvoiceExpandSupplier BillingInvoiceExpand = "supplier" + BillingInvoiceExpandAll BillingInvoiceExpand = "*" + BillingInvoiceExpandLines BillingInvoiceExpand = "lines" + BillingInvoiceExpandPreceding BillingInvoiceExpand = "preceding" + BillingInvoiceExpandWorkflow BillingInvoiceExpand = "workflow" + BillingInvoiceExpandWorkflowApps BillingInvoiceExpand = "workflow.apps" ) // Defines values for BillingInvoiceOrderBy. @@ -92,13 +107,30 @@ const ( // Defines values for BillingInvoiceType. const ( - BillingInvoiceTypeCreditNote BillingInvoiceType = "credit-note" + BillingInvoiceTypeCreditNote BillingInvoiceType = "credit_note" BillingInvoiceTypeStandard BillingInvoiceType = "standard" ) -// Defines values for BillingLineTypes. +// Defines values for BillingLineStatus. const ( - BillingLineTypesUnitPrice BillingLineTypes = "unit_price" + BillingLineStatusDeleted BillingLineStatus = "deleted" + BillingLineStatusSplit BillingLineStatus = "split" + BillingLineStatusValid BillingLineStatus = "valid" +) + +// Defines values for BillingManualFeeLineType. +const ( + BillingManualFeeLineTypeManualFee BillingManualFeeLineType = "manual_fee" +) + +// Defines values for BillingManualFeeLineCreateItemType. +const ( + BillingManualFeeLineCreateItemTypeManualFee BillingManualFeeLineCreateItemType = "manual_fee" +) + +// Defines values for BillingManualFeeLineCreateOrUpdateType. +const ( + BillingManualFeeLineCreateOrUpdateTypeManualFee BillingManualFeeLineCreateOrUpdateType = "manual_fee" ) // Defines values for BillingPaymentTermType. @@ -107,6 +139,12 @@ const ( BillingPaymentTermTypeInstant BillingPaymentTermType = "instant" ) +// Defines values for BillingProfileExpand. +const ( + BillingProfileExpandAll BillingProfileExpand = "*" + BillingProfileExpandApps BillingProfileExpand = "apps" +) + // Defines values for BillingProfileOrderBy. const ( BillingProfileOrderByCreatedAt BillingProfileOrderBy = "createdAt" @@ -121,11 +159,11 @@ const ( BillingTaxBehaviorInclusive BillingTaxBehavior = "inclusive" ) -// Defines values for BillingVoidInvoiceItemAction. +// Defines values for BillingVoidInvoiceLineAction. const ( - BillingVoidInvoiceItemActionDiscard BillingVoidInvoiceItemAction = "discard" - BillingVoidInvoiceItemActionPending BillingVoidInvoiceItemAction = "pending" - BillingVoidInvoiceItemActionPendingNextCycle BillingVoidInvoiceItemAction = "pending_next_cycle" + BillingVoidInvoiceLineActionDiscard BillingVoidInvoiceLineAction = "discard" + BillingVoidInvoiceLineActionPending BillingVoidInvoiceLineAction = "pending" + BillingVoidInvoiceLineActionPendingNextCycle BillingVoidInvoiceLineAction = "pending_next_cycle" ) // Defines values for BillingWorkflowCollectionAlignment. @@ -513,6 +551,14 @@ type AppList struct { TotalCount int `json:"totalCount"` } +// AppReference App reference +// +// Can be used as a short reference to an app if the full app object is not needed. +type AppReference struct { + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` +} + // AppStatus App installed status. type AppStatus string @@ -535,10 +581,14 @@ type BalanceHistoryWindow struct { Usage float64 `json:"usage"` } -// BillingCreatePendingItemResponse Response for creating a pending charge -type BillingCreatePendingItemResponse struct { - Invoice BillingInvoiceSummary `json:"invoice"` - Item BillingInvoiceLine `json:"item"` +// BillingCreateLineResult Response for creating a pending charge +type BillingCreateLineResult struct { + Lines []BillingInvoiceLine `json:"lines"` +} + +// BillingCreateLinesRequest CreateLinesRequest is the request for creating manual line items. +type BillingCreateLinesRequest struct { + Lines []BillingInvoiceLineCreateItem `json:"lines"` } // BillingCreditNoteOriginalInvoiceRef Omitted fields: @@ -614,76 +664,130 @@ type BillingDueDate struct { Percent *Percentage `json:"percent,omitempty"` } -// BillingGenericDocumentRef Omitted fields: -// period: Tax period in which the referred document had an effect required by some tax regimes and formats. -// stamps: Seals of approval from other organisations that may need to be listed. -// ext: Extensions for additional codes that may be required. -type BillingGenericDocumentRef struct { +// BillingFlatFeeLine BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. +// +// This object represents an item added via subscriptions. +type BillingFlatFeeLine struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + + // CreatedAt Timestamp of when the resource was created. + CreatedAt time.Time `json:"createdAt"` + Currency CurrencyCode `json:"currency"` + + // DeletedAt Timestamp of when the resource was permanently deleted. + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + // Description Optional description of the resource. Maximum 1024 characters. Description *string `json:"description,omitempty"` - Reason *string `json:"reason,omitempty"` - Type BillingDocumentRefType `json:"type"` -} + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` -// BillingGenericPaymentTerms defines model for BillingGenericPaymentTerms. -type BillingGenericPaymentTerms struct { - Detail *string `json:"detail,omitempty"` - Notes *string `json:"notes,omitempty"` - Type BillingPaymentTermType `json:"type"` -} + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` -// BillingInvoiceCreateInput defines model for BillingInvoiceCreateInput. -type BillingInvoiceCreateInput struct { - // IncludePendingItems The pending items to include in the invoice, if not provided all pending items will be included. - IncludePendingItems *[]string `json:"IncludePendingItems,omitempty"` -} + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` -// BillingInvoiceDiscount defines model for BillingInvoiceDiscount. -type BillingInvoiceDiscount struct { - Amount Numeric `json:"amount"` - Base *Numeric `json:"base,omitempty"` - Percent *Percentage `json:"percent,omitempty"` - Reason *string `json:"reason,omitempty"` + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Status BillingLineStatus `json:"status"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Taxes *[]BillingTaxItem `json:"taxes,omitempty"` + Total Numeric `json:"total"` + Type BillingFlatFeeLineType `json:"type"` + + // UpdatedAt Timestamp of when the resource was last updated. + UpdatedAt time.Time `json:"updatedAt"` } -// BillingInvoiceExpand InvoiceExpand specifies the parts of the invoice to expand in the list output. -type BillingInvoiceExpand string +// BillingFlatFeeLineType defines model for BillingFlatFeeLine.Type. +type BillingFlatFeeLineType string -// BillingInvoiceLine UnitPriceLine represents a line item that is sold to the customer based on a unit price. +// BillingFlatFeeLineCreateItem BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. // -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLine = BillingUnitPriceLine +// This object represents an item added via subscriptions. +type BillingFlatFeeLineCreateItem struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` -// BillingInvoiceLineCreate UnitPriceLine represents a line item that is sold to the customer based on a unit price. -// -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLineCreate = BillingUnitPriceLineCreate + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` -// BillingInvoiceLineCreateOrUpdate UnitPriceLine represents a line item that is sold to the customer based on a unit price. -// -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLineCreateOrUpdate = BillingUnitPriceLineCreateOrUpdate + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` -// BillingInvoiceNumber InvoiceNumber is a unique identifier for the invoice, generated by the -// invoicing app. + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingFlatFeeLineCreateItemType `json:"type"` +} + +// BillingFlatFeeLineCreateItemType defines model for BillingFlatFeeLineCreateItem.Type. +type BillingFlatFeeLineCreateItemType string + +// BillingFlatFeeLineCreateOrUpdate BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. // -// The uniqueness depends on a lot of factors: -// - app setting (unique per app or unique per customer) -// - multiple app scenarios (multiple apps generating invoices with the same prefix) -type BillingInvoiceNumber = string +// This object represents an item added via subscriptions. +type BillingFlatFeeLineCreateOrUpdate struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` -// BillingInvoiceOrderBy InvoiceOrderBy specifies the ordering options for invoice listing. -type BillingInvoiceOrderBy string + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` -// BillingInvoicePayment defines model for BillingInvoicePayment. -type BillingInvoicePayment struct { - Terms *BillingPaymentTerms `json:"terms,omitempty"` + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingFlatFeeLineCreateOrUpdateType `json:"type"` } -// BillingInvoiceStatus InvoiceStatus describes the status of an invoice. -type BillingInvoiceStatus string +// BillingFlatFeeLineCreateOrUpdateType defines model for BillingFlatFeeLineCreateOrUpdate.Type. +type BillingFlatFeeLineCreateOrUpdateType string + +// BillingGenericDocumentRef Omitted fields: +// period: Tax period in which the referred document had an effect required by some tax regimes and formats. +// stamps: Seals of approval from other organisations that may need to be listed. +// ext: Extensions for additional codes that may be required. +type BillingGenericDocumentRef struct { + Description *string `json:"description,omitempty"` + Reason *string `json:"reason,omitempty"` + Type BillingDocumentRefType `json:"type"` +} + +// BillingGenericPaymentTerms defines model for BillingGenericPaymentTerms. +type BillingGenericPaymentTerms struct { + Detail *string `json:"detail,omitempty"` + Notes *string `json:"notes,omitempty"` + Type BillingPaymentTermType `json:"type"` +} -// BillingInvoiceSummary defines model for BillingInvoiceSummary. -type BillingInvoiceSummary struct { +// BillingInvoice defines model for BillingInvoice. +type BillingInvoice struct { // CreatedAt Timestamp of when the resource was created. CreatedAt time.Time `json:"createdAt"` Currency CurrencyCode `json:"currency"` @@ -696,6 +800,9 @@ type BillingInvoiceSummary struct { Description *string `json:"description,omitempty"` Discounts *[]BillingInvoiceDiscount `json:"discounts,omitempty"` + // DueAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + DueAt *time.Time `json:"dueAt,omitempty"` + // Id A unique identifier for the resource. Id string `json:"id"` @@ -704,15 +811,12 @@ type BillingInvoiceSummary struct { // Depending on the status of the invoice this can mean multiple things: // - draft, gathering: The time the invoice will be issued based on the workflow settings. // - issued: The time the invoice was issued. - IssuedAt *time.Time `json:"issuedAt,omitempty"` - Lines *[]BillingLine `json:"lines,omitempty"` + IssuedAt *time.Time `json:"issuedAt,omitempty"` + Lines *[]BillingInvoiceLine `json:"lines,omitempty"` // Metadata Additional metadata for the resource. Metadata *Metadata `json:"metadata,omitempty"` - // Name Human-readable name for the resource. Between 1 and 256 characters. - Name string `json:"name"` - // Number Number specifies the human readable key used to reference this Invoice. // // The number only gets populated after the invoice had been issued. @@ -722,19 +826,96 @@ type BillingInvoiceSummary struct { // account. Number *BillingInvoiceNumber `json:"number,omitempty"` Payment *BillingInvoicePayment `json:"payment,omitempty"` + Period *BillingPeriod `json:"period,omitempty"` Preceding *[]BillingDocumentRef `json:"preceding,omitempty"` Status BillingInvoiceStatus `json:"status"` Supplier BillingParty `json:"supplier"` Totals BillingInvoiceTotals `json:"totals"` - Type *BillingInvoiceType `json:"type,omitempty"` + Type BillingInvoiceType `json:"type"` // UpdatedAt Timestamp of when the resource was last updated. // // For updates the updatedAt field is used to detect conflicts. - UpdatedAt time.Time `json:"updatedAt"` - Workflow *BillingInvoiceWorkflowSettings `json:"workflow,omitempty"` + UpdatedAt time.Time `json:"updatedAt"` + + // VoidedAt The time the invoice was voided. + // + // If the invoice was voided, this field will be set to the time the invoice was voided. + VoidedAt *time.Time `json:"voidedAt,omitempty"` + + // Workflow The workflow associated with the invoice. + // + // It is always a snapshot of the workflow settings at the time of invoice creation. The + // field is optional as it should be explicitly requested with expand options. + Workflow *BillingInvoiceWorkflowSettings `json:"workflow,omitempty"` +} + +// BillingInvoiceCreateInput defines model for BillingInvoiceCreateInput. +type BillingInvoiceCreateInput struct { + // AsOf The time as of which the invoice is created. + // + // If not provided, the current time is used. + AsOf *time.Time `json:"AsOf,omitempty"` + + // IncludePendingLines The pending line items to include in the invoice, if not provided: + // - all line items that have invoice_at < asOf will be included + // - all usage based line items will be included up to asOf, new usage-based line items will be staged for the rest + // of the billing cycle + IncludePendingLines *[]string `json:"IncludePendingLines,omitempty"` +} + +// BillingInvoiceDiscount defines model for BillingInvoiceDiscount. +type BillingInvoiceDiscount struct { + Amount Numeric `json:"amount"` + Base *Numeric `json:"base,omitempty"` + Percent *Percentage `json:"percent,omitempty"` + Reason *string `json:"reason,omitempty"` } +// BillingInvoiceExpand InvoiceExpand specifies the parts of the invoice to expand in the list output. +type BillingInvoiceExpand string + +// BillingInvoiceLine defines model for BillingInvoiceLine. +type BillingInvoiceLine struct { + union json.RawMessage +} + +// BillingInvoiceLineCreateItem defines model for BillingInvoiceLineCreateItem. +type BillingInvoiceLineCreateItem struct { + union json.RawMessage +} + +// BillingInvoiceLineCreateOrUpdate defines model for BillingInvoiceLineCreateOrUpdate. +type BillingInvoiceLineCreateOrUpdate struct { + union json.RawMessage +} + +// BillingInvoiceNumber InvoiceNumber is a unique identifier for the invoice, generated by the +// invoicing app. +// +// The uniqueness depends on a lot of factors: +// - app setting (unique per app or unique per customer) +// - multiple app scenarios (multiple apps generating invoices with the same prefix) +type BillingInvoiceNumber = string + +// BillingInvoiceOrderBy InvoiceOrderBy specifies the ordering options for invoice listing. +type BillingInvoiceOrderBy string + +// BillingInvoicePayment defines model for BillingInvoicePayment. +type BillingInvoicePayment struct { + Terms *BillingPaymentTerms `json:"terms,omitempty"` +} + +// BillingInvoiceReference defines model for BillingInvoiceReference. +type BillingInvoiceReference struct { + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Number *BillingInvoiceNumber `json:"number,omitempty"` +} + +// BillingInvoiceStatus InvoiceStatus describes the status of an invoice. +type BillingInvoiceStatus string + // BillingInvoiceTotals defines model for BillingInvoiceTotals. type BillingInvoiceTotals struct { Advance *Numeric `json:"advance,omitempty"` @@ -755,31 +936,15 @@ type BillingInvoiceType string // BillingInvoiceWorkflowSettings defines model for BillingInvoiceWorkflowSettings. type BillingInvoiceWorkflowSettings struct { - // AutoAdvance updatedAt is the time when the invoice workflow was last updated. - AutoAdvance bool `json:"autoAdvance"` + Apps *BillingProfileAppsOrReference `json:"apps,omitempty"` - // DraftUtil The invoice stays in the draft status until this time. + // SourceBillingProfileID sourceBillingProfileID is the billing profile on which the workflow was based on. // - // If auto advance is disabled the value will be empty. - DraftUtil *time.Time `json:"draftUtil,omitempty"` - - // DueAfter The period after which the invoice is due. - DueAfter *string `json:"dueAfter,omitempty"` -} - -// BillingLine Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingLine struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` - - // Id ULID (Universally Unique Lexicographically Sortable Identifier). - Id string `json:"id"` - Period BillingPeriod `json:"period"` - Taxes *[]BillingTaxItem `json:"taxes,omitempty"` - Total Numeric `json:"total"` - Type BillingLineTypes `json:"type"` + // The profile is snapshotted on invoice creation, after which it can be altered independently + // of the profile itself. + SourceBillingProfileID string `json:"sourceBillingProfileID"` + Timezone string `json:"timezone"` + Workflow BillingWorkflowSettings `json:"workflow"` } // BillingLineCharge defines model for BillingLineCharge. @@ -793,29 +958,6 @@ type BillingLineCharge struct { Reason *string `json:"reason,omitempty"` } -// BillingLineCreate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingLineCreate struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` - Period BillingPeriod `json:"period"` - Type BillingLineTypes `json:"type"` -} - -// BillingLineCreateOrUpdate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingLineCreateOrUpdate struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` - - // Id ULID (Universally Unique Lexicographically Sortable Identifier). - Id string `json:"id"` - Period BillingPeriod `json:"period"` - Type BillingLineTypes `json:"type"` -} - // BillingLineDiscount defines model for BillingLineDiscount. type BillingLineDiscount struct { // Amount Fixed discount amount to apply (calculated if percent present). @@ -827,15 +969,117 @@ type BillingLineDiscount struct { Reason *string `json:"reason,omitempty"` } -// BillingLineTypes defines model for BillingLineTypes. -type BillingLineTypes string +// BillingLineStatus defines model for BillingLineStatus. +type BillingLineStatus string + +// BillingManualFeeLine BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLine struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + + // CreatedAt Timestamp of when the resource was created. + CreatedAt time.Time `json:"createdAt"` + Currency CurrencyCode `json:"currency"` + + // DeletedAt Timestamp of when the resource was permanently deleted. + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity Numeric `json:"quantity"` + Status BillingLineStatus `json:"status"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Taxes *[]BillingTaxItem `json:"taxes,omitempty"` + Total Numeric `json:"total"` + Type BillingManualFeeLineType `json:"type"` + + // UpdatedAt Timestamp of when the resource was last updated. + UpdatedAt time.Time `json:"updatedAt"` +} + +// BillingManualFeeLineType defines model for BillingManualFeeLine.Type. +type BillingManualFeeLineType string + +// BillingManualFeeLineCreateItem BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLineCreateItem struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity Numeric `json:"quantity"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingManualFeeLineCreateItemType `json:"type"` +} + +// BillingManualFeeLineCreateItemType defines model for BillingManualFeeLineCreateItem.Type. +type BillingManualFeeLineCreateItemType string + +// BillingManualFeeLineCreateOrUpdate BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLineCreateOrUpdate struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice *BillingInvoiceReference `json:"invoice,omitempty"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity Numeric `json:"quantity"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingManualFeeLineCreateOrUpdateType `json:"type"` +} + +// BillingManualFeeLineCreateOrUpdateType defines model for BillingManualFeeLineCreateOrUpdate.Type. +type BillingManualFeeLineCreateOrUpdateType string // BillingParty defines model for BillingParty. type BillingParty struct { Addresses *[]Address `json:"addresses,omitempty"` // Id ULID (Universally Unique Lexicographically Sortable Identifier). - Id string `json:"id"` + Id *string `json:"id,omitempty"` Name *string `json:"name,omitempty"` TaxId *BillingTaxIdentity `json:"taxId,omitempty"` } @@ -872,7 +1116,7 @@ type BillingPeriod struct { // BillingProfile Profile represents a billing profile type BillingProfile struct { - Apps BillingProfileApps `json:"apps"` + Apps BillingProfileAppsOrReference `json:"apps"` // CreatedAt Timestamp of when the resource was created. CreatedAt time.Time `json:"createdAt"` @@ -901,6 +1145,13 @@ type BillingProfile struct { Workflow BillingWorkflow `json:"workflow"` } +// BillingProfileAppReferences ProfileAppsReference represents the references (id, type) to the apps used by a billing profile +type BillingProfileAppReferences struct { + Invoicing AppReference `json:"invoicing"` + Payment AppReference `json:"payment"` + Tax AppReference `json:"tax"` +} + // BillingProfileApps ProfileApps represents the applications used by a billing profile type BillingProfileApps struct { Invoicing App `json:"invoicing"` @@ -908,6 +1159,11 @@ type BillingProfileApps struct { Tax App `json:"tax"` } +// BillingProfileAppsOrReference defines model for BillingProfileAppsOrReference. +type BillingProfileAppsOrReference struct { + union json.RawMessage +} + // BillingProfileCreateAppsInput ProfileCreateAppsInput represents the input for creating a billing profile's apps type BillingProfileCreateAppsInput struct { Invoicing BillingWorkflowAppIdOrType `json:"invoicing"` @@ -954,6 +1210,9 @@ type BillingProfileCreateOrUpdate struct { Workflow BillingWorkflow `json:"workflow"` } +// BillingProfileExpand ProfileExpand details what profile fields to expand +type BillingProfileExpand string + // BillingProfileOrderBy ProfileOrderBy specifies the ordering options for profiles type BillingProfileOrderBy string @@ -976,50 +1235,35 @@ type BillingTaxItem struct { Surcharge *Numeric `json:"surcharge,omitempty"` } -// BillingUnitPriceLine Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLine = BillingLine - -// BillingUnitPriceLineCreate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLineCreate = BillingLineCreate - -// BillingUnitPriceLineCreateOrUpdate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLineCreateOrUpdate = BillingLineCreateOrUpdate - -// BillingVoidInvoiceAction InvoiceVoidAction describes how to handle the voided items. +// BillingVoidInvoiceAction InvoiceVoidAction describes how to handle the voided line items. type BillingVoidInvoiceAction struct { - Action BillingVoidInvoiceItemAction `json:"action"` + Action BillingVoidInvoiceLineAction `json:"action"` Percentage Percentage `json:"percentage"` } // BillingVoidInvoiceInput Request to void an invoice type BillingVoidInvoiceInput struct { - // Action The action to take on the voided items. - Action BillingVoidInvoiceItemAction `json:"action"` + // Action The action to take on the voided line items. + Action BillingVoidInvoiceAction `json:"action"` - // ItemOverrides Per line item overrides for the action. + // Overrides Per line item overrides for the action. // - // If not specified, the `action` will be applied to all items. - ItemOverrides *[]BillingVoidInvoiceItemOverride `json:"itemOverrides"` + // If not specified, the `action` will be applied to all line items. + Overrides *[]BillingVoidInvoiceLineOverride `json:"overrides"` // Reason The reason for voiding the invoice. Reason string `json:"reason"` } -// BillingVoidInvoiceItemAction defines model for BillingVoidInvoiceItemAction. -type BillingVoidInvoiceItemAction string +// BillingVoidInvoiceLineAction defines model for BillingVoidInvoiceLineAction. +type BillingVoidInvoiceLineAction string -// BillingVoidInvoiceItemOverride VoidInvoiceItemOverride describes how to handle a specific item in the invoice when voiding. -type BillingVoidInvoiceItemOverride struct { +// BillingVoidInvoiceLineOverride VoidInvoiceLineOverride describes how to handle a specific line item in the invoice when voiding. +type BillingVoidInvoiceLineOverride struct { Action BillingVoidInvoiceAction `json:"action"` - // ItemId ULID (Universally Unique Lexicographically Sortable Identifier). - ItemId string `json:"itemId"` + // LineId ULID (Universally Unique Lexicographically Sortable Identifier). + LineId string `json:"lineId"` } // BillingWorkflow Workflow represents a billing workflow @@ -1079,6 +1323,13 @@ type BillingWorkflowPaymentSettings struct { CollectionMethod *BillingWorkflowCollectionMethod `json:"collectionMethod,omitempty"` } +// BillingWorkflowSettings defines model for BillingWorkflowSettings. +type BillingWorkflowSettings struct { + Collection *BillingWorkflowCollectionSettings `json:"collection,omitempty"` + Invoicing *BillingWorkflowInvoicingSettings `json:"invoicing,omitempty"` + Payment *BillingWorkflowPaymentSettings `json:"payment,omitempty"` +} + // CheckoutSessionCustomTextAfterSubmitParams Stripe CheckoutSession.custom_text type CheckoutSessionCustomTextAfterSubmitParams struct { AfterSubmit *struct { @@ -1859,7 +2110,7 @@ type InternalServerErrorProblemResponse = UnexpectedProblemResponse // InvoicePaginatedResponse Paginated response type InvoicePaginatedResponse struct { // Items The items in the current page. - Items []BillingInvoiceSummary `json:"items"` + Items []BillingInvoice `json:"items"` // Page The items in the current page. Page int `json:"page"` @@ -3318,9 +3569,15 @@ type BillingListInvoicesByCustomerParams struct { OrderBy *InvoiceOrderByOrderingOrderBy `form:"orderBy,omitempty" json:"orderBy,omitempty"` } +// BillingGetInvoiceByCustomerInvoiceIdParams defines parameters for BillingGetInvoiceByCustomerInvoiceId. +type BillingGetInvoiceByCustomerInvoiceIdParams struct { + Expand []BillingInvoiceExpand `form:"expand" json:"expand"` +} + // BillingListProfilesParams defines parameters for BillingListProfiles. type BillingListProfilesParams struct { - IncludeArchived *bool `form:"includeArchived,omitempty" json:"includeArchived,omitempty"` + IncludeArchived *bool `form:"includeArchived,omitempty" json:"includeArchived,omitempty"` + Expand *[]BillingProfileExpand `form:"expand,omitempty" json:"expand,omitempty"` // Page Start date-time in RFC 3339 format. // @@ -3349,6 +3606,11 @@ type BillingListProfilesParams struct { OrderBy *ProfileOrderByOrderingOrderBy `form:"orderBy,omitempty" json:"orderBy,omitempty"` } +// BillingGetProfileParams defines parameters for BillingGetProfile. +type BillingGetProfileParams struct { + Expand *[]BillingProfileExpand `form:"expand,omitempty" json:"expand,omitempty"` +} + // ListCustomersParams defines parameters for ListCustomers. type ListCustomersParams struct { // IncludeDeleted Include deleted customers. @@ -3867,8 +4129,8 @@ type BillingUpdateInvoiceLineJSONRequestBody = BillingInvoiceLineCreateOrUpdate // BillingVoidInvoiceJSONRequestBody defines body for BillingVoidInvoice for application/json ContentType. type BillingVoidInvoiceJSONRequestBody = BillingVoidInvoiceInput -// BillingCreatePendingItemByCustomerJSONRequestBody defines body for BillingCreatePendingItemByCustomer for application/json ContentType. -type BillingCreatePendingItemByCustomerJSONRequestBody = BillingInvoiceLineCreate +// BillingCreateLineByCustomerJSONRequestBody defines body for BillingCreateLineByCustomer for application/json ContentType. +type BillingCreateLineByCustomerJSONRequestBody = BillingCreateLinesRequest // BillingCreateProfileJSONRequestBody defines body for BillingCreateProfile for application/json ContentType. type BillingCreateProfileJSONRequestBody = BillingProfileCreateInput @@ -3882,90 +4144,357 @@ type CreateCustomerJSONRequestBody = Customer // UpdateCustomerJSONRequestBody defines body for UpdateCustomer for application/json ContentType. type UpdateCustomerJSONRequestBody = Customer -// IngestEventsApplicationCloudeventsPlusJSONRequestBody defines body for IngestEvents for application/cloudevents+json ContentType. -type IngestEventsApplicationCloudeventsPlusJSONRequestBody = Event +// IngestEventsApplicationCloudeventsPlusJSONRequestBody defines body for IngestEvents for application/cloudevents+json ContentType. +type IngestEventsApplicationCloudeventsPlusJSONRequestBody = Event + +// IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody defines body for IngestEvents for application/cloudevents-batch+json ContentType. +type IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody = IngestEventsApplicationCloudeventsBatchPlusJSONBody + +// CreateFeatureJSONRequestBody defines body for CreateFeature for application/json ContentType. +type CreateFeatureJSONRequestBody = FeatureCreateInputs + +// CreateStripeCheckoutSessionJSONRequestBody defines body for CreateStripeCheckoutSession for application/json ContentType. +type CreateStripeCheckoutSessionJSONRequestBody = CreateStripeCheckoutSessionRequest + +// MarketplaceAppAPIKeyInstallJSONRequestBody defines body for MarketplaceAppAPIKeyInstall for application/json ContentType. +type MarketplaceAppAPIKeyInstallJSONRequestBody MarketplaceAppAPIKeyInstallJSONBody + +// CreateMeterJSONRequestBody defines body for CreateMeter for application/json ContentType. +type CreateMeterJSONRequestBody = MeterCreate + +// CreateNotificationChannelJSONRequestBody defines body for CreateNotificationChannel for application/json ContentType. +type CreateNotificationChannelJSONRequestBody = NotificationChannelCreateRequest + +// UpdateNotificationChannelJSONRequestBody defines body for UpdateNotificationChannel for application/json ContentType. +type UpdateNotificationChannelJSONRequestBody = NotificationChannelCreateRequest + +// CreateNotificationRuleJSONRequestBody defines body for CreateNotificationRule for application/json ContentType. +type CreateNotificationRuleJSONRequestBody = NotificationRuleCreateRequest + +// UpdateNotificationRuleJSONRequestBody defines body for UpdateNotificationRule for application/json ContentType. +type UpdateNotificationRuleJSONRequestBody = NotificationRuleCreateRequest + +// ReceiveSvixOperationalEventJSONRequestBody defines body for ReceiveSvixOperationalEvent for application/json ContentType. +type ReceiveSvixOperationalEventJSONRequestBody = SvixOperationalWebhookRequest + +// CreatePlanJSONRequestBody defines body for CreatePlan for application/json ContentType. +type CreatePlanJSONRequestBody = PlanCreate + +// UpdatePlanJSONRequestBody defines body for UpdatePlan for application/json ContentType. +type UpdatePlanJSONRequestBody = PlanUpdate + +// CreatePlanPhasesJSONRequestBody defines body for CreatePlanPhases for application/json ContentType. +type CreatePlanPhasesJSONRequestBody = PlanPhaseCreate + +// UpdatePlanPhasesJSONRequestBody defines body for UpdatePlanPhases for application/json ContentType. +type UpdatePlanPhasesJSONRequestBody = PlanPhaseUpdate + +// CreatePortalTokenJSONRequestBody defines body for CreatePortalToken for application/json ContentType. +type CreatePortalTokenJSONRequestBody = PortalToken + +// InvalidatePortalTokensJSONRequestBody defines body for InvalidatePortalTokens for application/json ContentType. +type InvalidatePortalTokensJSONRequestBody InvalidatePortalTokensJSONBody + +// UpsertSubjectJSONRequestBody defines body for UpsertSubject for application/json ContentType. +type UpsertSubjectJSONRequestBody = UpsertSubjectJSONBody + +// CreateEntitlementJSONRequestBody defines body for CreateEntitlement for application/json ContentType. +type CreateEntitlementJSONRequestBody = EntitlementCreateInputs + +// CreateGrantJSONRequestBody defines body for CreateGrant for application/json ContentType. +type CreateGrantJSONRequestBody = EntitlementGrantCreateInput + +// OverrideEntitlementJSONRequestBody defines body for OverrideEntitlement for application/json ContentType. +type OverrideEntitlementJSONRequestBody = EntitlementCreateInputs + +// ResetEntitlementUsageJSONRequestBody defines body for ResetEntitlementUsage for application/json ContentType. +type ResetEntitlementUsageJSONRequestBody = ResetEntitlementUsageInput + +// AsStripeApp returns the union data inside the App as a StripeApp +func (t App) AsStripeApp() (StripeApp, error) { + var body StripeApp + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromStripeApp overwrites any union data inside the App as the provided StripeApp +func (t *App) FromStripeApp(v StripeApp) error { + v.Type = "stripe" + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeStripeApp performs a merge with any union data inside the App, using the provided StripeApp +func (t *App) MergeStripeApp(v StripeApp) error { + v.Type = "stripe" + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsSandboxApp returns the union data inside the App as a SandboxApp +func (t App) AsSandboxApp() (SandboxApp, error) { + var body SandboxApp + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromSandboxApp overwrites any union data inside the App as the provided SandboxApp +func (t *App) FromSandboxApp(v SandboxApp) error { + v.Type = "sandbox" + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeSandboxApp performs a merge with any union data inside the App, using the provided SandboxApp +func (t *App) MergeSandboxApp(v SandboxApp) error { + v.Type = "sandbox" + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t App) Discriminator() (string, error) { + var discriminator struct { + Discriminator string `json:"type"` + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err +} + +func (t App) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator { + case "sandbox": + return t.AsSandboxApp() + case "stripe": + return t.AsStripeApp() + default: + return nil, errors.New("unknown discriminator value: " + discriminator) + } +} + +func (t App) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *App) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + +// AsBillingFlatFeeLine returns the union data inside the BillingInvoiceLine as a BillingFlatFeeLine +func (t BillingInvoiceLine) AsBillingFlatFeeLine() (BillingFlatFeeLine, error) { + var body BillingFlatFeeLine + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingFlatFeeLine overwrites any union data inside the BillingInvoiceLine as the provided BillingFlatFeeLine +func (t *BillingInvoiceLine) FromBillingFlatFeeLine(v BillingFlatFeeLine) error { + v.Type = "flat_fee" + b, err := json.Marshal(v) + t.union = b + return err +} -// IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody defines body for IngestEvents for application/cloudevents-batch+json ContentType. -type IngestEventsApplicationCloudeventsBatchPlusJSONRequestBody = IngestEventsApplicationCloudeventsBatchPlusJSONBody +// MergeBillingFlatFeeLine performs a merge with any union data inside the BillingInvoiceLine, using the provided BillingFlatFeeLine +func (t *BillingInvoiceLine) MergeBillingFlatFeeLine(v BillingFlatFeeLine) error { + v.Type = "flat_fee" + b, err := json.Marshal(v) + if err != nil { + return err + } -// CreateFeatureJSONRequestBody defines body for CreateFeature for application/json ContentType. -type CreateFeatureJSONRequestBody = FeatureCreateInputs + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} -// CreateStripeCheckoutSessionJSONRequestBody defines body for CreateStripeCheckoutSession for application/json ContentType. -type CreateStripeCheckoutSessionJSONRequestBody = CreateStripeCheckoutSessionRequest +// AsBillingManualFeeLine returns the union data inside the BillingInvoiceLine as a BillingManualFeeLine +func (t BillingInvoiceLine) AsBillingManualFeeLine() (BillingManualFeeLine, error) { + var body BillingManualFeeLine + err := json.Unmarshal(t.union, &body) + return body, err +} -// MarketplaceAppAPIKeyInstallJSONRequestBody defines body for MarketplaceAppAPIKeyInstall for application/json ContentType. -type MarketplaceAppAPIKeyInstallJSONRequestBody MarketplaceAppAPIKeyInstallJSONBody +// FromBillingManualFeeLine overwrites any union data inside the BillingInvoiceLine as the provided BillingManualFeeLine +func (t *BillingInvoiceLine) FromBillingManualFeeLine(v BillingManualFeeLine) error { + v.Type = "manual_fee" + b, err := json.Marshal(v) + t.union = b + return err +} -// CreateMeterJSONRequestBody defines body for CreateMeter for application/json ContentType. -type CreateMeterJSONRequestBody = MeterCreate +// MergeBillingManualFeeLine performs a merge with any union data inside the BillingInvoiceLine, using the provided BillingManualFeeLine +func (t *BillingInvoiceLine) MergeBillingManualFeeLine(v BillingManualFeeLine) error { + v.Type = "manual_fee" + b, err := json.Marshal(v) + if err != nil { + return err + } -// CreateNotificationChannelJSONRequestBody defines body for CreateNotificationChannel for application/json ContentType. -type CreateNotificationChannelJSONRequestBody = NotificationChannelCreateRequest + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} -// UpdateNotificationChannelJSONRequestBody defines body for UpdateNotificationChannel for application/json ContentType. -type UpdateNotificationChannelJSONRequestBody = NotificationChannelCreateRequest +func (t BillingInvoiceLine) Discriminator() (string, error) { + var discriminator struct { + Discriminator string `json:"type"` + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err +} -// CreateNotificationRuleJSONRequestBody defines body for CreateNotificationRule for application/json ContentType. -type CreateNotificationRuleJSONRequestBody = NotificationRuleCreateRequest +func (t BillingInvoiceLine) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator { + case "flat_fee": + return t.AsBillingFlatFeeLine() + case "manual_fee": + return t.AsBillingManualFeeLine() + default: + return nil, errors.New("unknown discriminator value: " + discriminator) + } +} -// UpdateNotificationRuleJSONRequestBody defines body for UpdateNotificationRule for application/json ContentType. -type UpdateNotificationRuleJSONRequestBody = NotificationRuleCreateRequest +func (t BillingInvoiceLine) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} -// ReceiveSvixOperationalEventJSONRequestBody defines body for ReceiveSvixOperationalEvent for application/json ContentType. -type ReceiveSvixOperationalEventJSONRequestBody = SvixOperationalWebhookRequest +func (t *BillingInvoiceLine) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} -// CreatePlanJSONRequestBody defines body for CreatePlan for application/json ContentType. -type CreatePlanJSONRequestBody = PlanCreate +// AsBillingFlatFeeLineCreateItem returns the union data inside the BillingInvoiceLineCreateItem as a BillingFlatFeeLineCreateItem +func (t BillingInvoiceLineCreateItem) AsBillingFlatFeeLineCreateItem() (BillingFlatFeeLineCreateItem, error) { + var body BillingFlatFeeLineCreateItem + err := json.Unmarshal(t.union, &body) + return body, err +} -// UpdatePlanJSONRequestBody defines body for UpdatePlan for application/json ContentType. -type UpdatePlanJSONRequestBody = PlanUpdate +// FromBillingFlatFeeLineCreateItem overwrites any union data inside the BillingInvoiceLineCreateItem as the provided BillingFlatFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) FromBillingFlatFeeLineCreateItem(v BillingFlatFeeLineCreateItem) error { + v.Type = "flat_fee" + b, err := json.Marshal(v) + t.union = b + return err +} -// CreatePlanPhasesJSONRequestBody defines body for CreatePlanPhases for application/json ContentType. -type CreatePlanPhasesJSONRequestBody = PlanPhaseCreate +// MergeBillingFlatFeeLineCreateItem performs a merge with any union data inside the BillingInvoiceLineCreateItem, using the provided BillingFlatFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) MergeBillingFlatFeeLineCreateItem(v BillingFlatFeeLineCreateItem) error { + v.Type = "flat_fee" + b, err := json.Marshal(v) + if err != nil { + return err + } -// UpdatePlanPhasesJSONRequestBody defines body for UpdatePlanPhases for application/json ContentType. -type UpdatePlanPhasesJSONRequestBody = PlanPhaseUpdate + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} -// CreatePortalTokenJSONRequestBody defines body for CreatePortalToken for application/json ContentType. -type CreatePortalTokenJSONRequestBody = PortalToken +// AsBillingManualFeeLineCreateItem returns the union data inside the BillingInvoiceLineCreateItem as a BillingManualFeeLineCreateItem +func (t BillingInvoiceLineCreateItem) AsBillingManualFeeLineCreateItem() (BillingManualFeeLineCreateItem, error) { + var body BillingManualFeeLineCreateItem + err := json.Unmarshal(t.union, &body) + return body, err +} -// InvalidatePortalTokensJSONRequestBody defines body for InvalidatePortalTokens for application/json ContentType. -type InvalidatePortalTokensJSONRequestBody InvalidatePortalTokensJSONBody +// FromBillingManualFeeLineCreateItem overwrites any union data inside the BillingInvoiceLineCreateItem as the provided BillingManualFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) FromBillingManualFeeLineCreateItem(v BillingManualFeeLineCreateItem) error { + v.Type = "manual_fee" + b, err := json.Marshal(v) + t.union = b + return err +} -// UpsertSubjectJSONRequestBody defines body for UpsertSubject for application/json ContentType. -type UpsertSubjectJSONRequestBody = UpsertSubjectJSONBody +// MergeBillingManualFeeLineCreateItem performs a merge with any union data inside the BillingInvoiceLineCreateItem, using the provided BillingManualFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) MergeBillingManualFeeLineCreateItem(v BillingManualFeeLineCreateItem) error { + v.Type = "manual_fee" + b, err := json.Marshal(v) + if err != nil { + return err + } -// CreateEntitlementJSONRequestBody defines body for CreateEntitlement for application/json ContentType. -type CreateEntitlementJSONRequestBody = EntitlementCreateInputs + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} -// CreateGrantJSONRequestBody defines body for CreateGrant for application/json ContentType. -type CreateGrantJSONRequestBody = EntitlementGrantCreateInput +func (t BillingInvoiceLineCreateItem) Discriminator() (string, error) { + var discriminator struct { + Discriminator string `json:"type"` + } + err := json.Unmarshal(t.union, &discriminator) + return discriminator.Discriminator, err +} -// OverrideEntitlementJSONRequestBody defines body for OverrideEntitlement for application/json ContentType. -type OverrideEntitlementJSONRequestBody = EntitlementCreateInputs +func (t BillingInvoiceLineCreateItem) ValueByDiscriminator() (interface{}, error) { + discriminator, err := t.Discriminator() + if err != nil { + return nil, err + } + switch discriminator { + case "flat_fee": + return t.AsBillingFlatFeeLineCreateItem() + case "manual_fee": + return t.AsBillingManualFeeLineCreateItem() + default: + return nil, errors.New("unknown discriminator value: " + discriminator) + } +} -// ResetEntitlementUsageJSONRequestBody defines body for ResetEntitlementUsage for application/json ContentType. -type ResetEntitlementUsageJSONRequestBody = ResetEntitlementUsageInput +func (t BillingInvoiceLineCreateItem) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} -// AsStripeApp returns the union data inside the App as a StripeApp -func (t App) AsStripeApp() (StripeApp, error) { - var body StripeApp +func (t *BillingInvoiceLineCreateItem) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + +// AsBillingFlatFeeLineCreateOrUpdate returns the union data inside the BillingInvoiceLineCreateOrUpdate as a BillingFlatFeeLineCreateOrUpdate +func (t BillingInvoiceLineCreateOrUpdate) AsBillingFlatFeeLineCreateOrUpdate() (BillingFlatFeeLineCreateOrUpdate, error) { + var body BillingFlatFeeLineCreateOrUpdate err := json.Unmarshal(t.union, &body) return body, err } -// FromStripeApp overwrites any union data inside the App as the provided StripeApp -func (t *App) FromStripeApp(v StripeApp) error { - v.Type = "stripe" +// FromBillingFlatFeeLineCreateOrUpdate overwrites any union data inside the BillingInvoiceLineCreateOrUpdate as the provided BillingFlatFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) FromBillingFlatFeeLineCreateOrUpdate(v BillingFlatFeeLineCreateOrUpdate) error { + v.Type = "flat_fee" b, err := json.Marshal(v) t.union = b return err } -// MergeStripeApp performs a merge with any union data inside the App, using the provided StripeApp -func (t *App) MergeStripeApp(v StripeApp) error { - v.Type = "stripe" +// MergeBillingFlatFeeLineCreateOrUpdate performs a merge with any union data inside the BillingInvoiceLineCreateOrUpdate, using the provided BillingFlatFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) MergeBillingFlatFeeLineCreateOrUpdate(v BillingFlatFeeLineCreateOrUpdate) error { + v.Type = "flat_fee" b, err := json.Marshal(v) if err != nil { return err @@ -3976,24 +4505,24 @@ func (t *App) MergeStripeApp(v StripeApp) error { return err } -// AsSandboxApp returns the union data inside the App as a SandboxApp -func (t App) AsSandboxApp() (SandboxApp, error) { - var body SandboxApp +// AsBillingManualFeeLineCreateOrUpdate returns the union data inside the BillingInvoiceLineCreateOrUpdate as a BillingManualFeeLineCreateOrUpdate +func (t BillingInvoiceLineCreateOrUpdate) AsBillingManualFeeLineCreateOrUpdate() (BillingManualFeeLineCreateOrUpdate, error) { + var body BillingManualFeeLineCreateOrUpdate err := json.Unmarshal(t.union, &body) return body, err } -// FromSandboxApp overwrites any union data inside the App as the provided SandboxApp -func (t *App) FromSandboxApp(v SandboxApp) error { - v.Type = "sandbox" +// FromBillingManualFeeLineCreateOrUpdate overwrites any union data inside the BillingInvoiceLineCreateOrUpdate as the provided BillingManualFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) FromBillingManualFeeLineCreateOrUpdate(v BillingManualFeeLineCreateOrUpdate) error { + v.Type = "manual_fee" b, err := json.Marshal(v) t.union = b return err } -// MergeSandboxApp performs a merge with any union data inside the App, using the provided SandboxApp -func (t *App) MergeSandboxApp(v SandboxApp) error { - v.Type = "sandbox" +// MergeBillingManualFeeLineCreateOrUpdate performs a merge with any union data inside the BillingInvoiceLineCreateOrUpdate, using the provided BillingManualFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) MergeBillingManualFeeLineCreateOrUpdate(v BillingManualFeeLineCreateOrUpdate) error { + v.Type = "manual_fee" b, err := json.Marshal(v) if err != nil { return err @@ -4004,7 +4533,7 @@ func (t *App) MergeSandboxApp(v SandboxApp) error { return err } -func (t App) Discriminator() (string, error) { +func (t BillingInvoiceLineCreateOrUpdate) Discriminator() (string, error) { var discriminator struct { Discriminator string `json:"type"` } @@ -4012,27 +4541,27 @@ func (t App) Discriminator() (string, error) { return discriminator.Discriminator, err } -func (t App) ValueByDiscriminator() (interface{}, error) { +func (t BillingInvoiceLineCreateOrUpdate) ValueByDiscriminator() (interface{}, error) { discriminator, err := t.Discriminator() if err != nil { return nil, err } switch discriminator { - case "sandbox": - return t.AsSandboxApp() - case "stripe": - return t.AsStripeApp() + case "flat_fee": + return t.AsBillingFlatFeeLineCreateOrUpdate() + case "manual_fee": + return t.AsBillingManualFeeLineCreateOrUpdate() default: return nil, errors.New("unknown discriminator value: " + discriminator) } } -func (t App) MarshalJSON() ([]byte, error) { +func (t BillingInvoiceLineCreateOrUpdate) MarshalJSON() ([]byte, error) { b, err := t.union.MarshalJSON() return b, err } -func (t *App) UnmarshalJSON(b []byte) error { +func (t *BillingInvoiceLineCreateOrUpdate) UnmarshalJSON(b []byte) error { err := t.union.UnmarshalJSON(b) return err } @@ -4099,6 +4628,68 @@ func (t *BillingPaymentTerms) UnmarshalJSON(b []byte) error { return err } +// AsBillingProfileApps returns the union data inside the BillingProfileAppsOrReference as a BillingProfileApps +func (t BillingProfileAppsOrReference) AsBillingProfileApps() (BillingProfileApps, error) { + var body BillingProfileApps + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingProfileApps overwrites any union data inside the BillingProfileAppsOrReference as the provided BillingProfileApps +func (t *BillingProfileAppsOrReference) FromBillingProfileApps(v BillingProfileApps) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingProfileApps performs a merge with any union data inside the BillingProfileAppsOrReference, using the provided BillingProfileApps +func (t *BillingProfileAppsOrReference) MergeBillingProfileApps(v BillingProfileApps) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsBillingProfileAppReferences returns the union data inside the BillingProfileAppsOrReference as a BillingProfileAppReferences +func (t BillingProfileAppsOrReference) AsBillingProfileAppReferences() (BillingProfileAppReferences, error) { + var body BillingProfileAppReferences + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingProfileAppReferences overwrites any union data inside the BillingProfileAppsOrReference as the provided BillingProfileAppReferences +func (t *BillingProfileAppsOrReference) FromBillingProfileAppReferences(v BillingProfileAppReferences) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingProfileAppReferences performs a merge with any union data inside the BillingProfileAppsOrReference, using the provided BillingProfileAppReferences +func (t *BillingProfileAppsOrReference) MergeBillingProfileAppReferences(v BillingProfileAppReferences) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t BillingProfileAppsOrReference) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *BillingProfileAppsOrReference) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsCustomerId returns the union data inside the CreateStripeCheckoutSessionRequest_Customer as a CustomerId func (t CreateStripeCheckoutSessionRequest_Customer) AsCustomerId() (CustomerId, error) { var body CustomerId @@ -4899,50 +5490,50 @@ type ServerInterface interface { // (GET /api/v1/billing/customer) BillingListCustomerOverrides(w http.ResponseWriter, r *http.Request, params BillingListCustomerOverridesParams) // Delete a customer override - // (DELETE /api/v1/billing/customer/{customerIdOrKey}) - BillingDeleteCustomerOverride(w http.ResponseWriter, r *http.Request, customerIdOrKey string) + // (DELETE /api/v1/billing/customer/{customerId}) + BillingDeleteCustomerOverride(w http.ResponseWriter, r *http.Request, customerId string) // Get a customer override - // (GET /api/v1/billing/customer/{customerIdOrKey}) - BillingGetCustomerOverrideById(w http.ResponseWriter, r *http.Request, customerIdOrKey string) + // (GET /api/v1/billing/customer/{customerId}) + BillingGetCustomerOverrideById(w http.ResponseWriter, r *http.Request, customerId string) // Create/update a customer override - // (POST /api/v1/billing/customer/{customerIdOrKey}) - BillingUpsertCustomerOverride(w http.ResponseWriter, r *http.Request, customerIdOrKey string) + // (POST /api/v1/billing/customer/{customerId}) + BillingUpsertCustomerOverride(w http.ResponseWriter, r *http.Request, customerId string) // List invoices // (GET /api/v1/billing/invoices) BillingListInvoices(w http.ResponseWriter, r *http.Request, params BillingListInvoicesParams) // List invoices - // (GET /api/v1/billing/invoices/{customerIdOrKey}) - BillingListInvoicesByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string, params BillingListInvoicesByCustomerParams) + // (GET /api/v1/billing/invoices/{customerId}) + BillingListInvoicesByCustomer(w http.ResponseWriter, r *http.Request, customerId string, params BillingListInvoicesByCustomerParams) // Create an invoice - // (POST /api/v1/billing/invoices/{customerIdOrKey}) - BillingCreateInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string) + // (POST /api/v1/billing/invoices/{customerId}) + BillingCreateInvoice(w http.ResponseWriter, r *http.Request, customerId string) // Delete an invoice - // (DELETE /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}) - BillingDeleteInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) + // (DELETE /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}) + BillingDeleteInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) // Get an invoice - // (GET /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}) - BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) + // (GET /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}) + BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, params BillingGetInvoiceByCustomerInvoiceIdParams) // Send the invoice to the customer - // (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/approve) - BillingApproveInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) + // (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/approve) + BillingApproveInvoice(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) // Delete an invoice line - // (DELETE /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}) - BillingDeleteInvoiceLine(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string, lineId string) + // (DELETE /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}) + BillingDeleteInvoiceLine(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, lineId string) // Update an invoice line - // (PUT /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}) - BillingUpdateInvoiceLine(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string, lineId string) + // (PUT /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}) + BillingUpdateInvoiceLine(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, lineId string) // Recalculate an invoice's tax amounts - // (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/tax/recalculate) - BillingRecalculateInvoiceTax(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) + // (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/tax/recalculate) + BillingRecalculateInvoiceTax(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) // Void an invoice - // (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/void) - BillingVoidInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) + // (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/void) + BillingVoidInvoice(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) // Advance the invoice's state to the next status - // (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/workflow/advance) - BillingInvoiceWorkflowAdvance(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) - // Create a new pending item - // (POST /api/v1/billing/invoices/{customerIdOrKey}/items) - BillingCreatePendingItemByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string) + // (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/workflow/advance) + BillingInvoiceWorkflowAdvance(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) + // Create line items + // (POST /api/v1/billing/invoices/{customerId}/lines) + BillingCreateLineByCustomer(w http.ResponseWriter, r *http.Request, customerId string) // (GET /api/v1/billing/profile) BillingListProfiles(w http.ResponseWriter, r *http.Request, params BillingListProfilesParams) @@ -4954,7 +5545,7 @@ type ServerInterface interface { BillingArchiveProfile(w http.ResponseWriter, r *http.Request, id string) // Get a billing profile by ID // (GET /api/v1/billing/profile/{id}) - BillingGetProfile(w http.ResponseWriter, r *http.Request, id string) + BillingGetProfile(w http.ResponseWriter, r *http.Request, id string, params BillingGetProfileParams) // Update a billing profile // (PUT /api/v1/billing/profile/{id}) BillingUpdateProfile(w http.ResponseWriter, r *http.Request, id string) @@ -5210,20 +5801,20 @@ func (_ Unimplemented) BillingListCustomerOverrides(w http.ResponseWriter, r *ht } // Delete a customer override -// (DELETE /api/v1/billing/customer/{customerIdOrKey}) -func (_ Unimplemented) BillingDeleteCustomerOverride(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { +// (DELETE /api/v1/billing/customer/{customerId}) +func (_ Unimplemented) BillingDeleteCustomerOverride(w http.ResponseWriter, r *http.Request, customerId string) { w.WriteHeader(http.StatusNotImplemented) } // Get a customer override -// (GET /api/v1/billing/customer/{customerIdOrKey}) -func (_ Unimplemented) BillingGetCustomerOverrideById(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { +// (GET /api/v1/billing/customer/{customerId}) +func (_ Unimplemented) BillingGetCustomerOverrideById(w http.ResponseWriter, r *http.Request, customerId string) { w.WriteHeader(http.StatusNotImplemented) } // Create/update a customer override -// (POST /api/v1/billing/customer/{customerIdOrKey}) -func (_ Unimplemented) BillingUpsertCustomerOverride(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { +// (POST /api/v1/billing/customer/{customerId}) +func (_ Unimplemented) BillingUpsertCustomerOverride(w http.ResponseWriter, r *http.Request, customerId string) { w.WriteHeader(http.StatusNotImplemented) } @@ -5234,68 +5825,68 @@ func (_ Unimplemented) BillingListInvoices(w http.ResponseWriter, r *http.Reques } // List invoices -// (GET /api/v1/billing/invoices/{customerIdOrKey}) -func (_ Unimplemented) BillingListInvoicesByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string, params BillingListInvoicesByCustomerParams) { +// (GET /api/v1/billing/invoices/{customerId}) +func (_ Unimplemented) BillingListInvoicesByCustomer(w http.ResponseWriter, r *http.Request, customerId string, params BillingListInvoicesByCustomerParams) { w.WriteHeader(http.StatusNotImplemented) } // Create an invoice -// (POST /api/v1/billing/invoices/{customerIdOrKey}) -func (_ Unimplemented) BillingCreateInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { +// (POST /api/v1/billing/invoices/{customerId}) +func (_ Unimplemented) BillingCreateInvoice(w http.ResponseWriter, r *http.Request, customerId string) { w.WriteHeader(http.StatusNotImplemented) } // Delete an invoice -// (DELETE /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}) -func (_ Unimplemented) BillingDeleteInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (DELETE /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}) +func (_ Unimplemented) BillingDeleteInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) { w.WriteHeader(http.StatusNotImplemented) } // Get an invoice -// (GET /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}) -func (_ Unimplemented) BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (GET /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}) +func (_ Unimplemented) BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, params BillingGetInvoiceByCustomerInvoiceIdParams) { w.WriteHeader(http.StatusNotImplemented) } // Send the invoice to the customer -// (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/approve) -func (_ Unimplemented) BillingApproveInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/approve) +func (_ Unimplemented) BillingApproveInvoice(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) { w.WriteHeader(http.StatusNotImplemented) } // Delete an invoice line -// (DELETE /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}) -func (_ Unimplemented) BillingDeleteInvoiceLine(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string, lineId string) { +// (DELETE /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}) +func (_ Unimplemented) BillingDeleteInvoiceLine(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, lineId string) { w.WriteHeader(http.StatusNotImplemented) } // Update an invoice line -// (PUT /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}) -func (_ Unimplemented) BillingUpdateInvoiceLine(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string, lineId string) { +// (PUT /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}) +func (_ Unimplemented) BillingUpdateInvoiceLine(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string, lineId string) { w.WriteHeader(http.StatusNotImplemented) } // Recalculate an invoice's tax amounts -// (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/tax/recalculate) -func (_ Unimplemented) BillingRecalculateInvoiceTax(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/tax/recalculate) +func (_ Unimplemented) BillingRecalculateInvoiceTax(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) { w.WriteHeader(http.StatusNotImplemented) } // Void an invoice -// (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/void) -func (_ Unimplemented) BillingVoidInvoice(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/void) +func (_ Unimplemented) BillingVoidInvoice(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) { w.WriteHeader(http.StatusNotImplemented) } // Advance the invoice's state to the next status -// (POST /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/workflow/advance) -func (_ Unimplemented) BillingInvoiceWorkflowAdvance(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +// (POST /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/workflow/advance) +func (_ Unimplemented) BillingInvoiceWorkflowAdvance(w http.ResponseWriter, r *http.Request, customerId string, invoiceId string) { w.WriteHeader(http.StatusNotImplemented) } -// Create a new pending item -// (POST /api/v1/billing/invoices/{customerIdOrKey}/items) -func (_ Unimplemented) BillingCreatePendingItemByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { +// Create line items +// (POST /api/v1/billing/invoices/{customerId}/lines) +func (_ Unimplemented) BillingCreateLineByCustomer(w http.ResponseWriter, r *http.Request, customerId string) { w.WriteHeader(http.StatusNotImplemented) } @@ -5318,7 +5909,7 @@ func (_ Unimplemented) BillingArchiveProfile(w http.ResponseWriter, r *http.Requ // Get a billing profile by ID // (GET /api/v1/billing/profile/{id}) -func (_ Unimplemented) BillingGetProfile(w http.ResponseWriter, r *http.Request, id string) { +func (_ Unimplemented) BillingGetProfile(w http.ResponseWriter, r *http.Request, id string, params BillingGetProfileParams) { w.WriteHeader(http.StatusNotImplemented) } @@ -5962,12 +6553,12 @@ func (siw *ServerInterfaceWrapper) BillingDeleteCustomerOverride(w http.Response var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -5980,7 +6571,7 @@ func (siw *ServerInterfaceWrapper) BillingDeleteCustomerOverride(w http.Response r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingDeleteCustomerOverride(w, r, customerIdOrKey) + siw.Handler.BillingDeleteCustomerOverride(w, r, customerId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -5995,12 +6586,12 @@ func (siw *ServerInterfaceWrapper) BillingGetCustomerOverrideById(w http.Respons var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6013,7 +6604,7 @@ func (siw *ServerInterfaceWrapper) BillingGetCustomerOverrideById(w http.Respons r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingGetCustomerOverrideById(w, r, customerIdOrKey) + siw.Handler.BillingGetCustomerOverrideById(w, r, customerId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6028,12 +6619,12 @@ func (siw *ServerInterfaceWrapper) BillingUpsertCustomerOverride(w http.Response var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6046,7 +6637,7 @@ func (siw *ServerInterfaceWrapper) BillingUpsertCustomerOverride(w http.Response r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingUpsertCustomerOverride(w, r, customerIdOrKey) + siw.Handler.BillingUpsertCustomerOverride(w, r, customerId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6176,12 +6767,12 @@ func (siw *ServerInterfaceWrapper) BillingListInvoicesByCustomer(w http.Response var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6277,7 +6868,7 @@ func (siw *ServerInterfaceWrapper) BillingListInvoicesByCustomer(w http.Response } handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingListInvoicesByCustomer(w, r, customerIdOrKey, params) + siw.Handler.BillingListInvoicesByCustomer(w, r, customerId, params) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6292,12 +6883,12 @@ func (siw *ServerInterfaceWrapper) BillingCreateInvoice(w http.ResponseWriter, r var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6310,7 +6901,7 @@ func (siw *ServerInterfaceWrapper) BillingCreateInvoice(w http.ResponseWriter, r r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingCreateInvoice(w, r, customerIdOrKey) + siw.Handler.BillingCreateInvoice(w, r, customerId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6325,12 +6916,12 @@ func (siw *ServerInterfaceWrapper) BillingDeleteInvoiceByCustomerInvoiceId(w htt var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6352,7 +6943,7 @@ func (siw *ServerInterfaceWrapper) BillingDeleteInvoiceByCustomerInvoiceId(w htt r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingDeleteInvoiceByCustomerInvoiceId(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingDeleteInvoiceByCustomerInvoiceId(w, r, customerId, invoiceId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6367,12 +6958,12 @@ func (siw *ServerInterfaceWrapper) BillingGetInvoiceByCustomerInvoiceId(w http.R var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6393,8 +6984,26 @@ func (siw *ServerInterfaceWrapper) BillingGetInvoiceByCustomerInvoiceId(w http.R r = r.WithContext(ctx) + // Parameter object where we will unmarshal all parameters from the context + var params BillingGetInvoiceByCustomerInvoiceIdParams + + // ------------- Required query parameter "expand" ------------- + + if paramValue := r.URL.Query().Get("expand"); paramValue != "" { + + } else { + siw.ErrorHandlerFunc(w, r, &RequiredParamError{ParamName: "expand"}) + return + } + + err = runtime.BindQueryParameter("form", false, true, "expand", r.URL.Query(), ¶ms.Expand) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "expand", Err: err}) + return + } + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingGetInvoiceByCustomerInvoiceId(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingGetInvoiceByCustomerInvoiceId(w, r, customerId, invoiceId, params) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6409,12 +7018,12 @@ func (siw *ServerInterfaceWrapper) BillingApproveInvoice(w http.ResponseWriter, var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6436,7 +7045,7 @@ func (siw *ServerInterfaceWrapper) BillingApproveInvoice(w http.ResponseWriter, r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingApproveInvoice(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingApproveInvoice(w, r, customerId, invoiceId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6451,12 +7060,12 @@ func (siw *ServerInterfaceWrapper) BillingDeleteInvoiceLine(w http.ResponseWrite var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6487,7 +7096,7 @@ func (siw *ServerInterfaceWrapper) BillingDeleteInvoiceLine(w http.ResponseWrite r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingDeleteInvoiceLine(w, r, customerIdOrKey, invoiceId, lineId) + siw.Handler.BillingDeleteInvoiceLine(w, r, customerId, invoiceId, lineId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6502,12 +7111,12 @@ func (siw *ServerInterfaceWrapper) BillingUpdateInvoiceLine(w http.ResponseWrite var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6538,7 +7147,7 @@ func (siw *ServerInterfaceWrapper) BillingUpdateInvoiceLine(w http.ResponseWrite r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingUpdateInvoiceLine(w, r, customerIdOrKey, invoiceId, lineId) + siw.Handler.BillingUpdateInvoiceLine(w, r, customerId, invoiceId, lineId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6553,12 +7162,12 @@ func (siw *ServerInterfaceWrapper) BillingRecalculateInvoiceTax(w http.ResponseW var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6580,7 +7189,7 @@ func (siw *ServerInterfaceWrapper) BillingRecalculateInvoiceTax(w http.ResponseW r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingRecalculateInvoiceTax(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingRecalculateInvoiceTax(w, r, customerId, invoiceId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6595,12 +7204,12 @@ func (siw *ServerInterfaceWrapper) BillingVoidInvoice(w http.ResponseWriter, r * var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6622,7 +7231,7 @@ func (siw *ServerInterfaceWrapper) BillingVoidInvoice(w http.ResponseWriter, r * r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingVoidInvoice(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingVoidInvoice(w, r, customerId, invoiceId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6637,12 +7246,12 @@ func (siw *ServerInterfaceWrapper) BillingInvoiceWorkflowAdvance(w http.Response var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6664,7 +7273,7 @@ func (siw *ServerInterfaceWrapper) BillingInvoiceWorkflowAdvance(w http.Response r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingInvoiceWorkflowAdvance(w, r, customerIdOrKey, invoiceId) + siw.Handler.BillingInvoiceWorkflowAdvance(w, r, customerId, invoiceId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6674,17 +7283,17 @@ func (siw *ServerInterfaceWrapper) BillingInvoiceWorkflowAdvance(w http.Response handler.ServeHTTP(w, r) } -// BillingCreatePendingItemByCustomer operation middleware -func (siw *ServerInterfaceWrapper) BillingCreatePendingItemByCustomer(w http.ResponseWriter, r *http.Request) { +// BillingCreateLineByCustomer operation middleware +func (siw *ServerInterfaceWrapper) BillingCreateLineByCustomer(w http.ResponseWriter, r *http.Request) { var err error - // ------------- Path parameter "customerIdOrKey" ------------- - var customerIdOrKey string + // ------------- Path parameter "customerId" ------------- + var customerId string - err = runtime.BindStyledParameterWithOptions("simple", "customerIdOrKey", chi.URLParam(r, "customerIdOrKey"), &customerIdOrKey, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) + err = runtime.BindStyledParameterWithOptions("simple", "customerId", chi.URLParam(r, "customerId"), &customerId, runtime.BindStyledParameterOptions{ParamLocation: runtime.ParamLocationPath, Explode: false, Required: true}) if err != nil { - siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerIdOrKey", Err: err}) + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "customerId", Err: err}) return } @@ -6697,7 +7306,7 @@ func (siw *ServerInterfaceWrapper) BillingCreatePendingItemByCustomer(w http.Res r = r.WithContext(ctx) handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingCreatePendingItemByCustomer(w, r, customerIdOrKey) + siw.Handler.BillingCreateLineByCustomer(w, r, customerId) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -6731,6 +7340,14 @@ func (siw *ServerInterfaceWrapper) BillingListProfiles(w http.ResponseWriter, r return } + // ------------- Optional query parameter "expand" ------------- + + err = runtime.BindQueryParameter("form", false, false, "expand", r.URL.Query(), ¶ms.Expand) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "expand", Err: err}) + return + } + // ------------- Optional query parameter "page" ------------- err = runtime.BindQueryParameter("form", false, false, "page", r.URL.Query(), ¶ms.Page) @@ -6867,8 +7484,19 @@ func (siw *ServerInterfaceWrapper) BillingGetProfile(w http.ResponseWriter, r *h r = r.WithContext(ctx) + // Parameter object where we will unmarshal all parameters from the context + var params BillingGetProfileParams + + // ------------- Optional query parameter "expand" ------------- + + err = runtime.BindQueryParameter("form", false, false, "expand", r.URL.Query(), ¶ms.Expand) + if err != nil { + siw.ErrorHandlerFunc(w, r, &InvalidParamFormatError{ParamName: "expand", Err: err}) + return + } + handler := http.Handler(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - siw.Handler.BillingGetProfile(w, r, id) + siw.Handler.BillingGetProfile(w, r, id, params) })) for i := len(siw.HandlerMiddlewares) - 1; i >= 0; i-- { @@ -10172,49 +10800,49 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl r.Get(options.BaseURL+"/api/v1/billing/customer", wrapper.BillingListCustomerOverrides) }) r.Group(func(r chi.Router) { - r.Delete(options.BaseURL+"/api/v1/billing/customer/{customerIdOrKey}", wrapper.BillingDeleteCustomerOverride) + r.Delete(options.BaseURL+"/api/v1/billing/customer/{customerId}", wrapper.BillingDeleteCustomerOverride) }) r.Group(func(r chi.Router) { - r.Get(options.BaseURL+"/api/v1/billing/customer/{customerIdOrKey}", wrapper.BillingGetCustomerOverrideById) + r.Get(options.BaseURL+"/api/v1/billing/customer/{customerId}", wrapper.BillingGetCustomerOverrideById) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/customer/{customerIdOrKey}", wrapper.BillingUpsertCustomerOverride) + r.Post(options.BaseURL+"/api/v1/billing/customer/{customerId}", wrapper.BillingUpsertCustomerOverride) }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/api/v1/billing/invoices", wrapper.BillingListInvoices) }) r.Group(func(r chi.Router) { - r.Get(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}", wrapper.BillingListInvoicesByCustomer) + r.Get(options.BaseURL+"/api/v1/billing/invoices/{customerId}", wrapper.BillingListInvoicesByCustomer) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}", wrapper.BillingCreateInvoice) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}", wrapper.BillingCreateInvoice) }) r.Group(func(r chi.Router) { - r.Delete(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}", wrapper.BillingDeleteInvoiceByCustomerInvoiceId) + r.Delete(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}", wrapper.BillingDeleteInvoiceByCustomerInvoiceId) }) r.Group(func(r chi.Router) { - r.Get(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}", wrapper.BillingGetInvoiceByCustomerInvoiceId) + r.Get(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}", wrapper.BillingGetInvoiceByCustomerInvoiceId) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/approve", wrapper.BillingApproveInvoice) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/approve", wrapper.BillingApproveInvoice) }) r.Group(func(r chi.Router) { - r.Delete(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}", wrapper.BillingDeleteInvoiceLine) + r.Delete(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}", wrapper.BillingDeleteInvoiceLine) }) r.Group(func(r chi.Router) { - r.Put(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}", wrapper.BillingUpdateInvoiceLine) + r.Put(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}", wrapper.BillingUpdateInvoiceLine) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/tax/recalculate", wrapper.BillingRecalculateInvoiceTax) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/tax/recalculate", wrapper.BillingRecalculateInvoiceTax) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/void", wrapper.BillingVoidInvoice) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/void", wrapper.BillingVoidInvoice) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/workflow/advance", wrapper.BillingInvoiceWorkflowAdvance) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/workflow/advance", wrapper.BillingInvoiceWorkflowAdvance) }) r.Group(func(r chi.Router) { - r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerIdOrKey}/items", wrapper.BillingCreatePendingItemByCustomer) + r.Post(options.BaseURL+"/api/v1/billing/invoices/{customerId}/lines", wrapper.BillingCreateLineByCustomer) }) r.Group(func(r chi.Router) { r.Get(options.BaseURL+"/api/v1/billing/profile", wrapper.BillingListProfiles) @@ -10457,614 +11085,628 @@ func HandlerWithOptions(si ServerInterface, options ChiServerOptions) http.Handl // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+y9C3fbNroo+lewdPdZTfaWFdt5tPFds2YpttN4msQeP5qZqXJdmIQkbFMAC4C21Z78", - "97vw4UGQBCXKjzRJddacXUckgQ/Ah+/9+KOX8FnOGWFK9nb+6OVY4BlRRMC/XtEso2xywK44TchbKtWR", - "fi4H5CbHLNWvkJs84ynp7YxxJkm/R1lvp/dbQcS81+8xPCO9nZ59u9+TyZTMsP6MKjKDKf5LkHFvp/f/", - "PCnheGJek0+q0++bUT71e4qqTI/7YYoVyrFQEvExUlOCMioV4oXKC4UUR2ZiRBk8oGwie/2emuf6YywE", - "nvc+feq3r5JKWZB0OFZEdF1q+Em4XnKDZzkAvb25/XRjc2tjc+t0c2sH/jfY3Nz6T6/fG3Mxw6q300ux", - "IhuKzkivXOxrmiki0MUcUQMoSgTBinKG3JtmYVIJyiZdVvaKjLkgqy3NfvMFr00qrApJZNd1+ffviJ8n", - "ME6In+WyNG66pZn5Yoi4W0jFZ0QcXhEhaEoORUrEqzn8h7LJgOs/NFApkYmgud6g3k7vdEoQPEIpFSTR", - "vw56/U5rNyOGC1+03hMuFADTHdpX80XwXszRmJIsXQncV/POANsDaoEUVrHP4LRmhKkve7uXAfrn7nQT", - "OgD6NcGqEF84Ii8C8s/d1SpkAOyPAn/pmNoO4p+7myFcAKgl3F/2bi4C8ougrlUAAea3dEbV4XgsiRpk", - "+u8mmO+L2QURWm4DVqulNUFUIdhgxEZsj4xxkSlEJdra3Oy6ADNVCH5qxuntbG1u9nszfENnxQz+pf9J", - "mf2n58WUKTKxGx8ugsN/Oq1CXtK8vobOK7DzRJcQQrwZhfg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9CVQP5F5pWKeIBMsUhNITK4oL2Sph2kwc65MCQUQY0KZ39q85uiaCM1ThYCk", - "oxiFWTVxOd4jpxbmEGVFsGfeYHR3odEGEsENtKIjjD5fLDoaCfa2Cz41X4dwWF0ClJ0sq1nW9Nt9a24H", - "uPANkaEt+HElgn8FQKx76B4DpTR5ea1vPPxbWuphhzee3qrzTZEE1M5xRm2N8duL0LcNP77NIbpondYw", - "nYY8U88BcNUULI26Rfp6YDkN7KlehfN4Wklv99TL0iSLeVVTNLkxBV9qgiB3ld6XqPun/n7UfCLplZbY", - "7+aegMFdoALOIKnTRChQhuwMRrk0uU93muzEOCz0pfTG94xckcxmVslQ13moqUpdyoTk3FMIkqm3k82b", - "sUiMXw8s19Sk8R7PK5jEyCrYU1ugapon8UJleG4oreAFS1eK64uBcGxHCaCouIgcflOGEi0ZleE2wCPN", - "LtiPpS3a8FtBFXHNOYArze7t/EvrtCxm0kbM3uMp6GuNb9q2YWAntM7l9G4TH4yNqVx6lzPkAytb9ymI", - "bMI33qfsk1GFh0e/c78brPcWzSgrZMW5J/soz+xv9pKbUlQQaoNvSnA+UDU9vevB/CiMuAjHY65Eltnb", - "AJEEIL23RixotHO7UwOrvL91PJClodcUFtY8AIqVmO2pOHNrPogO1t56JCZUI8EiNawspWpDqx4dTKwN", - "JtvkKIXiw5KrVIWXUvCgQVaml2K8hu84dSzs2yOPkd3D7/TcjuG4K8TIjbKi6997zdKD/R5YSs6Uib+J", - "FJ0oG0LOfeEG+MYJxAVTNDPXRy/HZRJWgKFSY7M++jTw3jvrC5nlan5Hi0nD3FcQ3xO1bIhx9P1erx+N", - "RoHgPoPuZXyfJ8M+brOE8GhrLwTm4OTwhxfgF1rifA/wY0H4u3MkV0Ftug1txxYgzaVSEDfFGHXdVrez", - "sbUZltLbw4EIaYikURmtemgLIYKIbEqNZnBai4LGCkbVORDL1ZzfHSPGnKxzCzPXrk1AD/wCZrCq1ZZK", - "2I6YdnlrS7KefrEZuSsIMWvx1xfbVJaRW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SsOHSUg9LB5XPh23eQCKLW4aiGt17tpB6TvDEA7", - "rs1FIO/hVeSeFpHPl9uptHHyfTguHDh/R4/IYDJAW5ub/wcKbUpTisPlRAn34uNYa303c9/tY7eDbbHU", - "H5PfCiLBYKDnDJIIHv7YmtUizBQ+ONQqUXVsqoT4LP3CNd93fQ5jHk8iAqLnG4R7846ZJOzk7VR228r7", - "V/PGr41kEcVNPWQH+irBuLWNK9sg93usyDJTrsnGbNSCb8tUm+Yem2ewNr1NrvxdGGgZ7O/it5cn4yTW", - "omkhqh9FR9wt8SYM7qQyMaVm3HX2f50zcqPOk3lSrYgTHXIpIaMWk2p1BRbFf7YdXeNAWl5shSlQ7CMg", - "mdgse04PQXcjNLf9ElJbukH/9+Brztk5dUz6YE+v0dGHpchvF96FUH8ITKE1m7AzZUY9IYFdct1EfN1E", - "fN1E/C/YAfiv1f66AxENI2SaGF8+rCTQVopxYyjDh9ICHDGJoxCcZfNSwbVf2/LYmKFhnpvUGXN/gL+Z", - "niY4zxeJC02KO8zohDnMqi4g8lLgQfJH7Op6e7lWBomClm5DEpziIxZvuyKLi3LisN1HSfWxh3OV1b0j", - "asrTRUszbwTrau9LU67lES4Un2FFE3QlrXX9cegxAwXr3L+lRYtevycJSyvdopvLnBmAV1njgkKG4dne", - "kTOXeGIUKleOr3J0/aibmbuda0MXk5rHKrVCIX3yCme14n+nW2+i1f/c6ybQy0JtVYguM96yLKBPV3Sy", - "UyinVFEqvgsGHCivwpq6TivhafKVVnHOFWVuhMVZ9A7pfQdxr1Ec0x6NocON4weKpfc6vAqmb0C17qVv", - "MgCFKW2i0FSLNVhW+wHXC1+WaWMBnmwtLBJZKz9qbSaXJFdaz6mUxtSvmguOTEMoeTtk+bLKWTbwto4O", - "HXCwLlG0YmDtxTomRiWPlRSPksrfkcjZgaoULkrMo5tYX0lsE3enJLnkhTohUlLOdsHGfUpuFODGSXEx", - "o+oICxxrfXsCzSxQbYiBsZOfK3Kjmte1HLXJH2ZESmuOjKBIHXI5pVAb1JUUuOtw9wIUJJQejk9MVath", - "kpBcOdp0+3E/LT+4s4N3PGZnaTmjgp7POGjyTkYgswuSplDCZsqlamkPt5tRwtQwzyEN85jInDNJYtZV", - "86T06SfwJUiXjw5zonEbXCnJJWHpY03yIEkT3j0cFmq6jTQSN405hWipK3x2/DY6DC7UlAvXqgVCVSYC", - "M+XHXyyS6/lisveujSM7EvwiI7NwL7pd+zNmmmyTtD5E3EYsrMU6CWucuUZgqaa/wNl8gFvpZTLtEgwP", - "8UEmSpMRVY17bK4RYmh2o6j1y8HJIXq69eLFxlaZInx9fT2gkkN+MJV8A57bUJwNvfdyMFWz7DHCWT7F", - "G9suTMfUcRpZAoTUNd/IiNapKy8YHwHOJIfIQy6UDfdPOLsijBJWF57OTmrxlZVorO1GNNbHP7bj9cOM", - "X9Fcp9ptsq6EiFgP3yB7BxP7FZLmM3egg1i4f8xueFDtW96vxPbaSfT9cs1HqFbB5n9CrbVKy8NOFQB2", - "7RcH6dKUf/dqrEiX2Rl9B5yv1lguC0lMyw/T0BSVBCioNWiiDesDmMsA8rI5TYwYuQ66kX3q92zA4goN", - "JZci06EdsrlI+8QKohowe/SgAfukElPav4pxJtzJzFpueBvPCPZw4P0/vml+sIWwGGk3pv4xFyNWSBsH", - "1tz372Qdg8Npl9tLyp4w7hCitLrzfq96h92sDWlQc/3s7PhthMH3e4YZHjuzy8Fe/K2gUWn39qTu+mkh", - "bumX3aW/eiy+j2k7ilRZadStCc7CSqVGtvV14rx/sG2AwMWnCsHadlYWSUKkbHtcUCcmrbAtVraKi2GL", - "MEvanIxFGOU+QieeKxgpYLAYp2pjwiMtAg0WEeTYbT+N3kt7+z4z45itFK0c3fV3LlS5ukr984gNs2s8", - "l+hXaLv3K0gOrg9QBa3qwqx+1Lq5lhS07W2DZETpmh5GFfkBU4SpzkPBN2BsYqp13KX0Xg/difjWr1eN", - "bZhnrfsUFdyd0O7MnE2W1ZUFgMOxsdjweOp7bECyWBdlGyFhjWybIMRJqVoYfra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Gp144yziaRpIxvLiC8W3ZBMCMOCcnTty+W7yojYlIjVf1pmZsobagnSmBioLPtcIS3C", - "afkzMB270TTLbQOnFBDLoWxL3xE71aJUMKAR1NR3EpQb0Gx8+WnXqdfsMEbXeG7TA0EdITiZWn1Es0pg", - "Qn17poZTW2s31DCrtGa2q60uFRLubXtev2WySKblFsCOzojRr1ytyZGVmEa9Pho1tTv9sxY6R03df9Rz", - "CV7Y7K0TkQe9pWYbV5qEUUWdYI+86NbQiGr4d1RRkOxl2mpem7KRsZnAi+5Ob3AlLH2oxSpSsG8RLQs3", - "gTlac6pei4sJzBmWquUqVayPYCo1401xnhN2VwNkh8hZLAtBQN55LfhsAYAg0hrN3dx4rdyZz9MBqjee", - "06KpMyP6zoYg9Ia3zxsa9QwPvtQ/IcwNataLK3KoVdoJGYZosITHwTIMKTAf6w1346XepgJbb8YopXIT", - "V6jxSHG0WS1FYwbwg7pxopzgG4hxdkFh6xjn1VxDb8iy2OaI+vJAwc4hBY3qaBFCVt2ZblaAzuHSwrb4", - "aNoI1uHS33q49FpXWesqa11lrat8o7pKTCPoKi7XvmxKFeHCP5dSsRb9byX6ryRHfy0JOisJhYciJeJV", - "RKKBB5rP2bYS9TQXGXapjAu/sV0Mpv4Kqq2F1aTWFdY+R4W1ZvGmSD1Gk8O0pKIC8P/4Ov9xcvge5VhI", - "8LibN2O6H4IesyY8ikpT5d5IBPpGQo+bKUkuNS8PabP1fULhbWVbIDlvqhNL9DeaTWxMBAZfp/3Iyy/W", - "vmCJbb90oxqBZs4Lgfg1sy7UAXqDpW3WiFms6H3vDzQyx2WEHTnq7aBfRr0JVdPiYtT7iD6FDPh/ZbyU", - "9drvuS5UsfZzrv2c60IV927EtZm5axvuZ69TYUSFhy9YEUmp7lCvointrIWdzyPsrM3a6yog918FZBGd", - "/3psDJbkLKF4p3btNSDaCy7WLTF9b67pt25cv3ezMeEbi2wNP2uyFsmeqce9guLLBUBXdiK05GqGGZ54", - "YknmrhZzGes6doWXgW7bCto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SW7aZ3s1kJY3h7soUdnTIukEsI5LCF6S25owicC51OawIMTLkzHwZJGPR58/ur80Qu8GyBF", - "vQjn18dVNW5BoRBX0ts0da2f+sXc97FEBwrN8Nzx45IJX8yhn4JAl2T+gGgwYnfqolpWfQDPK4yiyCzn", - "AmtFiWeFshUKgGsIZbodA9SYpegnPbU1QWnWJ3OSmBvKUzIh7F76Ef/fB8DbBTLMmtevef2SIC0Vgu1Z", - "xm1Y4c/O01LHNocoJowKONqsyBTN3akKiJeY5yRSRvf2IRGtMHYIk/C7UkX+92fvXu0fV9xK1TFg/MWD", - "tPV3qTuvrEdpWeeXq/CtWx/bcguQYWaGPl40aIAmln6WEIGP9o9396EMl927jy1em+aYKobMUTvzERGJ", - "8bC9N5v0MbLue8jEXS4A3kc+bin3rZSMq4H74lIvNVBfmSG9Gou1tqM/pB3dtuBtMkZbDCvom4oZwuKC", - "KpDmckESCgWnytrlgfg1Gm38/Rcjf41GA/PX479HJarDYaGm20PbKtZYQnlKoDcZ9PCJU0bzmW8xa68Q", - "T11TQdOEyLM0f6EYRM+fWyqgrxLzbWrT8ySjhoxh8Judp4RREKwK5vnkubsh5/ZiujFBvu/1e6Y8wzlA", - "oFdsRWCazc8L5luBRG+upaNRRG8cSdCLPy+/63AO/yd6EEe+Q2Sj0r5p9+h6yUP9ci2wE9uEqikzxGsP", - "mRnsAO7DBy4eZOcMQa3PuH1P9Ups+XnFo1ftaIolkavxhzzDDOXwYYjE1Rb7wQlmOBJqoX+VLirCqmTQ", - "ZEXPIIsL/6781jKUNUVN5t0ljV37haY/tebgZyd70a7gbhJDelwEXIZZNV3KQvItuTkW1ej0lpBIqU5v", - "LkDvTHMKtLW5/axWZjFQ8/XTEK6wr0iziOd4TKBrcbxdRLN9nt9muGoXJOEzIpEfZoA+6BcYV07AJmm/", - "fB9MHKnA4ztGwnit1s1raWQaC/QIl3nKV18kVP1BGWcTIlZZqX8VUWbsWopk8/teuCbUbcteNcA62obh", - "89RDt+s62IutAxo4xdr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8BDwEPA89CAx8PAImNBl6bGGlD4i7Fu/k5s", - "LIpuqCRJRpKMJBlJss2WZF7u1F+qtB/i7qP0qvPJczLlZnzwMG9XzG0723lRSQ51JEpJlJIoJVFKonQF", - "UTq3LWx/xb8H8SHeL7gwoJSLdlkvb93vQd4uP0yeKnnhqfKQX/wiVN8OGrvPvm82hlKFf25DQRY+psZu", - "43//5Fv/6Ww9//Lfj/5n96/iH4//v//6///3z87WD1/+7Gw939v6+V9v373/sHXyaesz3xr8+2yo0i17", - "vvWfL193nv7zXxV2ZxSPiEQviV4SvSR6SfReYRe7yE8MUrmLW7C/krxf7R+2CcK1c4ebZNr0kuQlyUtR", - "ZAg9CD02Z9ffdtdb1B0RYywWzyjwhWG04BarfjyHLZjsAYLLCkZb8McFsoFvsLHeK1av+cJIqliPVr36", - "Y+7FEzkUn7Va9+VwHcua/YFXxrzJdJ6+GK/5bj+8dePoiOUVsQubDSsubDsy59PZzE4Mok2iTaJNok2i", - "TaJNos0K2gw3wy22SSyuInQ+EjWHToWF4nHIlLRjl7kYj6CFoIWghQ6nSGZvuMxW2speqG004EqJZIW7", - "hMuvsfBatbh+X0q6HwpYcjnuzDWt1cUxqSYNnbp1dvq+1p9AyP99O1e91jRDGpiwl26Hf/0nLHjdlviX", - "7++ttRUT6NIXy66a103rmyrqUXFBLGEaYRphGmEaYdomYJrJh0OejQNmVbJCY0JzZREyfyfWUi8aJUaV", - "RdQ51lRIrBtys6koyVXhji66qmo5eeKQKCdRTqKcRDmJ8oWifCJvK2TtytJ8mcKm/dX/35JL4o91z3ql", - "SmWFWHfMZIxKiEMV1VUbpkbQzEhbuoQdPnR8XOctVA0Ryw9witYtPLzxoa4bu43O9ptnTz//8PTp3uvf", - "9t7+/Gp75/0fnf1fn7/+uTF9jENuQsQFxAVkPkLmIwRGBEa3CUaFe/GVwGihm9UCwqnytnrYcNL5ZvQh", - "pN8gjiGOIY4hjiGOuf8cA6hxRYRJ8wqE+ZjGvEZLM08vLvGDA5hv9WyJWIpYiliKWIpYiliKWOr6WMoz", - "zw0dluEUW9e22b203LL5lct8iV0zXlLGoJFbVg4Fk4odvd5nT548eQ5rwZDb1qlCq2Ejz9G5vsqyF73L", - "q9Fsp7PzZKuzvdXZPuls7+J/rU5n+3Oj2XD5N3YbRfHVXu7TNX6l4ivX1+rbqu1r9DP31+4P88TKNBGs", - "J7jNM8FkbOATOxNjM21n7RP85P9ubZ/mnc7Os9nHO3/XDYhLMNXKlV2xVmyE94+rb4RP8JP/Gxox+7i2", - "EcGz/yYbkeUJDsN0zeHpT53tf/34r53f//i88/7pby/+eNt5/url59cvjj+/c+2YJPr+6PtPn3/e/rHz", - "9ujtr8+evH+x82nvaV2r4LXqJs1st345eMkefVTyXGSGJ8mYfVTy/3LBfhEXMtL9jKcDGeEPxzqzuMAf", - "IFz1pMget9Ao/xY3SJcdgeIIf3YQ/A+hi3//+Ycffvz9Refps38dd3788cP+HyduHKbTHW8fbb95/urT", - "+2c7R292nuw9f/fsX3VDMVnHN2I0vkn/CRRT1+I9UZ/TbfpOYC3Ic4K20LSFJnNL2kGS58Sc54QIG7Pr", - "2Dy2v+Jfb2W5qukBvrOi4QEKtJW09r4mC3X2d2UW4FpBUpikMElhUmSTIpswZMONAoQX61eDkCxPxLoK", - "bHxnuf76CLO+SlgOLOi+x+RYsRF3EpBjTVV3+5b13NerwTtVe+xMjGE94ix3rzqMLQgrNw6upHtt7Bxo", - "HQxAs08OXx7uOg8bzGWyThmd5G7N1szkaaozy7raDhjWmquYvYWiFa53hg8FM6mIUMhFOhZ9oeCDuttY", - "cZdVALvpzqNph656bfDe0ecn71++enty/On7o6PXr3999vzN09d7nyq0wTt/PP39+/fv3/x6/GRn//WP", - "2789f/rqyaW0wfdVvQqr6LVoV2szuk3lKlSCdKu0q6NdHelWaVNDutU53WrmNw03FZIG8l8lHs2RO+S/", - "aYNhKOabiUSDbaYwNCS7SXaT7CbZTbL7EmFovHHcNSgl21/hz2Wjz6BZ4OLQM85y8DriznhYWH7A6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HhFc60hv6GSsXF3ASExcnDhXkTTc2rLhiycYvse0MFnpj4", + "WKTMJ/HjYuMOBl+dQw8TDFe5ROC1KOVNXlxkUWHTLNRQM6CzMNRSw7J5S0vRspWmG0JpYv0soGOTyuHp", + "813BXSe1BjwHXb++2bG77rKkQHB+Sxk5Bg4ac/yaOwBak8nQgziBnBgBVCtKhtJXzjujrMaAu2cVaHDC", + "lDqQfoyEj/S4hgfFkunCXTEQdFq7tJSjufrmOy600d2jyrbMMCtwFgA5uPONMRBpuaO+RTCr4nar7mJ7", + "Uqrec0UOBZ1QhjMLxbEGtytNtYP9SBgRNNnjSaGvtx5C09QapzV5tJFj+OX49e7Tp09ffoSAULnz5Ini", + "PJMDStQYYkKnapY9EeNEv/TYenQ1upQeXxsHQBk6O91tqLA3ymA90PAOQdYwipkPc9V/pHatoD+bpUW1", + "Beat/CvtqD0M6yPQm+nAenRCBMXZY1T6jg3CWoko9aANQm3FcdsEzv2c8ZScc3vy51Zyj3LeQmT6e79V", + "JhDH6/WUfXKmYav6ltMvE1SsSqNnWISptVTPyDW2b7gw4QRdcfFpnPErxO1Hkat6UXGAtfA/847m+Pol", + "Y0FzY4LdW0qeUBM/QtXUhBmMnZRwSVMXsuxU9fqIVKJkyiVhWn7Fl5hmWpz84iJkf21x/wos7g/fitfv", + "uau3YiL3B/uZv+V1YtFmBPTzrUBCDtvc74fO9c7hF2n4f8W5bekojStAy1a180fd0WUsJNaMthKPcIPv", + "+iFOiDIlMUKGAfKVfwVJ+461k1PpieWaCnwdVOBb8XAZqWIlH1cNsw/cCK2I7edYgtf+PRc70NV4u2BG", + "nOfGMBWd0Rnbb7p2azNtXbmz+S9et33r1qt2sy1es8LXt55J4esls3xzvq421gY+MLunNRSunGwHzldn", + "REbP/OrZ0ddEQr6GC/25/aRD5XtVEBcaA0I4g0m05uJSQswlBONm3TIPrlO9uV5hfmS1zRbbZGM1p7fV", + "YN2QBdmL4jyeOf9It017X8yIoEllY97wKzQrkin4GaQ19eaY+lA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7NjN1lWVxZwYDoa1BYbHk99jw1IFuuibCMkrJFtE4Q4KVULw8+2", + "t75vl4T10w1H0iuisK/0W5OBw/Er79xEDN6rysFPK3Lw04gc/LRFDg5ku7rPtCY0VUD4I/R1L/KgkWsN", + "hzGlN3FXH/f5deX/nA93MYkymRG94e67fXTAkkHFg7YQoELr6UOlBL0onG1LFrDCn8gcorhn83P7y/kn", + "Mu99/Py5TrutaTAwVnTMl3UF9qIqoTM42sp6TrULhNqzsNIcZmlpsAojnKyxCQXl/P7L++DV2GulFnd8", + "g+1Z9BfvtBtpXZ3mvnOyQjrSFQnMqe7bL99hMDBG8MG9gWbmlTJOstQLg6pd7m07oFwXz/nvLKIt6AyL", + "+f4M0xYTpn0DEf1KK1XvVUpYwwdmzCVdxJskJuwlHhvevdP7JjtmxVn7arTirD5CRPUwtx6Ms/ZFotEb", + "2tcDBPWGF8EJwPioMsENaus01hmXduPkr3G83ahfVf65sRYyYuH+ea25JmmOwI7jkpwK6YfC0kUpJDbn", + "E/J2BpUKhJUh487nts2KrWSJyaimY9VKcHwDPSyaCLoI3d7SmOl8iHKN+HysyUaRqUgujTcZReJrbNiM", + "ddab2o+dcg5K63KlovXm5mbTEpVb/12EjmvYTeXmQIHVevrEDK1fOKG/t3xuvoSqsbGFzIyw5MCaUWb/", + "GZsJknB2Xaf65lwmSac2YwzoehKOSb/xC6nM5DZ70bm7EP8jPKFMU6p2b6J/xRvHbowMzhW2ElJY9agO", + "ecw62Y4TC8Hw93NrdWzpOHCAwSugR7fBn8cGr1ezCdGjiT3LEeYswqxvy2kHI3bIAoaTYGaKr8+KTNE8", + "I8jq9bI/YheFQlpgsj/By1CL3fTRgRwItpAJhlaD2G67yUzuJRh53DoaXbEq2NsUy8Nq/NES6CcBMHU8", + "rpfbDV6NndA+g0F9gEsnl1/w0TtzREtdf8EnJwormqzyxSsXg9fU5sqXkCKzPDPuLFFGQJscXNh+Ur4M", + "kjlGeYbZYMReE6wKYT/kMwqlk334A4nM0dfSiZq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z3GGF/jP8NowSoEwqnGVhiPAEM/q7IZojNmIBbHok", + "62cj11SCJmWzsCQ3qTwp1yoluVaEGVPdsfPWgXe2JkIkOMcXNKOGNvxSX/IJtBdCp/i67LgjkcLXKOdC", + "BUHv1Nx3UF2M6910Jjr3n50rfO28kju9XfezHrukeP5t/as+0Sg4bjLkpBLbNictSKDbV8Cwn5z7L0pQ", + "LKlCu8Ejf1HhUfmkFSRrK5Yo4ZnpWMMLJRVmqSbvQPoLa1K3XzhIvpO+MpwzOM+Imhq9uLqVZuhzN1ew", + "m+YJOiqfuA01T/yDJi/ze6psYUDTSESiOS80StoRyhUGiwCukHB2JrLeTu8JnWld+IkBd5BDsqqF0Lxf", + "FQFy0pTkqvgY7UaX599JFL7XmTcN83zXfTePsabKbO2TB78PosGgbkvah9CvoLPjt4NFYQFtHzNb97A1", + "YaGbxDPMc8hYbvHGwFS+5X3ETWEVh/DTcu396lHGuFaT5ur/idHd3FqQBDCNSCRUV5FmJVEmwhNMC70D", + "8/XWZsDTO4g3sIqyTeKqQkyZRxBdki8eacBa3O9pmUxjLHe1GWNA1y1vDaGlItO0SzDvllatt29YVX5s", + "CkKXssMqZSyPTI3EZRJD/TMIOzTSQnzAnSZzsLZzWwDT+LKMvS+w8e2eHR/vvz89P9o/PjjcOz85HR6f", + "9vq994cf4un/+ruNSyz0BZQwgJE6jQXXmTDf86teDNjTaDLWL8evd58+ffry46OpUrncefJEcZ7JASVq", + "POBi8mSqZtkTMU70S49tcqRWM7wi6cKvKENnp7t3rJG+CwMDbxaXd0LgKD6R+YbJ28oxhXA8N7aTyFzc", + "GKieqJwNUWaABSZ5wQvVFlH2R0/LX1ozhZaMm1svt55tJ8kG3tx6sfH9yxd444etracbW/jls+0xSdLt", + "F2nAjqJpWDOc/2JW9rGyK0REBVUIO4PYOFeWBpeqaGprtk75FXQ+xQqSK1OEJxNBJloqM17R2qLcY7uf", + "Z+8abvPhATqFaMMza3mHcU4rxqB+z0YghhGDfxmYv/wm/GVgWI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jzbqCBEIEQgRCBEIEQt5DE4J/htrg+y/", + "QRq9ZdlME25vZFUCj6Lttv3hJsbb91yjVFNN37szK7sGJQ9alSNzIHPguRueuyF0IXRd36ocuKbnoh3c", + "xL58js7GWYcjBK0Zgjp3rMlBzQxSElISUhJSElLSAzHIXhaRZppmz6aksXU2gtLqQWmNh213ZzuOiIaI", + "hoiGiIaIhoi2wQbkKzs5tGEQ6oOOfrQJZgYDd2kwZBMeriGTIJMgkyCTIJNsEJN4Rrghi6RiLo188klm", + "8kieCokEiQSJBIkEiQSJBIlkk7QkOScszSQy0TRqO//jb/D3NEr739vWYbzO4/438yuB5PAxBlKodMgS", + "YjNskTMjjJkIY8mFFVCmhkGUEXYVS+UH2r+nWmT1WU6REhTxEbJ7b8pZCJbyPrn1Y635DuPQCmhVy3z9", + "jeVe0XLJF0ZchHK0qDP81ItnfMi+SLHsyz2Ib/AmkWm8ny35bt+/tU5bqnF5J+C/Bl+nZle6HajLcjaT", + "Q4znekisSKxIrEisSKwbQKwsSBOuM0Aty2Fn8oKJvdSA0l9fjWw/iGQaVv32tYC18HMlyWrzzpxIUTZN", + "TXSocckV9lnsKo5kyBq7PRopVh1aKeJDrkvBlfLR2XkGIZH4MB02drc7HeBE968c/8xc6LNkBfbfeVCn", + "mVZG4wZXBFdCPkE+QT5Bp30UzxsgnqfE69wb8yd0NFay1ob0KUiaNRnsFmXZLRvrThaNYhPFJopNFJso", + "NjdObNbtSttubaM2Rk21bD3K06hq8apINyNHr6Cz0+6/WaCnBe44k4n97HWlbpyYAjS3gpOHs+pNaKm+", + "trqtqki+rv6zM4uiieabhZAW2z51buKfSJv9QiiABico51HOo5xHOY9yfnk576TRHMWzT1Wtej71edyG", + "2tcVhipflGko01CmoUzbbJmWy556pe+nWLFEq8LWi1i9rjJ9l8Z2y+p/Oxfn4qgHve8ekVAyJX7S1pah", + "aWYb9GmX+RjgralXrNlDKW1ME7OmmKGGIkMy4noAb8WJvOQhC0mPsyhUVQE4TBO86Lv+bngZCWvLrJaz", + "q1VPo9xHuY9yH+U+yn2U+9eQ+xW72fY3939H4XGyYJB1L7pzJfUFy+oCp48l8Xwz/HJNZtrio3chCkgU", + "kCggUUCigFzpxrg2PPZiQu8N03cm8VZn6ZTvIHHHiAIRBSI6L6HzEhIBbpnrtsxts7LpiA1N3ebfYF9M", + "PWHpRA5lQoIBCy7MdCskJDQwkqtptp8wiO1LGqWs4CsvlGY0nHns/LpYzTXjSXMxTyougigNmdUVhNUu", + "Ve51V0JXyohRcVu+U4U+Q4U64hHiEeoLkA42mw6KYnTx29GPYyYgigisE3qQMEaMNFFE9kpIsGsD5LCw", + "SZysa8Lt2sqQetAiZjTNi8QZbGckNOmHXDC7dMOP5UztW/DJRpmZqz1GdZrYO7rt+m36j2puJkR+2l4E", + "EMhVxSzgPbOucVGaLW65p77upVcFY6EiNC+UKiUDPj7Yd289BouCLbJvW13mpJD1uGCuE8Y5OSoypZPz", + "xoH5eBUjp6fHEyvseaNlsj61r5dyjpgmmUxJTJUiNJKib73eeryfWo4yszpipJ9QYYTPZKmflP36ucrr", + "Bc36g/xJFNPmFXXeII9MAeOesyU8hmq9n+40RQb0kpEhFRk0KaCKqaZdc1ymJI1JamTmVpeajG21zHDy", + "YWxzManMwEbsCmQMN/JXGe5pEfLaxn/chbkRpErLoeUCKHC70+l0yN6RN8kP08QvclCoAQAuQzPRJqYK", + "DOMe6fNLJnK1mclWiiizzTJbRhqAZH8kpNhyt+8+Lk2bmCW+Q9+yrEWOejBOOskgBpR3UBRsVHrNEvX4", + "Rbty0yhhNMxgwlPhCy+81yzNZ1jBepRHfoY+7by0i0LhUuHSFIWl1V10b6rp+GooQ97LCNdN23zbUpCG", + "1S6UReC8DRXi6l00Cy2wTToScarVYvYw2+uoxlKkDoutnVa5FsQkAKzzI2xmkfk5jTSSPZI9kr1pwcuV", + "t+BAil7EA73keAUyjUI3Yk7+mY82R9rAZTsmHa8VNXzBvEyrGifcv+D+5d4HE/XBHUoA01h0h7O0SrT9", + "r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i7yyq0SuHI6o0t7f7Q0zz5NUWFdT", + "l8KMSBpRO0Ws4VAhviD0qBmEqiNus7av6Yh7qoNei3DF3SPkyN5iaCSzkCPTdEH6q+4kLW+ri+yHrPh/", + "WE1V7Cd1ahPUT9ZZ0uL3cRYVNYCQlnzI/mN4Bqxg4BghoFGQRlR7+W/roVozq3nGh+yLFKw6cEnj09nB", + "LVtG+HXSeYH6lQc3eLjBww0ebvBwg4cbPNzgrW6DB9AKLneVgVhsuIYhTS6sqFIeoK3vTym0ccUOz8b8", + "EFxzMCOweyYffaJF9vRkpi4rmy9X4GsWEpnanNy2BsxsZWTmA4SrKFra8mQ6ukWLHGkyArNhncUuxEqX", + "GfEYFG/L9l1Iuu4jc7UBlzkwKHYVmyhQpd28z2Cv98lX38X6cEXa/avppqo4LZO5FvvWH8cXDaFpFMkR", + "LPw2iEheALfxN0QGkOhsNEJpGqRkcV9JRTCwMXV0dSxAv+3lPQhKXhXoAiZIYZJC0+/lKcXqffwq+2aJ", + "KBdow4GYjJiMmIyYjJiMmHwTTP7ebCgWpAnXmcERAxAHkUzDM3nBxF6qB43dv77mTw+kvOAsf/zVvGxG", + "yqJMuYrwQqPZSJOosdsYaB2r3XZbxkxYdWUAv0/r8N7JgEZT723v/NzqtDqt7d0XL168aJiiXQu/ecr5", + "KBNNI8jRPdmLY1X89wepec8v4xN9UUg2q8sKyQ7cTSelIvbd51X/2seIziwcDleKT95bWCw8ecW6ab/4", + "IL9n8PvX7/8vAAD//7PiJK/xVAYA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/client/go/client.gen.go b/api/client/go/client.gen.go index ffa5ab6ef..622fcbf91 100644 --- a/api/client/go/client.gen.go +++ b/api/client/go/client.gen.go @@ -62,6 +62,21 @@ const ( CreditNodeOriginalInvoice BillingDocumentRefType = "credit_node_original_invoice" ) +// Defines values for BillingFlatFeeLineType. +const ( + BillingFlatFeeLineTypeFlatFee BillingFlatFeeLineType = "flat_fee" +) + +// Defines values for BillingFlatFeeLineCreateItemType. +const ( + BillingFlatFeeLineCreateItemTypeFlatFee BillingFlatFeeLineCreateItemType = "flat_fee" +) + +// Defines values for BillingFlatFeeLineCreateOrUpdateType. +const ( + BillingFlatFeeLineCreateOrUpdateTypeFlatFee BillingFlatFeeLineCreateOrUpdateType = "flat_fee" +) + // Defines values for BillingInvoiceExpand. const ( BillingInvoiceExpandAsterisk BillingInvoiceExpand = "*" @@ -92,13 +107,30 @@ const ( // Defines values for BillingInvoiceType. const ( - CreditNote BillingInvoiceType = "credit-note" + CreditNote BillingInvoiceType = "credit_note" Standard BillingInvoiceType = "standard" ) // Defines values for BillingLineTypes. const ( - BillingLineTypesUnitPrice BillingLineTypes = "unit_price" + BillingLineTypesFlatFee BillingLineTypes = "flat_fee" + BillingLineTypesManualFee BillingLineTypes = "manual_fee" + BillingLineTypesUsageBased BillingLineTypes = "usage_based" +) + +// Defines values for BillingManualFeeLineType. +const ( + BillingManualFeeLineTypeManualFee BillingManualFeeLineType = "manual_fee" +) + +// Defines values for BillingManualFeeLineCreateItemType. +const ( + BillingManualFeeLineCreateItemTypeManualFee BillingManualFeeLineCreateItemType = "manual_fee" +) + +// Defines values for BillingManualFeeLineCreateOrUpdateType. +const ( + ManualFee BillingManualFeeLineCreateOrUpdateType = "manual_fee" ) // Defines values for BillingPaymentTermType. @@ -121,11 +153,11 @@ const ( Inclusive BillingTaxBehavior = "inclusive" ) -// Defines values for BillingVoidInvoiceItemAction. +// Defines values for BillingVoidInvoiceLineAction. const ( - BillingVoidInvoiceItemActionDiscard BillingVoidInvoiceItemAction = "discard" - BillingVoidInvoiceItemActionPending BillingVoidInvoiceItemAction = "pending" - BillingVoidInvoiceItemActionPendingNextCycle BillingVoidInvoiceItemAction = "pending_next_cycle" + BillingVoidInvoiceLineActionDiscard BillingVoidInvoiceLineAction = "discard" + BillingVoidInvoiceLineActionPending BillingVoidInvoiceLineAction = "pending" + BillingVoidInvoiceLineActionPendingNextCycle BillingVoidInvoiceLineAction = "pending_next_cycle" ) // Defines values for BillingWorkflowCollectionAlignment. @@ -535,10 +567,14 @@ type BalanceHistoryWindow struct { Usage *float64 `json:"usage,omitempty"` } -// BillingCreatePendingItemResponse Response for creating a pending charge -type BillingCreatePendingItemResponse struct { - Invoice BillingInvoiceSummary `json:"invoice"` - Item BillingInvoiceLine `json:"item"` +// BillingCreateLineResult Response for creating a pending charge +type BillingCreateLineResult struct { + Lines []BillingInvoiceLine `json:"lines"` +} + +// BillingCreateLinesRequest CreateLinesRequest is the request for creating manual line items. +type BillingCreateLinesRequest struct { + Lines []BillingInvoiceLineCreateItem `json:"lines"` } // BillingCreditNoteOriginalInvoiceRef Omitted fields: @@ -614,6 +650,113 @@ type BillingDueDate struct { Percent *Percentage `json:"percent,omitempty"` } +// BillingFlatFeeLine BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. +// +// This object represents an item added via subscriptions. +type BillingFlatFeeLine struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + + // CreatedAt Timestamp of when the resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + Currency CurrencyCode `json:"currency"` + + // DeletedAt Timestamp of when the resource was permanently deleted. + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Taxes *[]BillingTaxItem `json:"taxes,omitempty"` + Total *Numeric `json:"total,omitempty"` + Type BillingFlatFeeLineType `json:"type"` + + // UpdatedAt Timestamp of when the resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// BillingFlatFeeLineType defines model for BillingFlatFeeLine.Type. +type BillingFlatFeeLineType string + +// BillingFlatFeeLineCreateItem BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. +// +// This object represents an item added via subscriptions. +type BillingFlatFeeLineCreateItem struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingFlatFeeLineCreateItemType `json:"type"` +} + +// BillingFlatFeeLineCreateItemType defines model for BillingFlatFeeLineCreateItem.Type. +type BillingFlatFeeLineCreateItemType string + +// BillingFlatFeeLineCreateOrUpdate BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. +// +// This object represents an item added via subscriptions. +type BillingFlatFeeLineCreateOrUpdate struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + Item RateCardFlatFee `json:"item"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingFlatFeeLineCreateOrUpdateType `json:"type"` +} + +// BillingFlatFeeLineCreateOrUpdateType defines model for BillingFlatFeeLineCreateOrUpdate.Type. +type BillingFlatFeeLineCreateOrUpdateType string + // BillingGenericDocumentRef Omitted fields: // period: Tax period in which the referred document had an effect required by some tax regimes and formats. // stamps: Seals of approval from other organisations that may need to be listed. @@ -633,8 +776,16 @@ type BillingGenericPaymentTerms struct { // BillingInvoiceCreateInput defines model for BillingInvoiceCreateInput. type BillingInvoiceCreateInput struct { - // IncludePendingItems The pending items to include in the invoice, if not provided all pending items will be included. - IncludePendingItems *[]string `json:"IncludePendingItems,omitempty"` + // AsOf The time as of which the invoice is created. + // + // If not provided, the current time is used. + AsOf *time.Time `json:"AsOf,omitempty"` + + // IncludePendingLines The pending line items to include in the invoice, if not provided: + // - all line items that have invoice_at < now() will be included + // - all usage based line items will be included up to now(), new usage-based line items will be staged for the rest + // of the billing cycle + IncludePendingLines *[]string `json:"IncludePendingLines,omitempty"` } // BillingInvoiceDiscount defines model for BillingInvoiceDiscount. @@ -648,20 +799,20 @@ type BillingInvoiceDiscount struct { // BillingInvoiceExpand InvoiceExpand specifies the parts of the invoice to expand in the list output. type BillingInvoiceExpand string -// BillingInvoiceLine UnitPriceLine represents a line item that is sold to the customer based on a unit price. -// -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLine = BillingUnitPriceLine +// BillingInvoiceLine defines model for BillingInvoiceLine. +type BillingInvoiceLine struct { + union json.RawMessage +} -// BillingInvoiceLineCreate UnitPriceLine represents a line item that is sold to the customer based on a unit price. -// -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLineCreate = BillingUnitPriceLineCreate +// BillingInvoiceLineCreateItem defines model for BillingInvoiceLineCreateItem. +type BillingInvoiceLineCreateItem struct { + union json.RawMessage +} -// BillingInvoiceLineCreateOrUpdate UnitPriceLine represents a line item that is sold to the customer based on a unit price. -// -// This is analogous to gobl's Line model, with the addition of the type and some metadata fields. -type BillingInvoiceLineCreateOrUpdate = BillingUnitPriceLineCreateOrUpdate +// BillingInvoiceLineCreateOrUpdate defines model for BillingInvoiceLineCreateOrUpdate. +type BillingInvoiceLineCreateOrUpdate struct { + union json.RawMessage +} // BillingInvoiceNumber InvoiceNumber is a unique identifier for the invoice, generated by the // invoicing app. @@ -679,6 +830,13 @@ type BillingInvoicePayment struct { Terms *BillingPaymentTerms `json:"terms,omitempty"` } +// BillingInvoiceReference defines model for BillingInvoiceReference. +type BillingInvoiceReference struct { + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Number *BillingInvoiceNumber `json:"number,omitempty"` +} + // BillingInvoiceStatus InvoiceStatus describes the status of an invoice. type BillingInvoiceStatus string @@ -771,15 +929,40 @@ type BillingInvoiceWorkflowSettings struct { // // This is a base class for all line types, and should not be used directly. type BillingLine struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + Charges *[]BillingLineCharge `json:"charges,omitempty"` + + // CreatedAt Timestamp of when the resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + Currency CurrencyCode `json:"currency"` + + // DeletedAt Timestamp of when the resource was permanently deleted. + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` // Id ULID (Universally Unique Lexicographically Sortable Identifier). - Id string `json:"id"` - Period BillingPeriod `json:"period"` - Taxes *[]BillingTaxItem `json:"taxes,omitempty"` - Total *Numeric `json:"total,omitempty"` - Type BillingLineTypes `json:"type"` + Id string `json:"id"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Taxes *[]BillingTaxItem `json:"taxes,omitempty"` + Total *Numeric `json:"total,omitempty"` + Type BillingLineTypes `json:"type"` + + // UpdatedAt Timestamp of when the resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` } // BillingLineCharge defines model for BillingLineCharge. @@ -793,29 +976,6 @@ type BillingLineCharge struct { Reason *string `json:"reason,omitempty"` } -// BillingLineCreate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingLineCreate struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` - Period BillingPeriod `json:"period"` - Type BillingLineTypes `json:"type"` -} - -// BillingLineCreateOrUpdate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingLineCreateOrUpdate struct { - Charges *[]BillingLineCharge `json:"charges,omitempty"` - Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` - - // Id ULID (Universally Unique Lexicographically Sortable Identifier). - Id string `json:"id"` - Period BillingPeriod `json:"period"` - Type BillingLineTypes `json:"type"` -} - // BillingLineDiscount defines model for BillingLineDiscount. type BillingLineDiscount struct { // Amount Fixed discount amount to apply (calculated if percent present). @@ -830,6 +990,107 @@ type BillingLineDiscount struct { // BillingLineTypes defines model for BillingLineTypes. type BillingLineTypes string +// BillingManualFeeLine BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLine struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + + // CreatedAt Timestamp of when the resource was created. + CreatedAt *time.Time `json:"createdAt,omitempty"` + Currency CurrencyCode `json:"currency"` + + // DeletedAt Timestamp of when the resource was permanently deleted. + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Taxes *[]BillingTaxItem `json:"taxes,omitempty"` + Total *Numeric `json:"total,omitempty"` + Type BillingManualFeeLineType `json:"type"` + + // UpdatedAt Timestamp of when the resource was last updated. + UpdatedAt *time.Time `json:"updatedAt,omitempty"` +} + +// BillingManualFeeLineType defines model for BillingManualFeeLine.Type. +type BillingManualFeeLineType string + +// BillingManualFeeLineCreateItem BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLineCreateItem struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingManualFeeLineCreateItemType `json:"type"` +} + +// BillingManualFeeLineCreateItemType defines model for BillingManualFeeLineCreateItem.Type. +type BillingManualFeeLineCreateItemType string + +// BillingManualFeeLineCreateOrUpdate BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. +type BillingManualFeeLineCreateOrUpdate struct { + Charges *[]BillingLineCharge `json:"charges,omitempty"` + Currency CurrencyCode `json:"currency"` + + // Description Optional description of the resource. Maximum 1024 characters. + Description *string `json:"description,omitempty"` + Discounts *[]BillingLineDiscount `json:"discounts,omitempty"` + + // Id ULID (Universally Unique Lexicographically Sortable Identifier). + Id string `json:"id"` + Invoice BillingInvoiceReference `json:"invoice"` + + // InvoiceAt [RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC. + InvoiceAt time.Time `json:"invoiceAt"` + + // Metadata Additional metadata for the resource. + Metadata *Metadata `json:"metadata,omitempty"` + + // Name Human-readable name for the resource. Between 1 and 256 characters. + Name string `json:"name"` + Period BillingPeriod `json:"period"` + Price Numeric `json:"price"` + Quantity *Numeric `json:"quantity,omitempty"` + TaxOverrides *TaxConfig `json:"taxOverrides"` + Type BillingManualFeeLineCreateOrUpdateType `json:"type"` +} + +// BillingManualFeeLineCreateOrUpdateType defines model for BillingManualFeeLineCreateOrUpdate.Type. +type BillingManualFeeLineCreateOrUpdateType string + // BillingParty defines model for BillingParty. type BillingParty struct { Addresses *[]Address `json:"addresses,omitempty"` @@ -976,50 +1237,35 @@ type BillingTaxItem struct { Surcharge *Numeric `json:"surcharge,omitempty"` } -// BillingUnitPriceLine Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLine = BillingLine - -// BillingUnitPriceLineCreate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLineCreate = BillingLineCreate - -// BillingUnitPriceLineCreateOrUpdate Line represents a single item or service sold to the customer. -// -// This is a base class for all line types, and should not be used directly. -type BillingUnitPriceLineCreateOrUpdate = BillingLineCreateOrUpdate - -// BillingVoidInvoiceAction InvoiceVoidAction describes how to handle the voided items. +// BillingVoidInvoiceAction InvoiceVoidAction describes how to handle the voided line items. type BillingVoidInvoiceAction struct { - Action BillingVoidInvoiceItemAction `json:"action"` + Action BillingVoidInvoiceLineAction `json:"action"` Percentage Percentage `json:"percentage"` } // BillingVoidInvoiceInput Request to void an invoice type BillingVoidInvoiceInput struct { - // Action The action to take on the voided items. - Action BillingVoidInvoiceItemAction `json:"action"` + // Action The action to take on the voided line items. + Action BillingVoidInvoiceAction `json:"action"` - // ItemOverrides Per line item overrides for the action. + // Overrides Per line item overrides for the action. // - // If not specified, the `action` will be applied to all items. - ItemOverrides *[]BillingVoidInvoiceItemOverride `json:"itemOverrides"` + // If not specified, the `action` will be applied to all line items. + Overrides *[]BillingVoidInvoiceLineOverride `json:"overrides"` // Reason The reason for voiding the invoice. Reason string `json:"reason"` } -// BillingVoidInvoiceItemAction defines model for BillingVoidInvoiceItemAction. -type BillingVoidInvoiceItemAction string +// BillingVoidInvoiceLineAction defines model for BillingVoidInvoiceLineAction. +type BillingVoidInvoiceLineAction string -// BillingVoidInvoiceItemOverride VoidInvoiceItemOverride describes how to handle a specific item in the invoice when voiding. -type BillingVoidInvoiceItemOverride struct { +// BillingVoidInvoiceLineOverride VoidInvoiceLineOverride describes how to handle a specific line item in the invoice when voiding. +type BillingVoidInvoiceLineOverride struct { Action BillingVoidInvoiceAction `json:"action"` - // ItemId ULID (Universally Unique Lexicographically Sortable Identifier). - ItemId string `json:"itemId"` + // LineId ULID (Universally Unique Lexicographically Sortable Identifier). + LineId string `json:"lineId"` } // BillingWorkflow Workflow represents a billing workflow @@ -2901,7 +3147,7 @@ type StripeSetupIntent struct { Status StripePaymentIntentStatus `json:"status"` } -// StripeTaxConfig A tax config for Stripe. +// StripeTaxConfig The tax config for Stripe. type StripeTaxConfig struct { // Code Product tax code. // @@ -3870,8 +4116,8 @@ type BillingUpdateInvoiceLineJSONRequestBody = BillingInvoiceLineCreateOrUpdate // BillingVoidInvoiceJSONRequestBody defines body for BillingVoidInvoice for application/json ContentType. type BillingVoidInvoiceJSONRequestBody = BillingVoidInvoiceInput -// BillingCreatePendingItemByCustomerJSONRequestBody defines body for BillingCreatePendingItemByCustomer for application/json ContentType. -type BillingCreatePendingItemByCustomerJSONRequestBody = BillingInvoiceLineCreate +// BillingCreateLineByCustomerJSONRequestBody defines body for BillingCreateLineByCustomer for application/json ContentType. +type BillingCreateLineByCustomerJSONRequestBody = BillingCreateLinesRequest // BillingCreateProfileJSONRequestBody defines body for BillingCreateProfile for application/json ContentType. type BillingCreateProfileJSONRequestBody = BillingProfileCreateInput @@ -4040,6 +4286,192 @@ func (t *App) UnmarshalJSON(b []byte) error { return err } +// AsBillingFlatFeeLine returns the union data inside the BillingInvoiceLine as a BillingFlatFeeLine +func (t BillingInvoiceLine) AsBillingFlatFeeLine() (BillingFlatFeeLine, error) { + var body BillingFlatFeeLine + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingFlatFeeLine overwrites any union data inside the BillingInvoiceLine as the provided BillingFlatFeeLine +func (t *BillingInvoiceLine) FromBillingFlatFeeLine(v BillingFlatFeeLine) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingFlatFeeLine performs a merge with any union data inside the BillingInvoiceLine, using the provided BillingFlatFeeLine +func (t *BillingInvoiceLine) MergeBillingFlatFeeLine(v BillingFlatFeeLine) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsBillingManualFeeLine returns the union data inside the BillingInvoiceLine as a BillingManualFeeLine +func (t BillingInvoiceLine) AsBillingManualFeeLine() (BillingManualFeeLine, error) { + var body BillingManualFeeLine + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingManualFeeLine overwrites any union data inside the BillingInvoiceLine as the provided BillingManualFeeLine +func (t *BillingInvoiceLine) FromBillingManualFeeLine(v BillingManualFeeLine) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingManualFeeLine performs a merge with any union data inside the BillingInvoiceLine, using the provided BillingManualFeeLine +func (t *BillingInvoiceLine) MergeBillingManualFeeLine(v BillingManualFeeLine) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t BillingInvoiceLine) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *BillingInvoiceLine) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + +// AsBillingFlatFeeLineCreateItem returns the union data inside the BillingInvoiceLineCreateItem as a BillingFlatFeeLineCreateItem +func (t BillingInvoiceLineCreateItem) AsBillingFlatFeeLineCreateItem() (BillingFlatFeeLineCreateItem, error) { + var body BillingFlatFeeLineCreateItem + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingFlatFeeLineCreateItem overwrites any union data inside the BillingInvoiceLineCreateItem as the provided BillingFlatFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) FromBillingFlatFeeLineCreateItem(v BillingFlatFeeLineCreateItem) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingFlatFeeLineCreateItem performs a merge with any union data inside the BillingInvoiceLineCreateItem, using the provided BillingFlatFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) MergeBillingFlatFeeLineCreateItem(v BillingFlatFeeLineCreateItem) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsBillingManualFeeLineCreateItem returns the union data inside the BillingInvoiceLineCreateItem as a BillingManualFeeLineCreateItem +func (t BillingInvoiceLineCreateItem) AsBillingManualFeeLineCreateItem() (BillingManualFeeLineCreateItem, error) { + var body BillingManualFeeLineCreateItem + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingManualFeeLineCreateItem overwrites any union data inside the BillingInvoiceLineCreateItem as the provided BillingManualFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) FromBillingManualFeeLineCreateItem(v BillingManualFeeLineCreateItem) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingManualFeeLineCreateItem performs a merge with any union data inside the BillingInvoiceLineCreateItem, using the provided BillingManualFeeLineCreateItem +func (t *BillingInvoiceLineCreateItem) MergeBillingManualFeeLineCreateItem(v BillingManualFeeLineCreateItem) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t BillingInvoiceLineCreateItem) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *BillingInvoiceLineCreateItem) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + +// AsBillingFlatFeeLineCreateOrUpdate returns the union data inside the BillingInvoiceLineCreateOrUpdate as a BillingFlatFeeLineCreateOrUpdate +func (t BillingInvoiceLineCreateOrUpdate) AsBillingFlatFeeLineCreateOrUpdate() (BillingFlatFeeLineCreateOrUpdate, error) { + var body BillingFlatFeeLineCreateOrUpdate + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingFlatFeeLineCreateOrUpdate overwrites any union data inside the BillingInvoiceLineCreateOrUpdate as the provided BillingFlatFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) FromBillingFlatFeeLineCreateOrUpdate(v BillingFlatFeeLineCreateOrUpdate) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingFlatFeeLineCreateOrUpdate performs a merge with any union data inside the BillingInvoiceLineCreateOrUpdate, using the provided BillingFlatFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) MergeBillingFlatFeeLineCreateOrUpdate(v BillingFlatFeeLineCreateOrUpdate) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +// AsBillingManualFeeLineCreateOrUpdate returns the union data inside the BillingInvoiceLineCreateOrUpdate as a BillingManualFeeLineCreateOrUpdate +func (t BillingInvoiceLineCreateOrUpdate) AsBillingManualFeeLineCreateOrUpdate() (BillingManualFeeLineCreateOrUpdate, error) { + var body BillingManualFeeLineCreateOrUpdate + err := json.Unmarshal(t.union, &body) + return body, err +} + +// FromBillingManualFeeLineCreateOrUpdate overwrites any union data inside the BillingInvoiceLineCreateOrUpdate as the provided BillingManualFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) FromBillingManualFeeLineCreateOrUpdate(v BillingManualFeeLineCreateOrUpdate) error { + b, err := json.Marshal(v) + t.union = b + return err +} + +// MergeBillingManualFeeLineCreateOrUpdate performs a merge with any union data inside the BillingInvoiceLineCreateOrUpdate, using the provided BillingManualFeeLineCreateOrUpdate +func (t *BillingInvoiceLineCreateOrUpdate) MergeBillingManualFeeLineCreateOrUpdate(v BillingManualFeeLineCreateOrUpdate) error { + b, err := json.Marshal(v) + if err != nil { + return err + } + + merged, err := runtime.JSONMerge(t.union, b) + t.union = merged + return err +} + +func (t BillingInvoiceLineCreateOrUpdate) MarshalJSON() ([]byte, error) { + b, err := t.union.MarshalJSON() + return b, err +} + +func (t *BillingInvoiceLineCreateOrUpdate) UnmarshalJSON(b []byte) error { + err := t.union.UnmarshalJSON(b) + return err +} + // AsBillingPaymentTermInstant returns the union data inside the BillingPaymentTerms as a BillingPaymentTermInstant func (t BillingPaymentTerms) AsBillingPaymentTermInstant() (BillingPaymentTermInstant, error) { var body BillingPaymentTermInstant @@ -5024,10 +5456,10 @@ type ClientInterface interface { // BillingInvoiceWorkflowAdvance request BillingInvoiceWorkflowAdvance(ctx context.Context, customerIdOrKey string, invoiceId string, reqEditors ...RequestEditorFn) (*http.Response, error) - // BillingCreatePendingItemByCustomerWithBody request with any body - BillingCreatePendingItemByCustomerWithBody(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) + // BillingCreateLineByCustomerWithBody request with any body + BillingCreateLineByCustomerWithBody(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) - BillingCreatePendingItemByCustomer(ctx context.Context, customerIdOrKey string, body BillingCreatePendingItemByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) + BillingCreateLineByCustomer(ctx context.Context, customerIdOrKey string, body BillingCreateLineByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) // BillingListProfiles request BillingListProfiles(ctx context.Context, params *BillingListProfilesParams, reqEditors ...RequestEditorFn) (*http.Response, error) @@ -5604,8 +6036,8 @@ func (c *Client) BillingInvoiceWorkflowAdvance(ctx context.Context, customerIdOr return c.Client.Do(req) } -func (c *Client) BillingCreatePendingItemByCustomerWithBody(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewBillingCreatePendingItemByCustomerRequestWithBody(c.Server, customerIdOrKey, contentType, body) +func (c *Client) BillingCreateLineByCustomerWithBody(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewBillingCreateLineByCustomerRequestWithBody(c.Server, customerIdOrKey, contentType, body) if err != nil { return nil, err } @@ -5616,8 +6048,8 @@ func (c *Client) BillingCreatePendingItemByCustomerWithBody(ctx context.Context, return c.Client.Do(req) } -func (c *Client) BillingCreatePendingItemByCustomer(ctx context.Context, customerIdOrKey string, body BillingCreatePendingItemByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { - req, err := NewBillingCreatePendingItemByCustomerRequest(c.Server, customerIdOrKey, body) +func (c *Client) BillingCreateLineByCustomer(ctx context.Context, customerIdOrKey string, body BillingCreateLineByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*http.Response, error) { + req, err := NewBillingCreateLineByCustomerRequest(c.Server, customerIdOrKey, body) if err != nil { return nil, err } @@ -8140,19 +8572,19 @@ func NewBillingInvoiceWorkflowAdvanceRequest(server string, customerIdOrKey stri return req, nil } -// NewBillingCreatePendingItemByCustomerRequest calls the generic BillingCreatePendingItemByCustomer builder with application/json body -func NewBillingCreatePendingItemByCustomerRequest(server string, customerIdOrKey string, body BillingCreatePendingItemByCustomerJSONRequestBody) (*http.Request, error) { +// NewBillingCreateLineByCustomerRequest calls the generic BillingCreateLineByCustomer builder with application/json body +func NewBillingCreateLineByCustomerRequest(server string, customerIdOrKey string, body BillingCreateLineByCustomerJSONRequestBody) (*http.Request, error) { var bodyReader io.Reader buf, err := json.Marshal(body) if err != nil { return nil, err } bodyReader = bytes.NewReader(buf) - return NewBillingCreatePendingItemByCustomerRequestWithBody(server, customerIdOrKey, "application/json", bodyReader) + return NewBillingCreateLineByCustomerRequestWithBody(server, customerIdOrKey, "application/json", bodyReader) } -// NewBillingCreatePendingItemByCustomerRequestWithBody generates requests for BillingCreatePendingItemByCustomer with any type of body -func NewBillingCreatePendingItemByCustomerRequestWithBody(server string, customerIdOrKey string, contentType string, body io.Reader) (*http.Request, error) { +// NewBillingCreateLineByCustomerRequestWithBody generates requests for BillingCreateLineByCustomer with any type of body +func NewBillingCreateLineByCustomerRequestWithBody(server string, customerIdOrKey string, contentType string, body io.Reader) (*http.Request, error) { var err error var pathParam0 string @@ -8167,7 +8599,7 @@ func NewBillingCreatePendingItemByCustomerRequestWithBody(server string, custome return nil, err } - operationPath := fmt.Sprintf("/api/v1/billing/invoices/%s/items", pathParam0) + operationPath := fmt.Sprintf("/api/v1/billing/invoices/%s/lines", pathParam0) if operationPath[0] == '/' { operationPath = "." + operationPath } @@ -13042,10 +13474,10 @@ type ClientWithResponsesInterface interface { // BillingInvoiceWorkflowAdvanceWithResponse request BillingInvoiceWorkflowAdvanceWithResponse(ctx context.Context, customerIdOrKey string, invoiceId string, reqEditors ...RequestEditorFn) (*BillingInvoiceWorkflowAdvanceResponse, error) - // BillingCreatePendingItemByCustomerWithBodyWithResponse request with any body - BillingCreatePendingItemByCustomerWithBodyWithResponse(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BillingCreatePendingItemByCustomerResponse, error) + // BillingCreateLineByCustomerWithBodyWithResponse request with any body + BillingCreateLineByCustomerWithBodyWithResponse(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BillingCreateLineByCustomerResponse, error) - BillingCreatePendingItemByCustomerWithResponse(ctx context.Context, customerIdOrKey string, body BillingCreatePendingItemByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*BillingCreatePendingItemByCustomerResponse, error) + BillingCreateLineByCustomerWithResponse(ctx context.Context, customerIdOrKey string, body BillingCreateLineByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*BillingCreateLineByCustomerResponse, error) // BillingListProfilesWithResponse request BillingListProfilesWithResponse(ctx context.Context, params *BillingListProfilesParams, reqEditors ...RequestEditorFn) (*BillingListProfilesResponse, error) @@ -13877,10 +14309,10 @@ func (r BillingInvoiceWorkflowAdvanceResponse) StatusCode() int { return 0 } -type BillingCreatePendingItemByCustomerResponse struct { +type BillingCreateLineByCustomerResponse struct { Body []byte HTTPResponse *http.Response - JSON201 *BillingCreatePendingItemResponse + JSON201 *BillingCreateLineResult ApplicationproblemJSON400 *BadRequestProblemResponse ApplicationproblemJSON401 *UnauthorizedProblemResponse ApplicationproblemJSON403 *ForbiddenProblemResponse @@ -13890,7 +14322,7 @@ type BillingCreatePendingItemByCustomerResponse struct { } // Status returns HTTPResponse.Status -func (r BillingCreatePendingItemByCustomerResponse) Status() string { +func (r BillingCreateLineByCustomerResponse) Status() string { if r.HTTPResponse != nil { return r.HTTPResponse.Status } @@ -13898,7 +14330,7 @@ func (r BillingCreatePendingItemByCustomerResponse) Status() string { } // StatusCode returns HTTPResponse.StatusCode -func (r BillingCreatePendingItemByCustomerResponse) StatusCode() int { +func (r BillingCreateLineByCustomerResponse) StatusCode() int { if r.HTTPResponse != nil { return r.HTTPResponse.StatusCode } @@ -16329,21 +16761,21 @@ func (c *ClientWithResponses) BillingInvoiceWorkflowAdvanceWithResponse(ctx cont return ParseBillingInvoiceWorkflowAdvanceResponse(rsp) } -// BillingCreatePendingItemByCustomerWithBodyWithResponse request with arbitrary body returning *BillingCreatePendingItemByCustomerResponse -func (c *ClientWithResponses) BillingCreatePendingItemByCustomerWithBodyWithResponse(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BillingCreatePendingItemByCustomerResponse, error) { - rsp, err := c.BillingCreatePendingItemByCustomerWithBody(ctx, customerIdOrKey, contentType, body, reqEditors...) +// BillingCreateLineByCustomerWithBodyWithResponse request with arbitrary body returning *BillingCreateLineByCustomerResponse +func (c *ClientWithResponses) BillingCreateLineByCustomerWithBodyWithResponse(ctx context.Context, customerIdOrKey string, contentType string, body io.Reader, reqEditors ...RequestEditorFn) (*BillingCreateLineByCustomerResponse, error) { + rsp, err := c.BillingCreateLineByCustomerWithBody(ctx, customerIdOrKey, contentType, body, reqEditors...) if err != nil { return nil, err } - return ParseBillingCreatePendingItemByCustomerResponse(rsp) + return ParseBillingCreateLineByCustomerResponse(rsp) } -func (c *ClientWithResponses) BillingCreatePendingItemByCustomerWithResponse(ctx context.Context, customerIdOrKey string, body BillingCreatePendingItemByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*BillingCreatePendingItemByCustomerResponse, error) { - rsp, err := c.BillingCreatePendingItemByCustomer(ctx, customerIdOrKey, body, reqEditors...) +func (c *ClientWithResponses) BillingCreateLineByCustomerWithResponse(ctx context.Context, customerIdOrKey string, body BillingCreateLineByCustomerJSONRequestBody, reqEditors ...RequestEditorFn) (*BillingCreateLineByCustomerResponse, error) { + rsp, err := c.BillingCreateLineByCustomer(ctx, customerIdOrKey, body, reqEditors...) if err != nil { return nil, err } - return ParseBillingCreatePendingItemByCustomerResponse(rsp) + return ParseBillingCreateLineByCustomerResponse(rsp) } // BillingListProfilesWithResponse request returning *BillingListProfilesResponse @@ -18625,22 +19057,22 @@ func ParseBillingInvoiceWorkflowAdvanceResponse(rsp *http.Response) (*BillingInv return response, nil } -// ParseBillingCreatePendingItemByCustomerResponse parses an HTTP response from a BillingCreatePendingItemByCustomerWithResponse call -func ParseBillingCreatePendingItemByCustomerResponse(rsp *http.Response) (*BillingCreatePendingItemByCustomerResponse, error) { +// ParseBillingCreateLineByCustomerResponse parses an HTTP response from a BillingCreateLineByCustomerWithResponse call +func ParseBillingCreateLineByCustomerResponse(rsp *http.Response) (*BillingCreateLineByCustomerResponse, error) { bodyBytes, err := io.ReadAll(rsp.Body) defer func() { _ = rsp.Body.Close() }() if err != nil { return nil, err } - response := &BillingCreatePendingItemByCustomerResponse{ + response := &BillingCreateLineByCustomerResponse{ Body: bodyBytes, HTTPResponse: rsp, } switch { case strings.Contains(rsp.Header.Get("Content-Type"), "json") && rsp.StatusCode == 201: - var dest BillingCreatePendingItemResponse + var dest BillingCreateLineResult if err := json.Unmarshal(bodyBytes, &dest); err != nil { return nil, err } @@ -24190,614 +24622,625 @@ func ParseResetEntitlementUsageResponse(rsp *http.Response) (*ResetEntitlementUs // Base64 encoded, gzipped, json marshaled Swagger object var swaggerSpec = []string{ - "H4sIAAAAAAAC/+y9C3fbNroo+lewdPdZTfaWFdt5tPFds2YpttN4msQeP5qZqXJdmIQkbFMAC4C21Z78", - "97vw4UGQBCXKjzRJddacXUckgQ/Ah+/9+KOX8FnOGWFK9nb+6OVY4BlRRMC/XtEso2xywK44TchbKtWR", - "fi4H5CbHLNWvkJs84ynp7YxxJkm/R1lvp/dbQcS81+8xPCO9nZ59u9+TyZTMsP6MKjKDKf5LkHFvp/f/", - "PCnheGJek0+q0++bUT71e4qqTI/7YYoVyrFQEvExUl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+IZl5jevO4wuoP3v+8UVpZNza3lsfYLyYUrY686vMapeM227Li5XMUz8aOh8TN7c/ARtf6", - "SBYfX94Wir6c1B2VVsWqnKGcUrGanCyNdOPYpxXzvSnAK5jA/6b8ulquumIZ6HAJ2iI2K4+9KiZdNJ1N", - "YcDMzRzu9gRrJd0wC0GuKLn2W16avc9dyQjAIFbg7Nxp+ueeSfd7togD5ex8jGlG0g4n4oK+mrbxr9g3", - "eo9WR/fAWEKyLJAVFKTsfQrEgNU1PqGq8XZvyQRnJjpzbguFuCIcE841/RMQC6tJ0GCdZffQWXZOVJa3", - "rJzvFatPTbkZztJLy7JVXA6IRj32/pvxnbcGS56GUYju6gVBiKZAiFPtOavR3IpwP6USJZihGdH/xzF4", - "CBA3MkQq8Fj1kSfJOyg+vTMdAAildKXf8aF4zq810AObN9uGq4RU3t2B0GGSaI7+yjhuNI8wOlIau6KX", - "LRiRpcCqDwjKerpzATtMTGCNofo6A7NzBua9BeFGi/RUhctp1QJ/SebeJB34RvXNs8N72d4l2zCocaUk", - "ynlujUJ4rEhFYwAPyYXeueDaH2UES4IYV8Tl9fpRqUSP0jpZKHKpBMEzfzcfI0LBRWIppj2wEbue8qya", - "4x/oEN4aarG1b8wyhqKgRyaD5rH3t0miilw2prCPQyxriXV2zt47OOVr0nfFqxoUpgOfCWF9LSmbKmNg", - "NfKGmbjY/Cm0eKxIQiox9CVQP5F5pWKeIBMsUhNITK4oL2Sph2kwc65MCQUQY0KZ39q85uiaCM1ThYCk", - "oxiFWTVxOd4jpxbmEGVFsGfeYHR3odEGEsENtKIjjD5fLDoaCfa2Cz41X4dwWF0ClJ0sq1nW9Nt9a24H", - "uPANkaEt+HElgn8FQKx76B4DpTR5ea1vPPxbWuphhzee3qrzTZEE1M5xRm2N8duL0LcNP77NIbpondYw", - "nYY8U88BcNUULI26Rfp6YDkN7KlehfN4Wklv99TL0iSLeVVTNLkxBV9qgiB3ld6XqPun/n7UfCLplZbY", - "7+aegMFdoALOIKnTRChQhu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4R0JR/tETO3MiCsr/b6aq/VrrXadQfytlzL6q5etZYiqz7vUorM", - "Qi3DEmQtumFJimFJC1KvTvHNKzLFV9REAZYeoSQrJL0igBju78XjuFgKoxvu2hil4EI/3V7UkXm48R/f", - "lPmX0WgwGm2MRk/Q+ce/h49aWjRH/MmRJhYpub2HurKuEOfe6yuR0d9JCqI3OKnllF8zV07DdSOwJj41", - "D1vxBe5lBzmSigvi2JVxlfpa54o7S+EcMrfNF3W/NYQClY5H8KyKhT5pl2bR2LWLADtW3TmPWZUMUetv", - "wjcmVtCjGuICeVxztAMiXU2Elsnyho7q3YE5xTe75pMKndB7ZWoeC9ukvRA2uOH+y9RW/Gx5GT2nibSp", - "UpfNTUNcRcSMsjAGTWBFRuySNCIF9YMyTBANEaOZDx+kMxt/acq9aNkHUHN2wUeMSvTf/01uyCxX//3f", - "diab5yoLcS9p9HxGLNJR4pEXYu1KscPPtXhlC8syV/PbVsVQXxG2Fkd2n3VEC0aVzWuuhHAznPEJL8Cf", - "POEX2XcSwXQznpKsXxbNdBvm20LMcyOKQMeDUnSDpgrxhufd9+UYK7KLRTXGd6/SfODarvuCQGscnpnC", - "Nr8V2FPd2+PNP+0oYeWr+kz12IVaNGWXuA7bDtfD/LEjgt2yTm+tPO8a2dbI1hnZbl00uaVW8hr51sgX", - "R76fOU1tHYZhErd82Mf6TfNKUMIXagZzNMUszUxFlSsOHSUg9LB5XPh23eQCKLW4aiGt17tpB6TvDEA7", - "rs1FIO/hVeSeFpHPl9uptHHyfTguHDh/R4/IYDJAW5ub/wcKbUpTisPlRAn34uNYa303c9/tY7eDbbHU", - "H5PfCiLBYKDnDJIIHv7YmtUizBQ+ONQqUXVsqoT4LP3CNd93fQ5jHk8iAqLnG4R7846ZJOzk7VR228r7", - "V/PGr41kEcVNPWQH+irBuLWNK9sg93usyDJTrsnGbNSCb8tUm+Yem2ewNr1NrvxdGGgZ7O/it5cn4yTW", - "omkhqh9FR9wt8SYM7qQyMaVm3HX2f50zcqPOk3lSrYgTHXIpIaMWk2p1BRbFf7YdXeNAWl5shSlQ7CMg", - "mdgse04PQXcjNLf9ElJbukH/9+Brztk5dUz6YE+v0dGHpchvF96FUH8ITKE1m7AzZUY9IYFdct1EfN1E", - "fN1E/C/YAfiv1f66AxENI2SaGF8+rCTQVopxYyjDh9ICHDGJoxCcZfNSwbVf2/LYmKFhnpvUGXN/gL+Z", - "niY4zxeJC02KO8zohDnMqi4g8lLgQfJH7Op6e7lWBomClm5DEpziIxZvuyKLi3LisN1HSfWxh3OV1b0j", - "asrTRUszbwTrau9LU67lES4Un2FFE3QlrXX9cegxAwXr3L+lRYtevycJSyvdopvLnBmAV1njgkKG4dne", - "kTOXeGIUKleOr3J0/aibmbuda0MXk5rHKrVCIX3yCme14n+nW2+i1f/c6ybQy0JtVYguM96yLKBPV3Sy", - "UyinVFEqvgsGHCivwpq6TivhafKVVnHOFWVuhMVZ9A7pfQdxr1Ec0x6NocON4weKpfc6vAqmb0C17qVv", - "MgCFKW2i0FSLNVhW+wHXC1+WaWMBnmwtLBJZKz9qbSaXJFdaz6mUxtSvmguOTEMoeTtk+bLKWTbwto4O", - "HXCwLlG0YmDtxTomRiWPlRSPksrfkcjZgaoULkrMo5tYX0lsE3enJLnkhTohUlLOdsHGfUpuFODGSXEx", - "o+oICxxrfXsCzSxQbYiBsZOfK3Kjmte1HLXJH2ZESmuOjKBIHXI5pVAb1JUUuOtw9wIUJJQejk9MVath", - "kpBcOdp0+3E/LT+4s4N3PGZnaTmjgp7POGjyTkYgswuSplDCZsqlamkPt5tRwtQwzyEN85jInDNJYtZV", - "86T06SfwJUiXjw5zonEbXCnJJWHpY03yIEkT3j0cFmq6jTQSN405hWipK3x2/DY6DC7UlAvXqgVCVSYC", - "M+XHXyyS6/lisveujSM7EvwiI7NwL7pd+zNmmmyTtD5E3EYsrMU6CWucuUZgqaa/wNl8gFvpZTLtEgwP", - "8UEmSpMRVY17bK4RYmh2o6j1y8HJIXq69eLFxlaZInx9fT2gkkN+MJ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xNWqn908y/ztx5WtcwLBxtZDna6rrtBt", - "jwLq7ovuRvQO1ymmStErZkTbV/WbMRmuSsqPiabX1XaizZ10gkNI0yM7u0rSmO8NGiBrhUaFhHaJROik", - "jtvgT0U66Ca4GZnMCkV1zFpLCGsJYS0hrCWEtYTwQBKCSwtxSunHb9kD+GWxc8uxF3L1+2PnQauC9uhn", - "aFpg3HwRhtzgx/dDmUds32SYl+tD3P/rINXfuH37esn47Vf5GWn+n0I9VyJF93CNw8Ye8RtduclYSp5Q", - "cGb4RKuKlNraIHTBpazfxttaYCvjrGyNve3XMZISCaZr0JQqLblXG2kFllvYS2vfr2g7rW1kFzvqjwK3", - "uXAgazGSLTZr9/rYNv+K24/RiS8fgVHOJVX0KnRwVr1MJbflxQW0nfAuytJNZD5e1zr6MpQiMh6TRB9q", - "bCX77iG0aIWrB2ghIewNs2TKTcChcJTRPh+gI5f3dYWzgvhyfwmhlpfBzYIEecpSfn1Cfyfo0YyyQpHH", - "d+y00FhjeVvaRAwrSoceBtBJbG1wlwFMZZ2MryBILNU5yE1OTYH1FWwm/puFsqUBv5zACJvUBIjZmYkc", - "toUKQEeM6jDkjv0wlu7GV6o34ptjnmX8iohhQGdtMYbN+tn8aK+TIEjwTF8N/SXCkGdNVL9eQGNeOqox", - "SukYEgIVusAZZonJ7sY2qO3aou4cTbEm4GNuhUsYeTBir+xHZe0SeIKgYpOvNY/lDrJvnkOW3/kxvPU3", - "9O7g/aN39eX20bvhvx65D17BrOaLPnpHWfXlx487sJAG27hX4bK8HG7YWhaKCUS0NUAgoySn588OxfBy", - "+vZqTqeUv8yfb01fUvqavQLmPKsvc40C940CjNwoI40TX8inEUtFblSdcgEbMszqnnlMLigXtuJ1NE4b", - "njp13gpX9uhBHZjSidbq/JsQA2KL446pkPq4jtxDCAv04lhKEjrzsVxygD7oATN+TYT7DVGWQm8WNnEz", - "0VnOBRQbGZhOSXY3+nroAN4tPdtMY04hJmBwn2JWe2d7MGKuJ5OGWxAkyRUROPMCwx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jZh/XNiJ49m+yEVme", - "4DBM1xye/tTZ/teP/9r5/Y/PO++f/vbij7ed569efn794vjzO9eOSaLvj77/9Pnn7R87b4/e/vrsyfsX", - "O5/2nta1Cl6rbtLMduuXg5fs0Uclz0VmeJKM2Ucl/y8X7BdxISPdz3g6kBH+cKwziwv8AcJVT4rscQuN", - "8m9wg3TZESiO8GcHwf8Quvj3n3/44cffX3SePvvXcefHHz/s/3HixmE63fH20fab568+vX+2c/Rm58ne", - "83fP/lU3FJN1/EGMxjfpP4Fi6lq8J+pzuknfCawFeU7QFpq20GRuSTtI8pyY85wQYWN2HZvH9lf8660s", - "VzU9wHdWNDxAgbaS1t7XZKHO/rbMAlwrSAqTFCYpTIpsUmQThjxwowDhxfrVICTLE7GuAhvfWa6/PsKs", - "rxKWAwu66zE5VmzErQTkWFPV3b5hPff1avBO1R47E2NYjzjL3asOYwvCyo2DK+leGzsHWgcD0OyTw5eH", - "u87DBnOZrFNGJ7lbszUzeZrqzLKutgOGteYqZm+haIXrneFDwUwqIhRykY5FXyj4oG43VtxlFcBuuvNo", - "2qGrXhu8d/T5yfuXr96eHH/6/ujo9etfnz1/8/T13qcKbfDOH09///79+ze/Hj/Z2X/94/Zvz5++enIp", - "bfBdVa/CKnot2tXajG5SuQqVIN0q7epoV0e6VdrUkG51Trea+U3DpkLSQP6rxKM5cof8mzYYhmK+mUg0", - "2GYKQ0Oym2Q3yW6S3SS7LxGGxhvHXYNSsv0V/lw2+gyaBS4OPeMsB68j7oyHheUHrK5FFHGGEIAQgA5l", - "6VCWGIgY6P5FnFmLgVYPN1NCmmUmX/cJSDrfhq6DdBcELgQuBC4ELgQu99CabE1mWTm+TPV5y3xwmTtO", - "LN/kKRGRE5ETkRORE5ETkROR00YDymzg2KtthTNtqTZxOYGBqtEQGaFimJUwgMZ6Z8GRtAOWcRXrIYu5", - "5fNUBlneVy3S9jfilEgmMwRPBE8ETwRPBE8P7bLwy1HRSHQHWp+1zbm8qMehfZ4kXR6dMaHiVEtlnS9X", - "d8yOz+UFDAhmOma8q3PLCvDhSW08viOBggreP5wkD9EUNqHzmSnqN9fytXQ+ZL5DOEI4Qha8JI1JGi9T", - "ZXgB5yTkvES8jD4jTbhaIZwAJquOIPABc1gzagDm9+0HCnDu0wAlUOEWLKDWZrKbW1Hj0izjhxxptOip", - "MzFe2lVnYrxKX10pBsB1uOhfV3coN+1bMObwWRb9Y+o76JNLO9VPPHaigScfMvgcrRRlh3lYFfvobR6e", - "aBfUF5YSO8YpEwuRHoan35AfPawll/adr3150/7yUDD5yBOlE6UTpROlk488QHPqqTgAOciIS7rDIzTU", - "eMBDthvSbUHWrpCbdnHHRtEZHYlbErckbknckrhdza09dbJwscSdVX21v8Kfg/gweyvG/7SVuFhgwjMl", - "luOM9ywLm3mcfyipT9UBfHU2z5TxVZc9GE13psOTTPB47OvLpPIZ6Yy5mrBYC7d2ZaInMqEiNxcSjrZB", - "ad5NpBmIOBQ9jwbvxegl5OnhYLk5UKkLFtoEcTU+7FVo9+6cOusO6Ji+NBsXW329Nad6qnr6hWiMaIxo", - "jCymyGKKcJRw9DZx9H2Bhlfi0ZWDKCFFTg4oy8GTHGBeNl7SmvRIMZKIYIhgiGCIYIhgiGDuQYyklfBl", - "YTCkgCYy9rdVt9jJAkUWQ4Fr80zBDOxBOusGNTeiOoTSdTIKKbfujHKrc3vKLVJWEeoR6hHqEeoR6t2P", - "qFIrct6iAFIT0KuLHHXHlUmbsa5yXXPToaEIeQh5CHkIeQh5CHkecjioqx3PtdMBN6tcxOzSMalq7LiD", - "C+UHl9+dZKRF7m/QrAfoDvjtuNThvLq8U1396zfiVgfFk28d4SvhKxn7E72Rbx361k0h1VWd7NDFDnKs", - "Z7SJr91dprQNarKwW27PWRCLJxt1ggiCCIIIggiCiJU8BucE/5W1Qe7fKI3eivFCE+5gZDUFHmXbbffD", - "VYy377hGqaaaoXcXVnYDSh6yKifmIOagczc6dyPoIui6vFU5ck3PRzu4in35Ep2Ntw4nCNowBHVuWZND", - "mhmi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AJAF5rRvj2vDYqwm9", - "N8LemsS7PkunYgdJO0YSiCQQyXmJnJeICGjLXLdlbsPKZhMxhLotv8G+nHrG0om91hmLBiI6g+lWSsh4", - "BJKrCdtPHMT2OU9yUfKVV8YKHi88dn5VruaG8aS5mieVVFGSx8LpCuJqlyr/ui+hq3UiuLop36lSn5FC", - "nfCI8Ij0BUQHD5sOymJ09dvRD1OhMIoIrhN2kAnBQJoYpntTSLDrAuSIuMm8rGvi7doGSD1qMRhNeJF5", - "g+0xiyH9UCrhlm78cTpT9xZ+sskY5mpPcJtn7o5ut35D/3ErYUIUp+1lAMFcTSoi2YN1Taqp2eKXex7q", - "PvWqEiI2jBeFcmN0JCcH+/6tx2hRsMVeuFZPc1IselIJ3wmTnDwVQenstLEPH68R7Pj4cGaFPW20IOtj", - "9/pUzomwbKxzlnJjGE+06juvt57s546jYFYngvUzrkD4zJb60bivX5qiXtis39kfzAgLr5jTBnsEBUx6", - "zpXwGKv1br7TDBvwc8GGXI2xSRE3wjTdmuMzZXnKcpCZW10OGbtqwXDKYepygVQwsIm4QBkjQf4a4J4W", - "Y69c/MddnBtRbqweOi7AArc7nU6H7R0Ek/w4z8Iih4UCAEgdw0SbmSo4jHusL8+FKtRmkK1Wydg1C7aM", - "PELJ/khpteVv3308NW1SkYUOfSvGLXbQw3Gy2RhjQAUHRSVGU685op686FZunmSCx2Oc8FyFwkvvNafm", - "M65gPS6TMEO/7zx3i0LpUuGpKYpLq7/oHqrp+WqoY9kbM2mbrvmupSgNq10oy8B5EyrE63fRLLXANelA", - "pbk1q9nDbG+iGmuROi62bloVWhBIgFgXRhhmEfycJ5bInsieyB5a8PzaW7CvVS+RkV1zvCKdJ7EfMS//", - "4KMtkDby2U5IJ2hFgS9EkGlV40T7F9q/3PlgoiG4wxTANFbd4aytEm1/Lf0LUrwu4OyfNlL1ClpTl45J", - "Y3LhzHWmq++2OGUgA+TsCr9ziJmQdiAy1gUYM0ziLCjhZaXitNQRb1w9N682rciwtvu+NZXsik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BJvRjjd6BVWb/XKcgROz1eSl", + "sWZfEWQSaKv6lOJ6WZCGOsWXJqak73m3w5U6Ai/CHStLWoswywvVjNkaynfjlkRNLZJhaYzwjoA66ZOW", + "gRStmTqGESgzkL0vt5QY62dti7gdmiTL1y5nMJLPbtMwy5RD05DF1ICrOlz6iFaXszNiGwhnWeVrTYfh", + "nOxXZ1ihUbG5+ThBjF89eOiL+ttJUjeISX01JWuCAeuvowJ6xsBYfcTIlflwo/VDqaCuWSDsqRGz2OKS", + "pZJ5kpGwiMDXrmY1cjeX3AWvot5L8OLQBodxoA9z9MCXl4CyxDb0zZUgfgiC4jleJfc+NusLLCsWHOWb", + "XACHAjsNRC4C5bQwOMiApFImFcFevrYY/Z10fkBIgh3cU/Se3y1rYAJQobZbAMUgLoRYtlOyCwz32kgf", + "xPsqwWdoSfZSR14kDtANUzVq4SzjVyb7PjRtaFqtr4AKpAzKUqJJUCW+lLKUXtLUZULLDqR833e4rRez", + "DB77ViPShbGWbKP0KQdtaGs9asPsLJP+rIV6w6V6/Z4sYLUChE6SkNTUL/r7opDhMGO9c9nDSKTksvqH", + "9pM3kF/uPwqO8pRRdSgsKDcye7paY6FU96BgVD1EuR54EF921S170w2oZLWvvhXh51/OpoSW6tttjB/p", + "5ptTDvG5N6gsrhq96zZrHRp5tae0eZHGl6K3YcojVsm/svZ7YodiRGqhVZMsaaDOOOgtY5woLqSRiPLc", + "5VjAWjQIORHwOxco+MVtw0P9mW/rBd8nhGFBuUQPwt+lg9fYGmENMuhDgGdEc9ExvX5YkTkO3v68UUaA", + "bGxuLbdlLaZYrQmu1ec1ksttkeRK9qsjvbbkW0hl3f4MnEXFVXjwZeHaAkuW09zDMtumKvAop0uuph5J", + "I2Y5Pm61Ox8i7+0KwIin/KraZboSMd+B4ZV28Ab8X6efILB5H+zVuPKnqXtRrc9VmT5SwTD48KiWkdSE", + "uu0U28plVR57O4p0pYxs/cjqVO7OTLCawiWDIK5LSq78xSmT+s5cvw6gA5rYnzkz3Z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kUm6QXL6jX1", + "RzadmX9FoXvJKdn7eETesmxa4BZk0l4c7308essyV87S+91SWXxckBMuLRDRVsJe7ywgTkzjNbeimUId", + "lVYR8L4XLMtXQmfZnkwavpjfrLbeZ2lNX83hGWPqgg46ZAWlgm+4mfNuyPy1MmZNV6x8lxBEjioME9ds", + "+JMihSpaVbeEFAjnL98FX/N00tqF3ziA93JfyV4c71OFXolIM0gzSDNIM0gzC9CMNJ/CTq3yoAAzNI4B", + "Yo73Uj1onYsT8DRThJJPJ+9gMYY7xMxgQRKy0+qQXiRHM3EHku64at4w/enk3UNRNByA4NmLY7hcbZnl", + "GsUzimcUzyieUTyjeDbisZ1/ELWCei//ZKxEJYEMWetcfGYJ73GmCnLZ/GK96q+CARV9Br444DpPtLww", + "y5AwK2wvYWpgnywswfNmLK22sMX4/FDTgQwZ+HecGnmo1EeTWrXAqniRI/zFizRdctMS7Qpiy4OJsPIC", + "/y4O+coLTxO+SKFzR75Cz1QArCd2eStP3hMW8oQF7r0QeBB4EHgQeBB4HhrwOBiYZSxo09RYAzJ3Mdb6", + "78SGqvCGSpRkKMlQkqEk22xJ5uRO/aVKBz7uPkivOp88K1PW44MHZdtqbtvZzolKdKhDUYqiFEUpilIU", + "pQuI0qltYfsb/D0Kj+F+wZkBpWy0y3p5a3/38nb+YXKp5pmnykN69Y6Jvh40dp8/bTaGXPh/bpuKtPmY", + "GruN//6Lbv27s/Xy638++q/dv/N/PP5///F///1XZ+vnr391tl7ubf36r7fvP3zcOvu89YVuDf7nYiji", + "LX259e+v33aeff+PCrszjEeEohdFL4peFL0oem+wi53lJ2ZS2YtboL+itF/tH7YJwrVzh5tk3PSi5EXJ", + "i1FkED0QPTZn19+211vUHRFDLBbHKOYLg2jBLVL9eApbINkDBJcFjLbMHxvIxnyDjeWyaLlkhhEXoRwt", + "evXHVMYzPmRfpFg2s7+OZcn+gCtj3iQyjfezJfP2fa61oyPUl8cubDY0u9LtQF2Wi5mcGEibSJtIm0ib", + "SJtIm0ibF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zZDRkyNDJrHIEwjTCNMY+wIxEzEzFVh5vzwjBXa5IRdygtDc7mDoBnKghemo64W2VNjM596z716J72m", + "tSU4bwx535Cb6J83/M/WRshbBzk/OFANRxOej1SREYui1rnYyxvtPWDTHIudUc+AKy0THtDIGS+opi28", + "oiNiGacR9cpxp7ne08TwktJ0GLfI76b9zgrCmWKZX0kXbDfgO29OATBXRGkzqwMpFA/tSgGGQs2iLyC8", + "e8J0Ip11U0GF7X1K7SfCFeFDuBLJ6uubhA6l6DtAB9ZQTUJTs/qIfl3szR9LYY3xPBFBEUERQRFBEUER", + "Qe/SRL02xmmRaboZ4eE6ApKV1Xj3H0w6d352jeozZBdkF2QXZBdkF1SfzVSfta26KKs9mz2B005VVCt5", + "LxoqQudUFlJN653IvPbIVQWKKhVD0KkgkUqNz1vBoYjArLeOYPtpIkI5Er+6rIlrDdhuaC5kqvJiZY8o", + "1oe3BLWbO/z1z+DsVjFALyMrMleP84hzTkUuKILOfd+6rgVjLzT3msWgX9DW37lJyMLJto7c86q+cjHD", + "mEi4meLuKNh7KQl7imkWBNPXJkPElR67kNm2j8yrWic201oNppv2hNv8CtXPw07X6PtGn83J6XqqaQId", + "BEpK68CpJUzBrDgzd0l+MGx66uTwgDx58uQlsT3eIq/sKpErhyOqtPd3e8PM8yQV1tXUpTAjkkbUThFr", + "OFSILwg9agah6ojbrO1rOuKe6qDXIlxx9wg5srcYGsks5Mi8uiD9VXeSlrfVRfZDVvzfrKYp9pM6tQnq", + "J+ssafH7uIiKFkBISz5k/zY8A1YwcIwQ0ChII6q9/LftUK2ZzTzjQ/ZFClYduKTx6ezgli0j/DrpvED9", + "yoMbPNzg4QYPN3i4wcMNHm7wVrfBA2gFl7vKQCw2XMOQJhdWVCkP0Nb3pxTauGKHZ2N+CK45mBHYPZOP", + "PtEie3qyUFeULZcr8DULiUxtSW5bA2a2MjLzAcJVFC1teTId3aJFjjQZgdmwzmIXYqXLjHgMirdl+y4k", + "XfeRudaAyxwYFLuGTVSo0m7eZ7DX++Sb72J9uCrt/tV0U1WclslSi33rj+OLhtA0iuQIFn4bRCSvgNv4", + "GyIDSHQ2GqE0L6RkcV9JRTCwMXV0dSxAv+3lPQhKXhXoAiZIYZLCq9/LU4rV+/hV9s0SUS7QhgMxGTEZ", + "MRkxGTEZMfkmmPy92VAsSBOuM4MjBiAOIpmGZ/KCib1UDxq7f33Nnx5IecFZ/viryWxGyqJMuYmQodFs", + "pEnU2G0MtI7VbrstYyasujKA36d1eO9kQKOpfNs7P7c6rU5re/fFixcvGqZq94bfPOV8lImmEZTonuzF", + "sSr++4PUvOeX8Ym+KCSb1WWFZAfuppNSFfvu86rP9jGiMyuHw5Xik/cWFgtPXrFu2i8+yO8Z/P71+/8P", + "AAD//8+w28fXVgYA", } // GetSwagger returns the content of the embedded swagger specification file diff --git a/api/openapi.yaml b/api/openapi.yaml index 2b2605273..c85a0fa36 100644 --- a/api/openapi.yaml +++ b/api/openapi.yaml @@ -333,20 +333,19 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/customer/{customerIdOrKey}: + /api/v1/billing/customer/{customerId}: post: operationId: billingUpsertCustomerOverride summary: Create/update a customer override description: Create/update a new customer override. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ responses: '200': description: The request has succeeded. @@ -415,14 +414,13 @@ paths: summary: Get a customer override description: Get a customer override by id. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ responses: '200': description: The request has succeeded. @@ -479,14 +477,13 @@ paths: summary: Delete a customer override description: Delete a customer override by id. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ responses: '204': description: 'There is no content to send for this request, but the headers may be useful. ' @@ -547,14 +544,9 @@ paths: type: array items: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - description: |- - ULID (Universally Unique Lexicographically Sortable Identifier). - A key is a unique string that is used to identify a resource. - - TODO: this is a temporary solution to support both ULID and Key in the same spec for codegen. + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). title: Filter by the customer ID or key explode: false - $ref: '#/components/parameters/BillingInvoiceListParams.statuses' @@ -612,34 +604,33 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}: + /api/v1/billing/invoices/{customerId}: post: operationId: billingCreateInvoice summary: Create an invoice description: |- - Create a new invoice from the pending items. + Create a new invoice from the pending line items. This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle. - When creating an invoice, the pending items will be marked as invoiced and the invoice will be created with the total amount of the pending items. + When creating an invoice, the pending line items will be marked as invoiced and the invoice will be created with the total amount of the pending items. - New pending items will be created for the period between now() and the next billing cycle's begining date for any metered item. + New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ responses: '201': description: The request has succeeded and a new resource has been created as a result. content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -689,14 +680,13 @@ paths: summary: List invoices description: List invoices for a specific customer parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - $ref: '#/components/parameters/BillingInvoiceListParams.statuses' - $ref: '#/components/parameters/BillingInvoiceListParams.issuedAfter' - $ref: '#/components/parameters/BillingInvoiceListParams.issuedBefore' @@ -752,20 +742,19 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}: get: operationId: billingGetInvoiceByCustomerInvoiceId summary: Get an invoice description: Get an invoice by ID. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -773,13 +762,23 @@ paths: type: string example: 01G65Z755AFWAKHE12NY0CQ9FH pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + - name: expand + in: query + required: true + schema: + type: array + items: + $ref: '#/components/schemas/BillingInvoiceExpand' + default: + - lines + explode: false responses: '200': description: The request has succeeded. content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -832,14 +831,13 @@ paths: Only invoices that are in the draft (or earlier) status can be deleted. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -894,7 +892,7 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/approve: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/approve: post: operationId: billingApproveInvoice summary: Send the invoice to the customer @@ -907,14 +905,13 @@ paths: - `draft`: the invoice will be sent to the customer, the invluce state becomes issued - `manual_approval_needed`: the invoice will be sent to the customer, the invoice state becomes issued parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -928,7 +925,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -973,20 +970,19 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/lines/{lineId}: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/lines/{lineId}: delete: operationId: billingDeleteInvoiceLine summary: Delete an invoice line description: Delete an invoice line parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -1053,14 +1049,13 @@ paths: summary: Update an invoice line description: Update an invoice line parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -1132,7 +1127,7 @@ paths: application/json: schema: $ref: '#/components/schemas/BillingInvoiceLineCreateOrUpdate' - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/tax/recalculate: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/tax/recalculate: post: operationId: billingRecalculateInvoiceTax summary: Recalculate an invoice's tax amounts @@ -1141,14 +1136,13 @@ paths: Note: charges might apply, depending on the tax provider. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -1162,7 +1156,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -1207,7 +1201,7 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/void: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/void: post: operationId: billingVoidInvoice summary: Void an invoice @@ -1216,16 +1210,15 @@ paths: Only invoices that have been alread issued can be voided. - Voiding an invoice will mark it as voided, the user can specify how to handle the voided items. + Voiding an invoice will mark it as voided, the user can specify how to handle the voided line items. parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -1239,7 +1232,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -1290,7 +1283,7 @@ paths: application/json: schema: $ref: '#/components/schemas/BillingVoidInvoiceInput' - /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}/workflow/advance: + /api/v1/billing/invoices/{customerId}/invoices/{invoiceId}/workflow/advance: post: operationId: billingInvoiceWorkflowAdvance summary: Advance the invoice's state to the next status @@ -1306,14 +1299,13 @@ paths: - `issuing_failed` - `validation_failed` parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - name: invoiceId in: path required: true @@ -1327,7 +1319,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -1372,38 +1364,37 @@ paths: $ref: '#/components/schemas/UnexpectedProblemResponse' tags: - Billing (Experimental) - /api/v1/billing/invoices/{customerIdOrKey}/items: + /api/v1/billing/invoices/{customerId}/lines: post: - operationId: billingCreatePendingItemByCustomer - summary: Create a new pending item + operationId: billingCreateLineByCustomer + summary: Create line items description: |- Create a new pending line item (charge). This call is used to create a new pending line item for the customer without explicitly assigning it to an invoice. - The item will be either allocated to an existing invoice in gathering state or a new invoice is - created for the item. + The line item will be either allocated to an existing invoice in gathering state or a new invoice is + created for the line item. A new invoice will be created if: - there is no invoice in gathering state - - the currency of the item doesn't match the currency of any invoices in gathering state + - the currency of the line item doesn't match the currency of any invoices in gathering state parameters: - - name: customerIdOrKey + - name: customerId in: path required: true schema: type: string - minLength: 1 - maxLength: 64 - pattern: ^[a-z0-9]+(?:_[a-z0-9]+)*$|^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ responses: '201': description: The request has succeeded and a new resource has been created as a result. content: application/json: schema: - $ref: '#/components/schemas/BillingCreatePendingItemResponse' + $ref: '#/components/schemas/BillingCreateLineResult' '400': description: The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing). content: @@ -1447,7 +1438,7 @@ paths: content: application/json: schema: - $ref: '#/components/schemas/BillingInvoiceLineCreate' + $ref: '#/components/schemas/BillingCreateLinesRequest' /api/v1/billing/profile: get: operationId: billingListProfiles @@ -1460,6 +1451,14 @@ paths: type: boolean default: false explode: false + - name: expand + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/BillingProfileExpand' + explode: false - $ref: '#/components/parameters/Pagination.page' - $ref: '#/components/parameters/Pagination.pageSize' - $ref: '#/components/parameters/LimitOffset.offset' @@ -1639,6 +1638,14 @@ paths: required: true schema: type: string + - name: expand + in: query + required: false + schema: + type: array + items: + $ref: '#/components/schemas/BillingProfileExpand' + explode: false responses: '200': description: The request has succeeded. @@ -7336,6 +7343,20 @@ components: maxItems: 1000 description: The items in the page. description: A page of results. + AppReference: + type: object + required: + - id + properties: + id: + type: string + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). + description: |- + App reference + + Can be used as a short reference to an app if the full app object is not needed. AppStatus: type: string enum: @@ -7375,21 +7396,28 @@ components: description: The entitlement balance at the start of the period. readOnly: true description: The balance history window. - BillingCreatePendingItemResponse: + BillingCreateLineResult: type: object required: - - item - - invoice + - lines properties: - item: - allOf: - - $ref: '#/components/schemas/BillingInvoiceLine' - title: The created pending charge - invoice: - allOf: - - $ref: '#/components/schemas/BillingInvoiceSummary' - title: The invoice the item was added to + lines: + type: array + items: + $ref: '#/components/schemas/BillingInvoiceLine' + title: The created line items description: Response for creating a pending charge + BillingCreateLinesRequest: + type: object + required: + - lines + properties: + lines: + type: array + items: + $ref: '#/components/schemas/BillingInvoiceLineCreateItem' + title: The line to create + description: CreateLinesRequest is the request for creating manual line items. BillingCreditNoteOriginalInvoiceRef: type: object required: @@ -7574,147 +7602,319 @@ components: - $ref: '#/components/schemas/CurrencyCode' title: If different from the parent document's base currency. title: DueDate contains an amount that should be paid by the given date. - BillingGenericDocumentRef: + BillingFlatFeeLine: type: object required: + - name + - createdAt + - updatedAt + - id + - status + - currency + - total + - period + - invoiceAt - type + - item properties: - type: - allOf: - - $ref: '#/components/schemas/BillingDocumentRefType' - title: Type of the document referenced. - reason: + name: type: string - title: Human readable description on why this reference is here or needs to be used. + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name description: type: string - title: Additional details about the document. - description: |- - Omitted fields: - period: Tax period in which the referred document had an effect required by some tax regimes and formats. - stamps: Seals of approval from other organisations that may need to be listed. - ext: Extensions for additional codes that may be required. - title: DocumentRef is used to describe an existing document or a specific part of it's contents. - BillingGenericPaymentTerms: - type: object - required: - - type - properties: - type: + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: allOf: - - $ref: '#/components/schemas/BillingPaymentTermType' - title: Type of terms to be applied. - detail: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata + createdAt: type: string - title: Text detail of the chosen payment terms. - notes: + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was created. + title: Creation Time + readOnly: true + updatedAt: type: string - title: Description of the conditions for payment. - discriminator: - propertyName: type - mapping: - due_date: '#/components/schemas/BillingPaymentTermDueDate' - title: Terms defines when we expect the customer to pay, or have paid, for the contents of the document. - BillingInvoiceCreateInput: - type: object - properties: - IncludePendingItems: + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was last updated. + title: Last Update Time + readOnly: true + deletedAt: + type: string + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was permanently deleted. + title: Deletion Time + readOnly: true + id: + type: string + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). + status: + $ref: '#/components/schemas/BillingLineStatus' + discounts: type: array items: - type: string - example: 01G65Z755AFWAKHE12NY0CQ9FH - pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ - description: ULID (Universally Unique Lexicographically Sortable Identifier). - description: The pending items to include in the invoice, if not provided all pending items will be included. - BillingInvoiceDiscount: - type: object - required: - - amount - properties: - base: + $ref: '#/components/schemas/BillingLineDiscount' + title: Discounts applied to this line. + charges: + type: array + items: + $ref: '#/components/schemas/BillingLineCharge' + title: Charges applied to this line. + invoice: allOf: - - $ref: '#/components/schemas/Numeric' - title: Base represents the value used as a base for percent calculations instead of the invoice's sum of lines. - percent: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: allOf: - - $ref: '#/components/schemas/Percentage' - title: Percentage to apply to the base or invoice's sum. - amount: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line + taxes: + type: array + items: + $ref: '#/components/schemas/BillingTaxItem' + title: Map of taxes to be applied and used in the invoice totals. + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. + total: allOf: - $ref: '#/components/schemas/Numeric' - title: Amount to apply (calculated if percent present). - reason: + title: Total sum of the line, including discounts and charges. + readOnly: true + period: + allOf: + - $ref: '#/components/schemas/BillingPeriod' + title: Period of the line item applies to for revenue recognition pruposes. + invoiceAt: type: string - title: Text description as to why the discount was applied - title: Discount represents an allowance applied to the complete document independent from the individual lines. - BillingInvoiceExpand: - type: string - enum: - - lines - - customer - - supplier - - preceding - - '*' - description: InvoiceExpand specifies the parts of the invoice to expand in the list output. - BillingInvoiceLine: - type: object - allOf: - - $ref: '#/components/schemas/BillingUnitPriceLine' - title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. - BillingInvoiceLineCreate: + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - flat_fee + item: + allOf: + - $ref: '#/components/schemas/RateCardFlatFee' + title: Details about what is being sold. + description: |- + BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. + + This object represents an item added via subscriptions. + BillingFlatFeeLineCreateItem: type: object - allOf: - - $ref: '#/components/schemas/BillingUnitPriceLineCreate' - title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. - BillingInvoiceLineCreateOrUpdate: + required: + - name + - currency + - period + - invoiceAt + - type + - item + properties: + name: + type: string + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name + description: + type: string + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata + discounts: + type: array + items: + $ref: '#/components/schemas/BillingLineDiscount' + title: Discounts applied to this line. + charges: + type: array + items: + $ref: '#/components/schemas/BillingLineCharge' + title: Charges applied to this line. + invoice: + allOf: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: + allOf: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. + period: + allOf: + - $ref: '#/components/schemas/BillingPeriod' + title: Period of the line item applies to for revenue recognition pruposes. + invoiceAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - flat_fee + item: + allOf: + - $ref: '#/components/schemas/RateCardFlatFee' + title: Details about what is being sold. + description: |- + BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. + + This object represents an item added via subscriptions. + BillingFlatFeeLineCreateOrUpdate: type: object - allOf: - - $ref: '#/components/schemas/BillingUnitPriceLineCreateOrUpdate' - title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. - BillingInvoiceNumber: - type: string - example: INV-2024-01-01-01 - minLength: 1 - maxLength: 256 + required: + - name + - id + - currency + - period + - invoiceAt + - type + - item + properties: + name: + type: string + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name + description: + type: string + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata + id: + type: string + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). + discounts: + type: array + items: + $ref: '#/components/schemas/BillingLineDiscount' + title: Discounts applied to this line. + charges: + type: array + items: + $ref: '#/components/schemas/BillingLineCharge' + title: Charges applied to this line. + invoice: + allOf: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: + allOf: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. + period: + allOf: + - $ref: '#/components/schemas/BillingPeriod' + title: Period of the line item applies to for revenue recognition pruposes. + invoiceAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - flat_fee + item: + allOf: + - $ref: '#/components/schemas/RateCardFlatFee' + title: Details about what is being sold. description: |- - InvoiceNumber is a unique identifier for the invoice, generated by the - invoicing app. + BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. - The uniqueness depends on a lot of factors: - - app setting (unique per app or unique per customer) - - multiple app scenarios (multiple apps generating invoices with the same prefix) - BillingInvoiceOrderBy: - type: string - enum: - - customer.name - - issuedAt - - status - - createdAt - - updatedAt - description: InvoiceOrderBy specifies the ordering options for invoice listing. - BillingInvoicePayment: + This object represents an item added via subscriptions. + BillingGenericDocumentRef: type: object + required: + - type properties: - terms: - $ref: '#/components/schemas/BillingPaymentTerms' - title: Payment contains details as to how the invoice should be paid. - BillingInvoiceStatus: - type: string - enum: - - gathering - - review - - issued - - payment_received - - manual_approval_required - - validation_failed - description: InvoiceStatus describes the status of an invoice. - BillingInvoiceSummary: + type: + allOf: + - $ref: '#/components/schemas/BillingDocumentRefType' + title: Type of the document referenced. + reason: + type: string + title: Human readable description on why this reference is here or needs to be used. + description: + type: string + title: Additional details about the document. + description: |- + Omitted fields: + period: Tax period in which the referred document had an effect required by some tax regimes and formats. + stamps: Seals of approval from other organisations that may need to be listed. + ext: Extensions for additional codes that may be required. + title: DocumentRef is used to describe an existing document or a specific part of it's contents. + BillingGenericPaymentTerms: + type: object + required: + - type + properties: + type: + allOf: + - $ref: '#/components/schemas/BillingPaymentTermType' + title: Type of terms to be applied. + detail: + type: string + title: Text detail of the chosen payment terms. + notes: + type: string + title: Description of the conditions for payment. + discriminator: + propertyName: type + mapping: + due_date: '#/components/schemas/BillingPaymentTermDueDate' + title: Terms defines when we expect the customer to pay, or have paid, for the contents of the document. + BillingInvoice: type: object required: - id - - name - createdAt - updatedAt + - type - supplier - customer - currency @@ -7728,12 +7928,6 @@ components: description: A unique identifier for the resource. title: ID readOnly: true - name: - type: string - minLength: 1 - maxLength: 256 - description: Human-readable name for the resource. Between 1 and 256 characters. - title: Display name description: type: string maxLength: 1024 @@ -7817,14 +8011,38 @@ components: - draft, gathering: The time the invoice will be issued based on the workflow settings. - issued: The time the invoice was issued. title: The time the invoice was issued. + dueAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: Due time of the fulfillment of the invoice. + period: + allOf: + - $ref: '#/components/schemas/BillingPeriod' + title: The period the invoice covers. If the invoice has no line items, it's not set. + voidedAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: |- + The time the invoice was voided. + + If the invoice was voided, this field will be set to the time the invoice was voided. + title: The time the invoice was voided. workflow: allOf: - $ref: '#/components/schemas/BillingInvoiceWorkflowSettings' + description: |- + The workflow associated with the invoice. + + It is always a snapshot of the workflow settings at the time of invoice creation. The + field is optional as it should be explicitly requested with expand options. title: The workflow settings associated with this invoice lines: type: array items: - $ref: '#/components/schemas/BillingLine' + $ref: '#/components/schemas/BillingInvoiceLine' title: List of invoice lines representing each of the items sold to the customer. discounts: type: array @@ -7835,7 +8053,149 @@ components: allOf: - $ref: '#/components/schemas/BillingInvoicePayment' title: Information on when, how, and to whom the invoice should be paid. - title: Invoice summary represents an extract of the invoice object + title: Invoice represents an invoice in the system. + BillingInvoiceCreateInput: + type: object + properties: + IncludePendingLines: + type: array + items: + type: string + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). + description: |- + The pending line items to include in the invoice, if not provided: + - all line items that have invoice_at < asOf will be included + - all usage based line items will be included up to asOf, new usage-based line items will be staged for the rest + of the billing cycle + AsOf: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: |- + The time as of which the invoice is created. + + If not provided, the current time is used. + BillingInvoiceDiscount: + type: object + required: + - amount + properties: + base: + allOf: + - $ref: '#/components/schemas/Numeric' + title: Base represents the value used as a base for percent calculations instead of the invoice's sum of lines. + percent: + allOf: + - $ref: '#/components/schemas/Percentage' + title: Percentage to apply to the base or invoice's sum. + amount: + allOf: + - $ref: '#/components/schemas/Numeric' + title: Amount to apply (calculated if percent present). + reason: + type: string + title: Text description as to why the discount was applied + title: Discount represents an allowance applied to the complete document independent from the individual lines. + BillingInvoiceExpand: + type: string + enum: + - '*' + - lines + - preceding + - workflow + - workflow.apps + description: InvoiceExpand specifies the parts of the invoice to expand in the list output. + x-enum-varnames: + - all + - lines + - preceding + - workflow + - workflowApps + BillingInvoiceLine: + anyOf: + - $ref: '#/components/schemas/BillingFlatFeeLine' + - $ref: '#/components/schemas/BillingManualFeeLine' + discriminator: + propertyName: type + mapping: + flat_fee: '#/components/schemas/BillingFlatFeeLine' + manual_fee: '#/components/schemas/BillingManualFeeLine' + title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. + BillingInvoiceLineCreateItem: + anyOf: + - $ref: '#/components/schemas/BillingFlatFeeLineCreateItem' + - $ref: '#/components/schemas/BillingManualFeeLineCreateItem' + discriminator: + propertyName: type + mapping: + flat_fee: '#/components/schemas/BillingFlatFeeLineCreateItem' + manual_fee: '#/components/schemas/BillingManualFeeLineCreateItem' + title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. + BillingInvoiceLineCreateOrUpdate: + anyOf: + - $ref: '#/components/schemas/BillingFlatFeeLineCreateOrUpdate' + - $ref: '#/components/schemas/BillingManualFeeLineCreateOrUpdate' + discriminator: + propertyName: type + mapping: + flat_fee: '#/components/schemas/BillingFlatFeeLineCreateOrUpdate' + manual_fee: '#/components/schemas/BillingManualFeeLineCreateOrUpdate' + title: UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price. + BillingInvoiceNumber: + type: string + example: INV-2024-01-01-01 + minLength: 1 + maxLength: 256 + description: |- + InvoiceNumber is a unique identifier for the invoice, generated by the + invoicing app. + + The uniqueness depends on a lot of factors: + - app setting (unique per app or unique per customer) + - multiple app scenarios (multiple apps generating invoices with the same prefix) + BillingInvoiceOrderBy: + type: string + enum: + - customer.name + - issuedAt + - status + - createdAt + - updatedAt + description: InvoiceOrderBy specifies the ordering options for invoice listing. + BillingInvoicePayment: + type: object + properties: + terms: + $ref: '#/components/schemas/BillingPaymentTerms' + title: Payment contains details as to how the invoice should be paid. + BillingInvoiceReference: + type: object + required: + - id + properties: + id: + type: string + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ + description: ULID (Universally Unique Lexicographically Sortable Identifier). + title: The ID of the invoice. + number: + allOf: + - $ref: '#/components/schemas/BillingInvoiceNumber' + title: The number of the invoice. + title: Reference to an invoice. + BillingInvoiceStatus: + type: string + enum: + - gathering + - review + - issued + - payment_received + - manual_approval_required + - validation_failed + description: InvoiceStatus describes the status of an invoice. BillingInvoiceTotals: type: object required: @@ -7893,45 +8253,146 @@ components: type: string enum: - standard - - credit-note + - credit_note BillingInvoiceWorkflowSettings: type: object required: - - autoAdvance + - sourceBillingProfileID + - workflow + - timezone properties: - autoAdvance: - type: boolean - description: updatedAt is the time when the invoice workflow was last updated. - title: Should the invoice auto advance to the next status? - draftUtil: + apps: + allOf: + - $ref: '#/components/schemas/BillingProfileAppsOrReference' + title: The apps that will be used to orchestrate the invoice's workflow. + sourceBillingProfileID: type: string - format: date-time - example: 2023-01-01T01:01:01.001Z + example: 01G65Z755AFWAKHE12NY0CQ9FH + pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ description: |- - The invoice stays in the draft status until this time. + sourceBillingProfileID is the billing profile on which the workflow was based on. - If auto advance is disabled the value will be empty. - dueAfter: + The profile is snapshotted on invoice creation, after which it can be altered independently + of the profile itself. + title: The billing profile on which the workflow was based on. + workflow: + allOf: + - $ref: '#/components/schemas/BillingWorkflowSettings' + title: The workflow details used by this invoice. + timezone: type: string - format: ISO8601 - example: P1D - description: The period after which the invoice is due. - default: P7D - BillingLine: + title: Timezone of the invoice's date fields. + BillingLineCharge: + type: object + required: + - amount + properties: + percent: + allOf: + - $ref: '#/components/schemas/Percentage' + description: Percentage if fixed amount not applied + title: Percent + amount: + allOf: + - $ref: '#/components/schemas/Numeric' + description: Fixed discount amount to apply (calculated if percent present). + title: Amount + code: + type: string + title: Reason code. + reason: + type: string + title: Text description as to why the discount was applied. + title: LineCharge represents an amount added to the line, and will be applied before taxes. + BillingLineDiscount: + type: object + required: + - amount + properties: + percent: + allOf: + - $ref: '#/components/schemas/Percentage' + description: Percentage if fixed amount not applied + title: Percent + amount: + allOf: + - $ref: '#/components/schemas/Numeric' + description: Fixed discount amount to apply (calculated if percent present). + title: Amount + code: + type: string + title: Reason code. + reason: + type: string + title: Text description as to why the discount was applied. + title: LineDiscount represents an amount deducted from the line, and will be applied before taxes. + BillingLineStatus: + type: string + enum: + - valid + - deleted + - split + title: Line status specifies the status of the line. + BillingManualFeeLine: type: object required: + - name + - createdAt + - updatedAt - id - - type + - status + - currency - total - period + - invoiceAt + - type + - price + - quantity properties: + name: + type: string + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name + description: + type: string + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata + createdAt: + type: string + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was created. + title: Creation Time + readOnly: true + updatedAt: + type: string + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was last updated. + title: Last Update Time + readOnly: true + deletedAt: + type: string + format: date-time + example: 2024-01-01T01:01:01.001Z + description: Timestamp of when the resource was permanently deleted. + title: Deletion Time + readOnly: true id: type: string example: 01G65Z755AFWAKHE12NY0CQ9FH pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ description: ULID (Universally Unique Lexicographically Sortable Identifier). - type: - $ref: '#/components/schemas/BillingLineTypes' + status: + $ref: '#/components/schemas/BillingLineStatus' discounts: type: array items: @@ -7942,11 +8403,25 @@ components: items: $ref: '#/components/schemas/BillingLineCharge' title: Charges applied to this line. + invoice: + allOf: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: + allOf: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line taxes: type: array items: $ref: '#/components/schemas/BillingTaxItem' title: Map of taxes to be applied and used in the invoice totals. + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. total: allOf: - $ref: '#/components/schemas/Numeric' @@ -7956,44 +8431,52 @@ components: allOf: - $ref: '#/components/schemas/BillingPeriod' title: Period of the line item applies to for revenue recognition pruposes. - discriminator: - propertyName: type - mapping: - unit_price: '#/components/schemas/BillingUnitPriceLine' - description: |- - Line represents a single item or service sold to the customer. - - This is a base class for all line types, and should not be used directly. - BillingLineCharge: - type: object - required: - - amount - properties: - percent: + invoiceAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - manual_fee + price: allOf: - - $ref: '#/components/schemas/Percentage' - description: Percentage if fixed amount not applied - title: Percent - amount: + - $ref: '#/components/schemas/Numeric' + title: Price of the item being sold. + quantity: allOf: - $ref: '#/components/schemas/Numeric' - description: Fixed discount amount to apply (calculated if percent present). - title: Amount - code: - type: string - title: Reason code. - reason: - type: string - title: Text description as to why the discount was applied. - title: LineCharge represents an amount added to the line, and will be applied before taxes. - BillingLineCreate: + title: Quantity of the item being sold. + description: BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. + BillingManualFeeLineCreateItem: type: object required: - - type + - name + - currency - period + - invoiceAt + - type + - price + - quantity properties: - type: - $ref: '#/components/schemas/BillingLineTypes' + name: + type: string + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name + description: + type: string + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata discounts: type: array items: @@ -8004,31 +8487,76 @@ components: items: $ref: '#/components/schemas/BillingLineCharge' title: Charges applied to this line. + invoice: + allOf: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: + allOf: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. period: allOf: - $ref: '#/components/schemas/BillingPeriod' title: Period of the line item applies to for revenue recognition pruposes. - discriminator: - propertyName: type - mapping: {} - description: |- - Line represents a single item or service sold to the customer. - - This is a base class for all line types, and should not be used directly. - BillingLineCreateOrUpdate: + invoiceAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - manual_fee + price: + allOf: + - $ref: '#/components/schemas/Numeric' + title: Price of the item being sold. + quantity: + allOf: + - $ref: '#/components/schemas/Numeric' + title: Quantity of the item being sold. + description: BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. + BillingManualFeeLineCreateOrUpdate: type: object required: + - name - id - - type + - currency - period + - invoiceAt + - type + - price + - quantity properties: + name: + type: string + minLength: 1 + maxLength: 256 + description: Human-readable name for the resource. Between 1 and 256 characters. + title: Display name + description: + type: string + maxLength: 1024 + description: Optional description of the resource. Maximum 1024 characters. + title: Description + metadata: + allOf: + - $ref: '#/components/schemas/Metadata' + description: Additional metadata for the resource. + title: Metadata id: type: string example: 01G65Z755AFWAKHE12NY0CQ9FH pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ description: ULID (Universally Unique Lexicographically Sortable Identifier). - type: - $ref: '#/components/schemas/BillingLineTypes' discounts: type: array items: @@ -8039,48 +8567,45 @@ components: items: $ref: '#/components/schemas/BillingLineCharge' title: Charges applied to this line. + invoice: + allOf: + - $ref: '#/components/schemas/BillingInvoiceReference' + title: The invoice this item belongs to. + currency: + allOf: + - $ref: '#/components/schemas/CurrencyCode' + title: The currency of this line + taxOverrides: + type: object + allOf: + - $ref: '#/components/schemas/TaxConfig' + nullable: true + title: Tax overrides specify the tax configuration for this line. period: allOf: - $ref: '#/components/schemas/BillingPeriod' title: Period of the line item applies to for revenue recognition pruposes. - discriminator: - propertyName: type - mapping: {} - description: |- - Line represents a single item or service sold to the customer. - - This is a base class for all line types, and should not be used directly. - BillingLineDiscount: - type: object - required: - - amount - properties: - percent: + invoiceAt: + type: string + format: date-time + example: 2023-01-01T01:01:01.001Z + description: '[RFC3339](https://tools.ietf.org/html/rfc3339) formatted date-time string in UTC.' + title: The time this line item should be invoiced. + type: + type: string + enum: + - manual_fee + price: allOf: - - $ref: '#/components/schemas/Percentage' - description: Percentage if fixed amount not applied - title: Percent - amount: + - $ref: '#/components/schemas/Numeric' + title: Price of the item being sold. + quantity: allOf: - $ref: '#/components/schemas/Numeric' - description: Fixed discount amount to apply (calculated if percent present). - title: Amount - code: - type: string - title: Reason code. - reason: - type: string - title: Text description as to why the discount was applied. - title: LineDiscount represents an amount deducted from the line, and will be applied before taxes. - BillingLineTypes: - type: string - enum: - - unit_price - title: LineTypes represents the different types of lines that can be used in an invoice. + title: Quantity of the item being sold. + description: BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. BillingParty: type: object - required: - - id properties: id: type: string @@ -8253,12 +8778,32 @@ components: title: The billing workflow settings for this profile apps: allOf: - - $ref: '#/components/schemas/BillingProfileApps' + - $ref: '#/components/schemas/BillingProfileAppsOrReference' title: The applications used by this billing profile default: type: boolean title: Is this the default profile? description: Profile represents a billing profile + BillingProfileAppReferences: + type: object + required: + - tax + - invoicing + - payment + properties: + tax: + allOf: + - $ref: '#/components/schemas/AppReference' + title: The tax app used for this workflow + invoicing: + allOf: + - $ref: '#/components/schemas/AppReference' + title: The invoicing app used for this workflow + payment: + allOf: + - $ref: '#/components/schemas/AppReference' + title: The payment app used for this workflow + description: ProfileAppsReference represents the references (id, type) to the apps used by a billing profile BillingProfileApps: type: object required: @@ -8279,6 +8824,10 @@ components: - $ref: '#/components/schemas/App' title: The payment app used for this workflow description: ProfileApps represents the applications used by a billing profile + BillingProfileAppsOrReference: + anyOf: + - $ref: '#/components/schemas/BillingProfileApps' + - $ref: '#/components/schemas/BillingProfileAppReferences' BillingProfileCreateAppsInput: type: object required: @@ -8384,6 +8933,15 @@ components: type: boolean title: Is this the default profile? description: Profile represents a billing profile + BillingProfileExpand: + type: string + enum: + - apps + - '*' + description: ProfileExpand details what profile fields to expand + x-enum-varnames: + - apps + - all BillingProfileOrderBy: type: string enum: @@ -8432,81 +8990,6 @@ components: allOf: - $ref: '#/components/schemas/BillingTaxBehavior' title: Is the tax item inclusive or exclusive of the base amount. - BillingUnitPriceLine: - type: object - required: - - type - - item - - quantity - properties: - type: - type: string - enum: - - unit_price - item: - allOf: - - $ref: '#/components/schemas/RateCard' - title: Details about what is being sold. - quantity: - allOf: - - $ref: '#/components/schemas/Numeric' - title: Quantity of the item being sold. - allOf: - - $ref: '#/components/schemas/BillingLine' - description: |- - UnitPriceLine represents a line item that is sold to the customer based on a unit price. - - This is analogous to gobl's Line model, with the addition of the type and some metadata fields. - BillingUnitPriceLineCreate: - type: object - required: - - type - - item - - quantity - properties: - type: - type: string - enum: - - unit_price - item: - allOf: - - $ref: '#/components/schemas/RateCard' - title: Details about what is being sold. - quantity: - allOf: - - $ref: '#/components/schemas/Numeric' - title: Quantity of the item being sold. - allOf: - - $ref: '#/components/schemas/BillingLineCreate' - description: |- - UnitPriceLine represents a line item that is sold to the customer based on a unit price. - - This is analogous to gobl's Line model, with the addition of the type and some metadata fields. - BillingUnitPriceLineCreateOrUpdate: - type: object - required: - - type - - item - - quantity - properties: - type: - type: string - enum: - - unit_price - item: - allOf: - - $ref: '#/components/schemas/RateCard' - title: Details about what is being sold. - quantity: - allOf: - - $ref: '#/components/schemas/Numeric' - title: Quantity of the item being sold. - allOf: - - $ref: '#/components/schemas/BillingLineCreateOrUpdate' - description: |- - UnitPriceLine represents a line item that is sold to the customer based on a unit price. - - This is analogous to gobl's Line model, with the addition of the type and some metadata fields. BillingVoidInvoiceAction: type: object required: @@ -8516,62 +8999,62 @@ components: percentage: allOf: - $ref: '#/components/schemas/Percentage' - title: How much of the total items to be voided? (e.g. 100% means all charges are voided) + title: How much of the total line items to be voided? (e.g. 100% means all charges are voided) action: allOf: - - $ref: '#/components/schemas/BillingVoidInvoiceItemAction' - title: 'How to handle the voided items, default: pending' - description: InvoiceVoidAction describes how to handle the voided items. + - $ref: '#/components/schemas/BillingVoidInvoiceLineAction' + title: 'How to handle the voided line items, default: pending' + description: InvoiceVoidAction describes how to handle the voided line items. BillingVoidInvoiceInput: type: object required: - action - reason - - itemOverrides + - overrides properties: action: allOf: - - $ref: '#/components/schemas/BillingVoidInvoiceItemAction' - description: The action to take on the voided items. - title: The action to take on the voided items + - $ref: '#/components/schemas/BillingVoidInvoiceAction' + description: The action to take on the voided line items. + title: The action to take on the voided lines. reason: type: string description: The reason for voiding the invoice. title: The reason for voiding the invoice - itemOverrides: + overrides: type: array items: - $ref: '#/components/schemas/BillingVoidInvoiceItemOverride' + $ref: '#/components/schemas/BillingVoidInvoiceLineOverride' nullable: true description: |- Per line item overrides for the action. - If not specified, the `action` will be applied to all items. + If not specified, the `action` will be applied to all line items. description: Request to void an invoice - BillingVoidInvoiceItemAction: + BillingVoidInvoiceLineAction: type: string enum: - discard - pending - pending_next_cycle - title: VoidInvoiceItemAction describes how to handle the voidied item in the invoice. - BillingVoidInvoiceItemOverride: + title: VoidInvoiceLineAction describes how to handle the voidied line item in the invoice. + BillingVoidInvoiceLineOverride: type: object required: - - itemId + - lineId - action properties: - itemId: + lineId: type: string example: 01G65Z755AFWAKHE12NY0CQ9FH pattern: ^[0-7][0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{25}$ description: ULID (Universally Unique Lexicographically Sortable Identifier). - title: The item ID to override + title: The line item ID to override action: allOf: - $ref: '#/components/schemas/BillingVoidInvoiceAction' - title: The action to take on the item - description: VoidInvoiceItemOverride describes how to handle a specific item in the invoice when voiding. + title: The action to take on the line item + description: VoidInvoiceLineOverride describes how to handle a specific line item in the invoice when voiding. BillingWorkflow: type: object required: @@ -8655,7 +9138,7 @@ components: example: P1D description: The interval for collecting the pending line items into an invoice. default: PT1H - title: Workflow collection specifies how to collect the pending items for an invoice + title: Workflow collection specifies how to collect the pending line items for an invoice BillingWorkflowInvoicingSettings: type: object properties: @@ -8686,6 +9169,21 @@ components: default: charge_automatically description: WorkflowPaymentSettings represents the payment settings for a billing workflow title: Workflow payment settings + BillingWorkflowSettings: + type: object + properties: + collection: + allOf: + - $ref: '#/components/schemas/BillingWorkflowCollectionSettings' + title: The collection settings for this workflow + invoicing: + allOf: + - $ref: '#/components/schemas/BillingWorkflowInvoicingSettings' + title: The invoicing settings for this workflow + payment: + allOf: + - $ref: '#/components/schemas/BillingWorkflowPaymentSettings' + title: The payment settings for this workflow CheckoutSessionCustomTextAfterSubmitParams: type: object properties: @@ -10316,7 +10814,7 @@ components: items: type: array items: - $ref: '#/components/schemas/BillingInvoiceSummary' + $ref: '#/components/schemas/BillingInvoice' description: The items in the current page. description: Paginated response ListEntitlementsResult: diff --git a/api/spec/src/app/app.tsp b/api/spec/src/app/app.tsp index 47fa89036..7dfe490ca 100644 --- a/api/spec/src/app/app.tsp +++ b/api/spec/src/app/app.tsp @@ -75,6 +75,16 @@ union App { sandbox: SandboxApp, } +/** + * App reference + * + * Can be used as a short reference to an app if the full app object is not needed. + */ +@friendlyName("AppReference") +model AppReference { + id: ULID; +} + /** * Abstract base model for installed apps. * diff --git a/api/spec/src/billing/customeroverride.tsp b/api/spec/src/billing/customeroverride.tsp index 9fe0efb43..ae805ab99 100644 --- a/api/spec/src/billing/customeroverride.tsp +++ b/api/spec/src/billing/customeroverride.tsp @@ -25,12 +25,12 @@ interface CustomerOverrides { * Create/update a new customer override. */ @post - @route("/{customerIdOrKey}") + @route("/{customerId}") @summary("Create/update a customer override") @operationId("billingUpsertCustomerOverride") upsert( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @body request: CustomerWorkflowOverride, @@ -54,24 +54,24 @@ interface CustomerOverrides { * Get a customer override by id. */ @get - @route("/{customerIdOrKey}") + @route("/{customerId}") @summary("Get a customer override") @operationId("billingGetCustomerOverrideById") get( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, ): CustomerOverride | OpenMeter.NotFoundError | OpenMeter.CommonErrors; /** * Delete a customer override by id. */ @delete - @route("/{customerIdOrKey}") + @route("/{customerId}") @summary("Delete a customer override") @operationId("billingDeleteCustomerOverride") delete( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, ): { @statusCode _: 204; } | OpenMeter.NotFoundError | OpenMeter.CommonErrors; diff --git a/api/spec/src/billing/invoices.tsp b/api/spec/src/billing/invoices.tsp index d47dcc891..cd78329d1 100644 --- a/api/spec/src/billing/invoices.tsp +++ b/api/spec/src/billing/invoices.tsp @@ -19,7 +19,7 @@ interface InvoiceEndpoints { list( @query @summary("Filter by the customer ID or key") - customers?: Array, + customers?: Array, ...InvoiceListParams, ...OpenMeter.QueryPagination, @@ -32,24 +32,24 @@ interface InvoiceEndpoints { * CustomerInvoices is a collection of endpoints that allow invoice operations without prior * knowledge of the invoice ID. */ -@route("/api/v1/billing/invoices/{customerIdOrKey}") +@route("/api/v1/billing/invoices/{customerId}") @tag("Billing (Experimental)") interface CustomerInvoicesEndpoints { /** - * Create a new invoice from the pending items. + * Create a new invoice from the pending line items. * * This should be only called if for some reason we need to invoice a customer outside of the normal billing cycle. * - * When creating an invoice, the pending items will be marked as invoiced and the invoice will be created with the total amount of the pending items. + * When creating an invoice, the pending line items will be marked as invoiced and the invoice will be created with the total amount of the pending items. * - * New pending items will be created for the period between now() and the next billing cycle's begining date for any metered item. + * New pending line items will be created for the period between now() and the next billing cycle's begining date for any metered item. */ @post @summary("Create an invoice") @operationId("billingCreateInvoice") create( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @body request: InvoiceCreateInput, @@ -65,7 +65,7 @@ interface CustomerInvoicesEndpoints { @summary("List invoices") @operationId("billingListInvoicesByCustomer") listInvoicesByCustomer( - @path customerIdOrKey: ULIDOrKey, + @path customerId: ULID, ...InvoiceListParams, ...OpenMeter.QueryPagination, ...OpenMeter.QueryLimitOffset, @@ -78,30 +78,27 @@ interface CustomerInvoicesEndpoints { * This call is used to create a new pending line item for the customer without explicitly * assigning it to an invoice. * - * The item will be either allocated to an existing invoice in gathering state or a new invoice is - * created for the item. + * The line item will be either allocated to an existing invoice in gathering state or a new invoice is + * created for the line item. * * A new invoice will be created if: * - there is no invoice in gathering state - * - the currency of the item doesn't match the currency of any invoices in gathering state + * - the currency of the line item doesn't match the currency of any invoices in gathering state */ @post - @route("/items") - @summary("Create a new pending item") - @operationId("billingCreatePendingItemByCustomer") - createPendingItem( - @path customerIdOrKey: ULIDOrKey, - @body request: Invoices.InvoiceLine, - ): { + @route("/lines") + @summary("Create line items") + @operationId("billingCreateLineByCustomer") + createLine(@path customerId: ULID, @body request: CreateLinesRequest): { @statusCode _: 201; - @body body: CreatePendingItemResponse; + @body body: CreateLineResult; } | OpenMeter.CommonErrors; } /** * CustomerInvoice is a collection of endpoints that allow operations on a specific invoice. */ -@route("/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}") +@route("/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}") @tag("Billing (Experimental)") interface CustomerInvoiceEndpoints { /** @@ -112,10 +109,13 @@ interface CustomerInvoiceEndpoints { @operationId("billingGetInvoiceByCustomerInvoiceId") getInvoice( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, + + @query + expand: InvoiceExpand[] = #[InvoiceExpand.lines], ): Invoices.Invoice | OpenMeter.NotFoundError | OpenMeter.CommonErrors; /** @@ -128,7 +128,7 @@ interface CustomerInvoiceEndpoints { @operationId("billingDeleteInvoiceByCustomerInvoiceId") deleteInvoice( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, @@ -148,7 +148,7 @@ interface CustomerInvoiceEndpoints { @operationId("billingRecalculateInvoiceTax") recalculateTax( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, @@ -172,7 +172,7 @@ interface CustomerInvoiceEndpoints { @operationId("billingApproveInvoice") approve( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, @@ -186,7 +186,7 @@ interface CustomerInvoiceEndpoints { * * Only invoices that have been alread issued can be voided. * - * Voiding an invoice will mark it as voided, the user can specify how to handle the voided items. + * Voiding an invoice will mark it as voided, the user can specify how to handle the voided line items. */ @post @route("/void") @@ -194,7 +194,7 @@ interface CustomerInvoiceEndpoints { @operationId("billingVoidInvoice") voidInvoice( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, @@ -224,7 +224,7 @@ interface CustomerInvoiceEndpoints { @operationId("billingInvoiceWorkflowAdvance") advanceWorkflow( @path - customerIdOrKey: ULIDOrKey, + customerId: ULID, @path invoiceId: ULID, @@ -243,7 +243,7 @@ interface CustomerInvoiceEndpoints { @summary("Delete an invoice line") @operationId("billingDeleteInvoiceLine") deleteInvoiceLine( - @path customerIdOrKey: ULIDOrKey, + @path customerId: ULID, @path invoiceId: ULID, @path lineId: ULID, ): { @@ -258,7 +258,7 @@ interface CustomerInvoiceEndpoints { @summary("Update an invoice line") @operationId("billingUpdateInvoiceLine") updateInvoiceLine( - @path customerIdOrKey: ULIDOrKey, + @path customerId: ULID, @path invoiceId: ULID, @path lineId: ULID, @body request: Invoices.InvoiceLine, @@ -288,15 +288,21 @@ enum InvoiceOrderBy { } /** - * Response for creating a pending charge + * CreateLinesRequest is the request for creating manual line items. */ -@friendlyName("BillingCreatePendingItemResponse") -model CreatePendingItemResponse { - @summary("The created pending charge") - item: Invoices.InvoiceLine; +@friendlyName("BillingCreateLinesRequest") +model CreateLinesRequest { + @summary("The line to create") + lines: Invoices.InvoiceLine[]; +} - @summary("The invoice the item was added to") - invoice: Invoices.Invoice; +/** + * Response for creating a pending charge + */ +@friendlyName("BillingCreateLineResult") +model CreateLineResult { + @summary("The created line items") + lines: Invoices.InvoiceLine[]; } /** @@ -305,10 +311,10 @@ model CreatePendingItemResponse { @friendlyName("BillingVoidInvoiceInput") model VoidInvoiceInput { /** - * The action to take on the voided items. + * The action to take on the voided line items. */ - @summary("The action to take on the voided items") - action: VoidInvoiceItemAction; + @summary("The action to take on the voided lines.") + action: VoidInvoiceAction; /** * The reason for voiding the invoice. @@ -319,45 +325,45 @@ model VoidInvoiceInput { /** * Per line item overrides for the action. * - * If not specified, the `action` will be applied to all items. + * If not specified, the `action` will be applied to all line items. */ - itemOverrides: VoidInvoiceItemOverride[] | null; + overrides: VoidInvoiceLineOverride[] | null; } /** - * InvoiceVoidAction describes how to handle the voided items. + * InvoiceVoidAction describes how to handle the voided line items. */ @friendlyName("BillingVoidInvoiceAction") model VoidInvoiceAction { - @summary("How much of the total items to be voided? (e.g. 100% means all charges are voided)") + @summary("How much of the total line items to be voided? (e.g. 100% means all charges are voided)") percentage: Percentage; - @summary("How to handle the voided items, default: pending") - action: VoidInvoiceItemAction; + @summary("How to handle the voided line items, default: pending") + action: VoidInvoiceLineAction; } -@summary("VoidInvoiceItemAction describes how to handle the voidied item in the invoice.") -@friendlyName("BillingVoidInvoiceItemAction") -enum VoidInvoiceItemAction { - @summary("The items will never be charged for again") +@summary("VoidInvoiceLineAction describes how to handle the voidied line item in the invoice.") +@friendlyName("BillingVoidInvoiceLineAction") +enum VoidInvoiceLineAction { + @summary("The line items will never be charged for again") discard: "discard", - @summary("Queue the items into the pending state, they will be included in the next invoice. (We want to generate an invoice right now)") + @summary("Queue the line items into the pending state, they will be included in the next invoice. (We want to generate an invoice right now)") pending: "pending", - @summary("Queue the items into the pending state, they will be included in the next invoice, but not in the current one") + @summary("Queue the line items into the pending state, they will be included in the next invoice, but not in the current one") pendingNextCycle: "pending_next_cycle", } /** - * VoidInvoiceItemOverride describes how to handle a specific item in the invoice when voiding. + * VoidInvoiceLineOverride describes how to handle a specific line item in the invoice when voiding. */ -@friendlyName("BillingVoidInvoiceItemOverride") -model VoidInvoiceItemOverride { - @summary("The item ID to override") - itemId: ULID; +@friendlyName("BillingVoidInvoiceLineOverride") +model VoidInvoiceLineOverride { + @summary("The line item ID to override") + lineId: ULID; - @summary("The action to take on the item") + @summary("The action to take on the line item") action: VoidInvoiceAction; } @@ -387,18 +393,32 @@ model InvoiceListParams { * InvoiceExpand specifies the parts of the invoice to expand in the list output. */ @friendlyName("BillingInvoiceExpand") +@extension( + "x-enum-varnames", + ["all", "lines", "preceding", "workflow", "workflowApps"] +) enum InvoiceExpand { + all: "*", lines: "lines", - customer: "customer", - supplier: "supplier", preceding: "preceding", - all: "*", + workflow: "workflow", + workflowApps: "workflow.apps", } @friendlyName("BillingInvoiceCreateInput") model InvoiceCreateInput { /** - * The pending items to include in the invoice, if not provided all pending items will be included. + * The pending line items to include in the invoice, if not provided: + * - all line items that have invoice_at < asOf will be included + * - all usage based line items will be included up to asOf, new usage-based line items will be staged for the rest + * of the billing cycle + */ + IncludePendingLines?: ULID[]; + + /** + * The time as of which the invoice is created. + * + * If not provided, the current time is used. */ - IncludePendingItems?: ULID[]; + AsOf?: DateTime; } diff --git a/api/spec/src/billing/invoices/invoice.tsp b/api/spec/src/billing/invoices/invoice.tsp index cb1b8cd7d..c645094d2 100644 --- a/api/spec/src/billing/invoices/invoice.tsp +++ b/api/spec/src/billing/invoices/invoice.tsp @@ -40,10 +40,10 @@ scalar InvoiceNumber extends string; * tax: Special tax configuration for billing. * -> The prices include is the meaningful part, but we should make that an array, let's see if we need this as we implement more features. */ -@summary("Invoice summary represents an extract of the invoice object") -@friendlyName("BillingInvoiceSummary") +@summary("Invoice represents an invoice in the system.") +@friendlyName("BillingInvoice") model Invoice { - ...OmitProperties; + ...OmitProperties; /** * Timestamp of when the resource was last updated. @@ -56,7 +56,7 @@ model Invoice { updatedAt: DateTime; @visibility("read", "query") - type?: InvoiceType; + type: InvoiceType; @summary("The taxable entity supplying the goods or services.") @visibility("read", "query", "update") @@ -106,6 +106,28 @@ model Invoice { @visibility("read", "query") issuedAt?: DateTime; + @summary("Due time of the fulfillment of the invoice.") + @visibility("read", "query") + dueAt?: DateTime; + + @summary("The period the invoice covers. If the invoice has no line items, it's not set.") + period?: Period; + + /** + * The time the invoice was voided. + * + * If the invoice was voided, this field will be set to the time the invoice was voided. + */ + @summary("The time the invoice was voided.") + @visibility("read", "query") + voidedAt?: DateTime; + + /** + * The workflow associated with the invoice. + * + * It is always a snapshot of the workflow settings at the time of invoice creation. The + * field is optional as it should be explicitly requested with expand options. + */ @summary("The workflow settings associated with this invoice") @visibility("read", "query", "update") workflow?: InvoiceWorkflowSettings; @@ -115,7 +137,7 @@ model Invoice { // TODO: we might want to group this by subscription, so that we don't have to add individual references // per line item, however that poses a problem, when a manually added line-item is added, as that should also be // bound to a subscription. - lines?: Line[]; + lines?: InvoiceLine[]; @summary("Discounts or allowances applied to the complete invoice.") @visibility("read", "query") // Seperate API endpoint is available for updating @@ -128,25 +150,24 @@ model Invoice { @friendlyName("BillingInvoiceWorkflowSettings") model InvoiceWorkflowSettings { - /** - * updatedAt is the time when the invoice workflow was last updated. - */ - @summary("Should the invoice auto advance to the next status?") - autoAdvance: boolean; + @summary("The apps that will be used to orchestrate the invoice's workflow.") + apps?: OpenMeter.Billing.ProfileAppsOrReference; /** - * The invoice stays in the draft status until this time. + * sourceBillingProfileID is the billing profile on which the workflow was based on. * - * If auto advance is disabled the value will be empty. + * The profile is snapshotted on invoice creation, after which it can be altered independently + * of the profile itself. */ - draftUtil?: DateTime; + @summary("The billing profile on which the workflow was based on.") + sourceBillingProfileID: ULID; - /** - * The period after which the invoice is due. - */ - @encode(DurationKnownEncoding.ISO8601) - @example("P1D") - dueAfter?: string = "P7D"; + @summary("The workflow details used by this invoice.") + workflow: OpenMeter.Billing.WorkflowSettings; + + @summary("Timezone of the invoice's date fields.") + @visibility("read", "query") + timezone: string; } /** @@ -194,7 +215,7 @@ enum InvoiceType { standard: "standard", @summary("Reflects a refund either partial or complete of the preceding document. A credit note effectively *extends* the previous document.") - credit_note: "credit-note", + creditNote: "credit_note", } @friendlyName("BillingInvoiceDiscount") @@ -217,19 +238,25 @@ model Discount { @summary("UnitPriceLine represents a line item that is sold to the customer based on a specific (unit) price.") @friendlyName("BillingInvoiceLine") +@discriminator("type") union InvoiceLine { - unitPrice: UnitPriceLine, + flatFeeLine: FlatFeeLine, + manualFeeLine: ManualFeeLine, } @summary("LineTypes represents the different types of lines that can be used in an invoice.") @friendlyName("BillingLineTypes") enum LineTypes { - /* - * The line represents a product or service that is sold to the customer. - * - * If the item is a single charge or based on a metered value it doesn't matter from the invoicing perspective. - */ - unitPrice: "unit_price", + ...RateCardType, + manualFee: "manual_fee", +} + +@summary("Line status specifies the status of the line.") +@friendlyName("BillingLineStatus") +enum LineStatus { + valid: "valid", + deleted: "deleted", + split: "split", } /** @@ -240,27 +267,54 @@ enum LineTypes { @discriminator("type") @friendlyName("BillingLine") model Line { + ...OmitProperties; + @visibility("read", "query", "update") id: ULID; type: LineTypes; + @visibility("read", "query") + status: LineStatus; + @summary("Discounts applied to this line.") discounts?: LineDiscount[]; @summary("Charges applied to this line.") charges?: LineCharge[]; + @summary("The invoice this item belongs to.") + invoice?: InvoiceReference; + + @summary("The currency of this line") + currency: CurrencyCode; + @summary("Map of taxes to be applied and used in the invoice totals.") @visibility("read", "query") // Tax is handled by the tax provider, we only need to show the output of that here taxes?: TaxItem[]; + @summary("Tax overrides specify the tax configuration for this line.") + taxOverrides?: OpenMeter.ProductCatalog.TaxConfig | null; + @visibility("read") @summary("Total sum of the line, including discounts and charges.") total: Numeric; @summary("Period of the line item applies to for revenue recognition pruposes.") period: Period; + + @summary("The time this line item should be invoiced.") + invoiceAt: DateTime; +} + +@summary("Reference to an invoice.") +@friendlyName("BillingInvoiceReference") +model InvoiceReference { + @summary("The ID of the invoice.") + id: ULID; + + @summary("The number of the invoice.") + number?: InvoiceNumber; } @summary("Period represents a time range.") @@ -274,16 +328,29 @@ model Period { } /** - * UnitPriceLine represents a line item that is sold to the customer based on a unit price. + * BillingFlatFeeLine represents a line item that is sold to the customer as a flat fee. * - * This is analogous to gobl's Line model, with the addition of the type and some metadata fields. + * This object represents an item added via subscriptions. */ -@friendlyName("BillingUnitPriceLine") -model UnitPriceLine extends Line { - type: LineTypes.unitPrice; +@friendlyName("BillingFlatFeeLine") +model FlatFeeLine { + ...OmitProperties; + type: LineTypes.flatFee; @summary("Details about what is being sold.") - item: RateCard; + item: RateCardFlatFee; +} + +/** + * BillingManualFeeLine represents a line item that is sold to the customer as a manually added fee. + */ +@friendlyName("BillingManualFeeLine") +model ManualFeeLine { + ...OmitProperties; + type: LineTypes.manualFee; + + @summary("Price of the item being sold.") + price: Money; @summary("Quantity of the item being sold.") quantity: Numeric; diff --git a/api/spec/src/billing/invoices/org.tsp b/api/spec/src/billing/invoices/org.tsp index c54ba6022..a40533739 100644 --- a/api/spec/src/billing/invoices/org.tsp +++ b/api/spec/src/billing/invoices/org.tsp @@ -30,7 +30,9 @@ namespace Invoices; model Party { @summary("ID of the party.") @visibility("read", "query", "update") - id: ULID; + // id is null if there's no dedicated entity different from the parent object to store the party (these are not updated directly via + // the underlying entity so it's not a problem) + id?: ULID; @summary("Legal name or representation of the organization.") name?: string; diff --git a/api/spec/src/billing/profile.tsp b/api/spec/src/billing/profile.tsp index 9d7605323..6d5630b5a 100644 --- a/api/spec/src/billing/profile.tsp +++ b/api/spec/src/billing/profile.tsp @@ -15,6 +15,9 @@ interface Profiles { @query includeArchived?: boolean = false, + @query + expand?: ProfileExpand[], + ...OpenMeter.QueryPagination, ...OpenMeter.QueryLimitOffset, ...OpenMeter.QueryOrdering, @@ -54,6 +57,7 @@ interface Profiles { @operationId("billingGetProfile") get( @path id: string, + @query expand?: ProfileExpand[], ): Profile | OpenMeter.NotFoundError | OpenMeter.CommonErrors; /** @@ -82,6 +86,16 @@ enum ProfileOrderBy { name: "name", } +/** + * ProfileExpand details what profile fields to expand + */ +@friendlyName("BillingProfileExpand") +@extension("x-enum-varnames", ["apps", "all"]) +enum ProfileExpand { + apps: "apps", + all: "*", +} + /** * Profile represents a billing profile */ @@ -106,7 +120,7 @@ model Profile { @summary("The applications used by this billing profile") @visibility("read", "query") - apps: ProfileApps; + apps: ProfileAppsOrReference; @summary("Is this the default profile?") default: boolean; @@ -127,6 +141,27 @@ model ProfileApps { payment: OpenMeter.App.App; } +/** + * ProfileAppsReference represents the references (id, type) to the apps used by a billing profile + */ +@friendlyName("BillingProfileAppReferences") +model ProfileAppReferences { + @summary("The tax app used for this workflow") + tax: OpenMeter.App.AppReference; + + @summary("The invoicing app used for this workflow") + invoicing: OpenMeter.App.AppReference; + + @summary("The payment app used for this workflow") + payment: OpenMeter.App.AppReference; +} + +@friendlyName("BillingProfileAppsOrReference") +union ProfileAppsOrReference { + profileApps: ProfileApps, + profileAppReferences: ProfileAppReferences, +} + /** * Workflow represents a billing workflow */ @@ -156,7 +191,7 @@ model WorkflowSettings { payment?: WorkflowPaymentSettings; } -@summary("Workflow collection specifies how to collect the pending items for an invoice") +@summary("Workflow collection specifies how to collect the pending line items for an invoice") @friendlyName("BillingWorkflowCollectionSettings") model WorkflowCollectionSettings { /** @@ -270,11 +305,11 @@ enum CollectionMethod { } /** - * ItemResolution specifies how the line items should be resolved in the invoice + * LineResolution specifies how the line items should be resolved in the invoice */ -@friendlyName("BillingWorkflowItemResolution") +@friendlyName("BillingWorkflowLineResolution") @summary("Item resolution") -enum ItemResolution { +enum LineResolution { /** * Create line items for each day in the billing period. */ diff --git a/api/spec/src/cloud/main.tsp b/api/spec/src/cloud/main.tsp index cf560fa35..50af2ee5b 100644 --- a/api/spec/src/cloud/main.tsp +++ b/api/spec/src/cloud/main.tsp @@ -173,12 +173,12 @@ namespace OpenMeterCloud.Billing { @tag("Billing (Experimental)") interface Invoices extends OpenMeter.Billing.InvoiceEndpoints {} - @route("/api/v1/billing/invoices/{customerIdOrKey}") + @route("/api/v1/billing/invoices/{customerId}") @tag("Billing (Experimental)") interface CustomerInvoicesEndpoints extends OpenMeter.Billing.CustomerInvoicesEndpoints {} - @route("/api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}") + @route("/api/v1/billing/invoices/{customerId}/invoices/{invoiceId}") @tag("Billing (Experimental)") interface CustomerInvoiceEndpoints extends OpenMeter.Billing.CustomerInvoiceEndpoints {} diff --git a/cmd/server/main.go b/cmd/server/main.go index bac9d9dd6..dfada163e 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -338,6 +338,7 @@ func main() { Adapter: adapter, CustomerService: customerService, AppService: appService, + Logger: logger.With("subsystem", "billing.service"), }) if err != nil { logger.Error("failed to initialize billing service", "error", err) diff --git a/openmeter/billing/adapter.go b/openmeter/billing/adapter.go index 5e424f9e0..200d5159c 100644 --- a/openmeter/billing/adapter.go +++ b/openmeter/billing/adapter.go @@ -2,7 +2,6 @@ package billing import ( "context" - "fmt" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" @@ -14,7 +13,8 @@ import ( type Adapter interface { ProfileAdapter CustomerOverrideAdapter - InvoiceItemAdapter + InvoiceLineAdapter + InvoiceAdapter Tx(ctx context.Context) (context.Context, transaction.Driver, error) WithTx(ctx context.Context, tx *entutils.TxDriver) Adapter @@ -38,46 +38,12 @@ type CustomerOverrideAdapter interface { GetCustomerOverrideReferencingProfile(ctx context.Context, input HasCustomerOverrideReferencingProfileAdapterInput) ([]customerentity.CustomerID, error) } -type InvoiceItemAdapter interface { - CreateInvoiceItems(ctx context.Context, input CreateInvoiceItemsInput) ([]billingentity.InvoiceItem, error) - GetPendingInvoiceItems(ctx context.Context, customerID customerentity.CustomerID) ([]billingentity.InvoiceItem, error) +type InvoiceLineAdapter interface { + CreateInvoiceLines(ctx context.Context, input CreateInvoiceLinesAdapterInput) (*CreateInvoiceLinesResponse, error) } -type GetCustomerOverrideAdapterInput struct { - Namespace string - CustomerID string - - IncludeDeleted bool -} - -func (i GetCustomerOverrideAdapterInput) Validate() error { - if i.Namespace == "" { - return fmt.Errorf("namespace is required") - } - - if i.CustomerID == "" { - return fmt.Errorf("customer id is required") - } - - return nil -} - -type UpdateCustomerOverrideAdapterInput struct { - UpdateCustomerOverrideInput - - ResetDeletedAt bool -} - -func (i UpdateCustomerOverrideAdapterInput) Validate() error { - if err := i.UpdateCustomerOverrideInput.Validate(); err != nil { - return fmt.Errorf("error validating update customer override input: %w", err) - } - - return nil -} - -type HasCustomerOverrideReferencingProfileAdapterInput genericNamespaceID - -func (i HasCustomerOverrideReferencingProfileAdapterInput) Validate() error { - return genericNamespaceID(i).Validate() +type InvoiceAdapter interface { + CreateInvoice(ctx context.Context, input CreateInvoiceAdapterInput) (CreateInvoiceAdapterRespone, error) + GetInvoiceById(ctx context.Context, input GetInvoiceByIdInput) (billingentity.Invoice, error) + ListInvoices(ctx context.Context, input ListInvoicesInput) (ListInvoicesResponse, error) } diff --git a/openmeter/billing/adapter/customeroverride.go b/openmeter/billing/adapter/customeroverride.go index e69d3f333..60f7f6da8 100644 --- a/openmeter/billing/adapter/customeroverride.go +++ b/openmeter/billing/adapter/customeroverride.go @@ -22,7 +22,7 @@ func (r *adapter) CreateCustomerOverride(ctx context.Context, input billing.Crea SetCustomerID(input.CustomerID). SetNillableBillingProfileID(lo.EmptyableToPtr(input.ProfileID)). SetNillableCollectionAlignment(input.Collection.Alignment). - SetNillableItemCollectionPeriod(input.Collection.Interval.ISOStringPtrOrNil()). + SetNillableLineCollectionPeriod(input.Collection.Interval.ISOStringPtrOrNil()). SetNillableInvoiceAutoAdvance(input.Invoicing.AutoAdvance). SetNillableInvoiceDraftPeriod(input.Invoicing.DraftPeriod.ISOStringPtrOrNil()). SetNillableInvoiceDueAfter(input.Invoicing.DueAfter.ISOStringPtrOrNil()). @@ -34,8 +34,10 @@ func (r *adapter) CreateCustomerOverride(ctx context.Context, input billing.Crea // Let's fetch the override with edges return r.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, }) } @@ -58,7 +60,7 @@ func (r *adapter) UpdateCustomerOverride(ctx context.Context, input billing.Upda update := r.db.BillingCustomerOverride.Update(). Where(billingcustomeroverride.CustomerID(input.CustomerID)). SetOrClearCollectionAlignment(input.Collection.Alignment). - SetOrClearItemCollectionPeriod(input.Collection.Interval.ISOStringPtrOrNil()). + SetOrClearLineCollectionPeriod(input.Collection.Interval.ISOStringPtrOrNil()). SetOrClearInvoiceAutoAdvance(input.Invoicing.AutoAdvance). SetOrClearInvoiceDraftPeriod(input.Invoicing.DraftPeriod.ISOStringPtrOrNil()). SetOrClearInvoiceDueAfter(input.Invoicing.DueAfter.ISOStringPtrOrNil()). @@ -82,15 +84,17 @@ func (r *adapter) UpdateCustomerOverride(ctx context.Context, input billing.Upda } return r.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, }) } func (r *adapter) GetCustomerOverride(ctx context.Context, input billing.GetCustomerOverrideAdapterInput) (*billingentity.CustomerOverride, error) { query := r.db.BillingCustomerOverride.Query(). - Where(billingcustomeroverride.Namespace(input.Namespace)). - Where(billingcustomeroverride.CustomerID(input.CustomerID)). + Where(billingcustomeroverride.Namespace(input.Customer.Namespace)). + Where(billingcustomeroverride.CustomerID(input.Customer.ID)). WithBillingProfile(func(bpq *db.BillingProfileQuery) { bpq.WithWorkflowConfig() }). @@ -111,7 +115,7 @@ func (r *adapter) GetCustomerOverride(ctx context.Context, input billing.GetCust if dbCustomerOverride.Edges.Customer == nil { return nil, billing.NotFoundError{ - ID: input.CustomerID, + ID: input.Customer.ID, Entity: billing.EntityCustomer, Err: billing.ErrCustomerNotFound, } @@ -173,7 +177,7 @@ func (r *adapter) GetCustomerOverrideReferencingProfile(ctx context.Context, inp } func mapCustomerOverrideFromDB(dbOverride *db.BillingCustomerOverride) (*billingentity.CustomerOverride, error) { - collectionInterval, err := dbOverride.ItemCollectionPeriod.ParsePtrOrNil() + collectionInterval, err := dbOverride.LineCollectionPeriod.ParsePtrOrNil() if err != nil { return nil, fmt.Errorf("cannot parse collection.interval: %w", err) } diff --git a/openmeter/billing/adapter/invoice.go b/openmeter/billing/adapter/invoice.go index 5bf0b8c34..77c1471dd 100644 --- a/openmeter/billing/adapter/invoice.go +++ b/openmeter/billing/adapter/invoice.go @@ -1 +1,308 @@ package billingadapter + +import ( + "context" + "fmt" + "time" + + "github.com/samber/lo" + + "github.com/openmeterio/openmeter/api" + "github.com/openmeterio/openmeter/openmeter/billing" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" + "github.com/openmeterio/openmeter/pkg/framework/entutils" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/pagination" + "github.com/openmeterio/openmeter/pkg/sortx" +) + +var _ billing.InvoiceAdapter = (*adapter)(nil) + +func (r *adapter) GetInvoiceById(ctx context.Context, in billing.GetInvoiceByIdInput) (billingentity.Invoice, error) { + if err := in.Validate(); err != nil { + return billingentity.Invoice{}, billing.ValidationError{ + Err: err, + } + } + + query := r.db.BillingInvoice.Query(). + Where(billinginvoice.ID(in.Invoice.ID)). + Where(billinginvoice.Namespace(in.Invoice.Namespace)) + + if in.Expand.Workflow { + query = query.WithBillingWorkflowConfig() + } + + if in.Expand.Lines { + query = r.expandLineItems(query) + } + + invoice, err := query.Only(ctx) + if err != nil { + if db.IsNotFound(err) { + return billingentity.Invoice{}, billing.NotFoundError{ + Entity: billing.EntityInvoice, + ID: in.Invoice.ID, + Err: err, + } + } + + return billingentity.Invoice{}, err + } + + return mapInvoiceFromDB(*invoice, in.Expand) +} + +// expandLineItems adds the required edges to the query so that line items can be properly mapped +func (r *adapter) expandLineItems(query *db.BillingInvoiceQuery) *db.BillingInvoiceQuery { + return query.WithBillingInvoiceLines(func(bilq *db.BillingInvoiceLineQuery) { + bilq.WithBillingInvoiceManualLines() + }) +} + +func (r *adapter) ListInvoices(ctx context.Context, input billing.ListInvoicesInput) (billing.ListInvoicesResponse, error) { + if err := input.Validate(); err != nil { + return billing.ListInvoicesResponse{}, billing.ValidationError{ + Err: err, + } + } + + query := r.db.BillingInvoice.Query(). + Where(billinginvoice.Namespace(input.Namespace)) + + if input.Expand.Workflow { + query = query.WithBillingWorkflowConfig() + } + + // TODO[OM-944]: We should allow by customer key and name too + if len(input.Customers) > 0 { + query = query.Where(billinginvoice.CustomerIDIn(input.Customers...)) + } + + if input.IssuedAfter != nil { + query = query.Where(billinginvoice.IssuedAtGTE(*input.IssuedAfter)) + } + + if input.IssuedBefore != nil { + query = query.Where(billinginvoice.IssuedAtLTE(*input.IssuedBefore)) + } + + if len(input.Statuses) > 0 { + query = query.Where(billinginvoice.StatusIn(input.Statuses...)) + } + + if len(input.Currencies) > 0 { + query = query.Where(billinginvoice.CurrencyIn(input.Currencies...)) + } + + order := entutils.GetOrdering(sortx.OrderDefault) + if !input.Order.IsDefaultValue() { + order = entutils.GetOrdering(input.Order) + } + + if input.Expand.Lines { + query = r.expandLineItems(query) + } + + switch input.OrderBy { + case api.BillingInvoiceOrderByCustomerName: + query = query.Order(billinginvoice.ByCustomerName(order...)) + case api.BillingInvoiceOrderByIssuedAt: + query = query.Order(billinginvoice.ByIssuedAt(order...)) + case api.BillingInvoiceOrderByStatus: + query = query.Order(billinginvoice.ByStatus(order...)) + case api.BillingInvoiceOrderByUpdatedAt: + query = query.Order(billinginvoice.ByUpdatedAt(order...)) + case api.BillingInvoiceOrderByCreatedAt: + fallthrough + default: + query = query.Order(billinginvoice.ByCreatedAt(order...)) + } + + response := pagination.PagedResponse[billingentity.Invoice]{ + Page: input.Page, + } + + paged, err := query.Paginate(ctx, input.Page) + if err != nil { + return response, err + } + + result := make([]billingentity.Invoice, 0, len(paged.Items)) + for _, invoice := range paged.Items { + mapped, err := mapInvoiceFromDB(*invoice, input.Expand) + if err != nil { + return response, err + } + + result = append(result, mapped) + } + + response.TotalCount = paged.TotalCount + response.Items = result + + return response, nil +} + +func (r *adapter) CreateInvoice(ctx context.Context, input billing.CreateInvoiceAdapterInput) (billing.CreateInvoiceAdapterRespone, error) { + if err := input.Validate(); err != nil { + return billing.CreateInvoiceAdapterRespone{}, err + } + + customer := input.Customer + supplier := input.Profile.Supplier + + // Clone the workflow config + clonedWorkflowConfig, err := r.createWorkflowConfig(ctx, input.Namespace, input.Profile.WorkflowConfig) + if err != nil { + return billing.CreateInvoiceAdapterRespone{}, fmt.Errorf("clone workflow config: %w", err) + } + + workflowConfig := mapWorkflowConfigToDB(input.Profile.WorkflowConfig) + + // Force cloning of the workflow + workflowConfig.ID = "" + workflowConfig.CreatedAt = time.Time{} + workflowConfig.UpdatedAt = time.Time{} + workflowConfig.DeletedAt = nil + + newInvoice, err := r.db.BillingInvoice.Create(). + SetNamespace(input.Namespace). + SetMetadata(input.Metadata). + SetCurrency(input.Currency). + SetStatus(input.Status). + SetSourceBillingProfileID(input.Profile.ID). + SetCustomerID(input.Customer.ID). + SetType(input.Type). + SetNillableDescription(input.Description). + SetNillableDueAt(input.DueAt). + SetNillableCustomerTimezone(customer.Timezone). + SetNillableIssuedAt(lo.EmptyableToPtr(input.IssuedAt)). + // Workflow (cloned) + SetBillingWorkflowConfigID(clonedWorkflowConfig.ID). + // TODO[later]: By cloning the AppIDs here we could support changing the apps in the billing profile if needed + SetTaxAppID(input.Profile.Apps.Tax.GetID().ID). + SetInvoicingAppID(input.Profile.Apps.Invoicing.GetID().ID). + SetPaymentAppID(input.Profile.Apps.Payment.GetID().ID). + // Customer contacts + SetNillableCustomerAddressCountry(customer.BillingAddress.Country). + SetNillableCustomerAddressPostalCode(customer.BillingAddress.PostalCode). + SetNillableCustomerAddressState(customer.BillingAddress.State). + SetNillableCustomerAddressCity(customer.BillingAddress.City). + SetNillableCustomerAddressLine1(customer.BillingAddress.Line1). + SetNillableCustomerAddressLine2(customer.BillingAddress.Line2). + SetNillableCustomerAddressPhoneNumber(customer.BillingAddress.PhoneNumber). + SetCustomerName(customer.Name). + SetNillableCustomerTimezone(customer.Timezone). + // Supplier contacts + SetNillableSupplierAddressCountry(supplier.Address.Country). + SetNillableSupplierAddressPostalCode(supplier.Address.PostalCode). + SetNillableSupplierAddressState(supplier.Address.State). + SetNillableSupplierAddressCity(supplier.Address.City). + SetNillableSupplierAddressLine1(supplier.Address.Line1). + SetNillableSupplierAddressLine2(supplier.Address.Line2). + SetNillableSupplierAddressPhoneNumber(supplier.Address.PhoneNumber). + SetSupplierName(supplier.Name). + SetNillableSupplierTaxCode(supplier.TaxCode). + Save(ctx) + if err != nil { + return billing.CreateInvoiceAdapterRespone{}, err + } + + // Let's add required edges for mapping + newInvoice.Edges.BillingWorkflowConfig = clonedWorkflowConfig + + return mapInvoiceFromDB(*newInvoice, billing.InvoiceExpandAll) +} + +func mapInvoiceFromDB(invoice db.BillingInvoice, expand billing.InvoiceExpand) (billingentity.Invoice, error) { + res := billingentity.Invoice{ + ID: invoice.ID, + Namespace: invoice.Namespace, + Metadata: invoice.Metadata, + Currency: invoice.Currency, + Status: invoice.Status, + Type: invoice.Type, + Number: invoice.Number, + Description: invoice.Description, + DueAt: invoice.DueAt, + Supplier: billingentity.SupplierContact{ + Name: invoice.SupplierName, + Address: models.Address{ + Country: invoice.SupplierAddressCountry, + PostalCode: invoice.SupplierAddressPostalCode, + City: invoice.SupplierAddressCity, + State: invoice.SupplierAddressState, + Line1: invoice.SupplierAddressLine1, + Line2: invoice.SupplierAddressLine2, + PhoneNumber: invoice.SupplierAddressPhoneNumber, + }, + TaxCode: invoice.SupplierTaxCode, + }, + + Customer: billingentity.InvoiceCustomer{ + CustomerID: invoice.CustomerID, + Name: invoice.CustomerName, + BillingAddress: &models.Address{ + Country: invoice.CustomerAddressCountry, + PostalCode: invoice.CustomerAddressPostalCode, + City: invoice.CustomerAddressCity, + State: invoice.CustomerAddressState, + Line1: invoice.CustomerAddressLine1, + Line2: invoice.CustomerAddressLine2, + PhoneNumber: invoice.CustomerAddressPhoneNumber, + }, + Timezone: invoice.CustomerTimezone, + }, + Period: mapPeriodFromDB(invoice.PeriodStart, invoice.PeriodEnd), + IssuedAt: invoice.IssuedAt, + CreatedAt: invoice.CreatedAt, + UpdatedAt: invoice.UpdatedAt, + DeletedAt: invoice.DeletedAt, + } + + if expand.Workflow { + workflowConfig, err := mapWorkflowConfigFromDB(invoice.Edges.BillingWorkflowConfig) + if err != nil { + return billingentity.Invoice{}, err + } + + res.Workflow = &billingentity.InvoiceWorkflow{ + WorkflowConfig: workflowConfig, + SourceBillingProfileID: invoice.SourceBillingProfileID, + + AppReferences: billingentity.ProfileAppReferences{ + Tax: billingentity.AppReference{ + ID: invoice.TaxAppID, + }, + Invoicing: billingentity.AppReference{ + ID: invoice.InvoicingAppID, + }, + Payment: billingentity.AppReference{ + ID: invoice.PaymentAppID, + }, + }, + } + } + + if len(invoice.Edges.BillingInvoiceLines) > 0 { + res.Lines = make([]billingentity.Line, 0, len(invoice.Edges.BillingInvoiceLines)) + for _, line := range invoice.Edges.BillingInvoiceLines { + res.Lines = append(res.Lines, mapInvoiceLineFromDB(line)) + } + } + + return res, nil +} + +func mapPeriodFromDB(start, end *time.Time) *billingentity.Period { + if start == nil || end == nil { + return nil + } + return &billingentity.Period{ + Start: *start, + End: *end, + } +} diff --git a/openmeter/billing/adapter/invoiceitems.go b/openmeter/billing/adapter/invoiceitems.go deleted file mode 100644 index 10cd8c677..000000000 --- a/openmeter/billing/adapter/invoiceitems.go +++ /dev/null @@ -1,94 +0,0 @@ -package billingadapter - -import ( - "context" - - "github.com/openmeterio/openmeter/openmeter/billing" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" - "github.com/openmeterio/openmeter/openmeter/ent/db" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" -) - -func (r adapter) CreateInvoiceItems(ctx context.Context, input billing.CreateInvoiceItemsInput) ([]billingentity.InvoiceItem, error) { - result := make([]billingentity.InvoiceItem, 0, len(input.Items)) - - for _, item := range input.Items { - item := r.db.BillingInvoiceItem.Create(). - SetNamespace(input.Namespace). - SetCustomerID(item.CustomerID). - SetPeriodStart(item.PeriodStart). - SetPeriodEnd(item.PeriodEnd). - SetInvoiceAt(item.InvoiceAt). - SetType(item.Type). - SetName(item.Name). - SetNillableQuantity(item.Quantity). - SetUnitPrice(item.UnitPrice). - SetCurrency(item.Currency). - SetTaxCodeOverride(item.TaxCodeOverride). - SetMetadata(item.Metadata) - - if input.InvoiceID != nil { - // If invoiceID is set, we are adding the item to an existing invoice, otherwise to the pending list - item = item.SetInvoiceID(*input.InvoiceID) - } - - savedItem, err := item.Save(ctx) - if err != nil { - return nil, err - } - - result = append(result, mapInvoiceItemFromDB(savedItem)) - } - - return result, nil -} - -func (r adapter) GetPendingInvoiceItems(ctx context.Context, customerID customerentity.CustomerID) ([]billingentity.InvoiceItem, error) { - items, err := r.db.BillingInvoiceItem.Query(). - Where(billinginvoiceitem.CustomerID(customerID.ID)). - Where(billinginvoiceitem.Namespace(customerID.Namespace)). - Where(billinginvoiceitem.InvoiceIDIsNil()). - All(ctx) - if err != nil { - return nil, err - } - - res := make([]billingentity.InvoiceItem, 0, len(items)) - for _, item := range items { - res = append(res, mapInvoiceItemFromDB(item)) - } - - return res, nil -} - -func mapInvoiceItemFromDB(dbItem *db.BillingInvoiceItem) billingentity.InvoiceItem { - invoiceItem := billingentity.InvoiceItem{ - Namespace: dbItem.Namespace, - ID: dbItem.ID, - - CreatedAt: dbItem.CreatedAt, - UpdatedAt: dbItem.UpdatedAt, - DeletedAt: dbItem.DeletedAt, - - Metadata: dbItem.Metadata, - CustomerID: dbItem.CustomerID, - InvoiceID: dbItem.InvoiceID, - - PeriodStart: dbItem.PeriodStart, - PeriodEnd: dbItem.PeriodEnd, - - InvoiceAt: dbItem.InvoiceAt, - - Name: dbItem.Name, - - Type: dbItem.Type, - Quantity: dbItem.Quantity, - UnitPrice: dbItem.UnitPrice, - Currency: dbItem.Currency, - - TaxCodeOverride: dbItem.TaxCodeOverride, - } - - return invoiceItem -} diff --git a/openmeter/billing/adapter/invoicelines.go b/openmeter/billing/adapter/invoicelines.go new file mode 100644 index 000000000..804f1a754 --- /dev/null +++ b/openmeter/billing/adapter/invoicelines.go @@ -0,0 +1,123 @@ +package billingadapter + +import ( + "context" + "fmt" + + "github.com/alpacahq/alpacadecimal" + "github.com/samber/lo" + + "github.com/openmeterio/openmeter/openmeter/billing" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/pkg/models" +) + +var _ billing.InvoiceLineAdapter = (*adapter)(nil) + +func (r *adapter) CreateInvoiceLines(ctx context.Context, input billing.CreateInvoiceLinesAdapterInput) (*billing.CreateInvoiceLinesResponse, error) { + result := &billing.CreateInvoiceLinesResponse{ + Lines: make([]billingentity.Line, 0, len(input.Lines)), + } + + for _, line := range input.Lines { + newEnt := r.db.BillingInvoiceLine.Create(). + SetNamespace(input.Namespace). + SetInvoiceID(line.InvoiceID). + SetPeriodStart(line.Period.Start). + SetPeriodEnd(line.Period.End). + SetInvoiceAt(line.InvoiceAt). + SetStatus(line.Status). + SetType(line.Type). + SetName(line.Name). + SetCurrency(line.Currency). + SetTaxOverrides(line.TaxOverrides). + SetMetadata(line.Metadata) + + edges := db.BillingInvoiceLineEdges{} + + switch line.Type { + case billingentity.InvoiceLineTypeManualFee: + // Let's create the manual line for the invoice + newManualLineConfig, err := r.db.BillingInvoiceManualLineConfig.Create(). + SetNamespace(input.Namespace). + SetUnitPrice(line.ManualFee.Price). + Save(ctx) + if err != nil { + return nil, err + } + + newEnt = newEnt.SetBillingInvoiceManualLines(newManualLineConfig). + SetQuantity(line.ManualFee.Quantity) + + edges.BillingInvoiceManualLines = newManualLineConfig + default: + return nil, fmt.Errorf("unsupported type: %s", line.Type) + } + + savedLine, err := newEnt.Save(ctx) + if err != nil { + return nil, err + } + + savedLine.Edges = edges + + result.Lines = append(result.Lines, mapInvoiceLineFromDB(savedLine)) + } + + return result, nil +} + +func (r *adapter) GetInvoiceLineByID(ctx context.Context, id models.NamespacedID) (billingentity.Line, error) { + dbLine, err := r.db.BillingInvoiceLine.Query(). + Where(billinginvoiceline.ID(id.ID)). + Where(billinginvoiceline.Namespace(id.Namespace)). + WithBillingInvoiceManualLines(). + Only(ctx) + if err != nil { + return billingentity.Line{}, err + } + + return mapInvoiceLineFromDB(dbLine), nil +} + +func mapInvoiceLineFromDB(dbLine *db.BillingInvoiceLine) billingentity.Line { + invoiceLine := billingentity.Line{ + LineBase: billingentity.LineBase{ + Namespace: dbLine.Namespace, + ID: dbLine.ID, + + CreatedAt: dbLine.CreatedAt, + UpdatedAt: dbLine.UpdatedAt, + DeletedAt: dbLine.DeletedAt, + + Metadata: dbLine.Metadata, + InvoiceID: dbLine.InvoiceID, + + Period: billingentity.Period{ + Start: dbLine.PeriodStart, + End: dbLine.PeriodEnd, + }, + + InvoiceAt: dbLine.InvoiceAt, + + Name: dbLine.Name, + + Type: dbLine.Type, + Currency: dbLine.Currency, + + TaxOverrides: dbLine.TaxOverrides, + }, + } + + switch dbLine.Type { + case billingentity.InvoiceLineTypeManualFee: + invoiceLine.ManualFee = &billingentity.ManualFeeLine{ + Price: dbLine.Edges.BillingInvoiceManualLines.UnitPrice, + Quantity: lo.FromPtrOr(dbLine.Quantity, alpacadecimal.Zero), + } + } + + return invoiceLine +} diff --git a/openmeter/billing/adapter/profile.go b/openmeter/billing/adapter/profile.go index f3920fea3..87a0c8c9c 100644 --- a/openmeter/billing/adapter/profile.go +++ b/openmeter/billing/adapter/profile.go @@ -28,15 +28,7 @@ func (a *adapter) CreateProfile(ctx context.Context, input billing.CreateProfile } } - dbWorkflowConfig, err := a.db.BillingWorkflowConfig.Create(). - SetNamespace(input.Namespace). - SetCollectionAlignment(input.WorkflowConfig.Collection.Alignment). - SetItemCollectionPeriod(input.WorkflowConfig.Collection.Interval.ISOString()). - SetInvoiceAutoAdvance(*input.WorkflowConfig.Invoicing.AutoAdvance). - SetInvoiceDraftPeriod(input.WorkflowConfig.Invoicing.DraftPeriod.ISOString()). - SetInvoiceDueAfter(input.WorkflowConfig.Invoicing.DueAfter.ISOString()). - SetInvoiceCollectionMethod(input.WorkflowConfig.Payment.CollectionMethod). - Save(ctx) + dbWorkflowConfig, err := a.createWorkflowConfig(ctx, input.Namespace, input.WorkflowConfig) if err != nil { return nil, err } @@ -71,6 +63,18 @@ func (a *adapter) CreateProfile(ctx context.Context, input billing.CreateProfile return mapProfileFromDB(dbProfile) } +func (a *adapter) createWorkflowConfig(ctx context.Context, ns string, input billingentity.WorkflowConfig) (*db.BillingWorkflowConfig, error) { + return a.db.BillingWorkflowConfig.Create(). + SetNamespace(ns). + SetCollectionAlignment(input.Collection.Alignment). + SetLineCollectionPeriod(input.Collection.Interval.ISOString()). + SetInvoiceAutoAdvance(*input.Invoicing.AutoAdvance). + SetInvoiceDraftPeriod(input.Invoicing.DraftPeriod.ISOString()). + SetInvoiceDueAfter(input.Invoicing.DueAfter.ISOString()). + SetInvoiceCollectionMethod(input.Payment.CollectionMethod). + Save(ctx) +} + func (a *adapter) GetProfile(ctx context.Context, input billing.GetProfileInput) (*billingentity.BaseProfile, error) { // This needs to be wrapped, as the service expects this to be atomic if err := input.Validate(); err != nil { @@ -78,8 +82,8 @@ func (a *adapter) GetProfile(ctx context.Context, input billing.GetProfileInput) } dbProfile, err := a.db.BillingProfile.Query(). - Where(billingprofile.Namespace(input.Namespace)). - Where(billingprofile.ID(input.ID)). + Where(billingprofile.Namespace(input.Profile.Namespace)). + Where(billingprofile.ID(input.Profile.ID)). WithWorkflowConfig().First(ctx) if err != nil { if db.IsNotFound(err) { @@ -94,7 +98,8 @@ func (a *adapter) GetProfile(ctx context.Context, input billing.GetProfileInput) func (a *adapter) ListProfiles(ctx context.Context, input billing.ListProfilesInput) (pagination.PagedResponse[billingentity.BaseProfile], error) { query := a.db.BillingProfile.Query(). - Where(billingprofile.Namespace(input.Namespace)) + Where(billingprofile.Namespace(input.Namespace)). + WithWorkflowConfig() if !input.IncludeArchived { query = query.Where(billingprofile.DeletedAtIsNil()) @@ -175,7 +180,12 @@ func (a *adapter) DeleteProfile(ctx context.Context, input billing.DeleteProfile return err } - profile, err := a.GetProfile(ctx, billing.GetProfileInput(input)) + profile, err := a.GetProfile(ctx, billing.GetProfileInput{ + Profile: models.NamespacedID{ + Namespace: input.Namespace, + ID: input.ID, + }, + }) if err != nil { return err } @@ -232,7 +242,7 @@ func (a adapter) UpdateProfile(ctx context.Context, input billing.UpdateProfileA updatedWorkflowConfig, err := a.db.BillingWorkflowConfig.UpdateOneID(input.WorkflowConfigID). Where(billingworkflowconfig.Namespace(targetState.Namespace)). SetCollectionAlignment(targetState.WorkflowConfig.Collection.Alignment). - SetItemCollectionPeriod(targetState.WorkflowConfig.Collection.Interval.ISOString()). + SetLineCollectionPeriod(targetState.WorkflowConfig.Collection.Interval.ISOString()). SetInvoiceAutoAdvance(*targetState.WorkflowConfig.Invoicing.AutoAdvance). SetInvoiceDraftPeriod(targetState.WorkflowConfig.Invoicing.DraftPeriod.ISOString()). SetInvoiceDueAfter(targetState.WorkflowConfig.Invoicing.DueAfter.ISOString()). @@ -292,8 +302,27 @@ func mapProfileFromDB(dbProfile *db.BillingProfile) (*billingentity.BaseProfile, }, nil } +func mapWorkflowConfigToDB(wc billingentity.WorkflowConfig) *db.BillingWorkflowConfig { + return &db.BillingWorkflowConfig{ + ID: wc.ID, + + CreatedAt: wc.CreatedAt, + UpdatedAt: wc.UpdatedAt, + DeletedAt: wc.DeletedAt, + + CollectionAlignment: wc.Collection.Alignment, + LineCollectionPeriod: wc.Collection.Interval.ISOString(), + InvoiceAutoAdvance: lo.FromPtrOr( + wc.Invoicing.AutoAdvance, + *billingentity.DefaultWorkflowConfig.Invoicing.AutoAdvance), + InvoiceDraftPeriod: wc.Invoicing.DraftPeriod.ISOString(), + InvoiceDueAfter: wc.Invoicing.DueAfter.ISOString(), + InvoiceCollectionMethod: wc.Payment.CollectionMethod, + } +} + func mapWorkflowConfigFromDB(dbWC *db.BillingWorkflowConfig) (billingentity.WorkflowConfig, error) { - collectionInterval, err := dbWC.ItemCollectionPeriod.Parse() + collectionInterval, err := dbWC.LineCollectionPeriod.Parse() if err != nil { return billingentity.WorkflowConfig{}, fmt.Errorf("cannot parse collection.interval: %w", err) } diff --git a/openmeter/billing/customeroverride.go b/openmeter/billing/customeroverride.go index 7d76bb6ae..2e1f067c1 100644 --- a/openmeter/billing/customeroverride.go +++ b/openmeter/billing/customeroverride.go @@ -5,6 +5,7 @@ import ( "time" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" ) type CreateCustomerOverrideInput struct { @@ -117,3 +118,37 @@ type GetProfileWithCustomerOverrideInput namespacedCustomerID func (g GetProfileWithCustomerOverrideInput) Validate() error { return namespacedCustomerID(g).Validate() } + +type GetCustomerOverrideAdapterInput struct { + Customer customerentity.CustomerID + + IncludeDeleted bool +} + +func (i GetCustomerOverrideAdapterInput) Validate() error { + if err := i.Customer.Validate(); err != nil { + return fmt.Errorf("error validating customer: %w", err) + } + + return nil +} + +type UpdateCustomerOverrideAdapterInput struct { + UpdateCustomerOverrideInput + + ResetDeletedAt bool +} + +func (i UpdateCustomerOverrideAdapterInput) Validate() error { + if err := i.UpdateCustomerOverrideInput.Validate(); err != nil { + return fmt.Errorf("error validating update customer override input: %w", err) + } + + return nil +} + +type HasCustomerOverrideReferencingProfileAdapterInput genericNamespaceID + +func (i HasCustomerOverrideReferencingProfileAdapterInput) Validate() error { + return genericNamespaceID(i).Validate() +} diff --git a/openmeter/billing/entity/invoice.go b/openmeter/billing/entity/invoice.go index 35a1bdfd2..80965482d 100644 --- a/openmeter/billing/entity/invoice.go +++ b/openmeter/billing/entity/invoice.go @@ -8,12 +8,12 @@ import ( "github.com/invopop/gobl/cbc" "github.com/samber/lo" - customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/models" "github.com/openmeterio/openmeter/pkg/timezone" ) -type InvoiceType cbc.Key +type InvoiceType string const ( InvoiceTypeStandard InvoiceType = InvoiceType(bill.InvoiceTypeStandard) @@ -27,6 +27,17 @@ func (t InvoiceType) Values() []string { } } +func (t InvoiceType) Validate() error { + for _, status := range t.Values() { + if string(t) == status { + return nil + } + } + + return fmt.Errorf("invalid invoice type: %s", t) +} + +// TODO: remove with gobl (once the calculations are in place) func (t InvoiceType) CBCKey() cbc.Key { return cbc.Key(t) } @@ -34,6 +45,8 @@ func (t InvoiceType) CBCKey() cbc.Key { type InvoiceStatus string const ( + // InvoiceStatusGathering is the status of an invoice that is gathering the items to be invoiced. + InvoiceStatusGathering InvoiceStatus = "gathering" // InvoiceStatusPendingCreation is the status of an invoice summarizing the pending items. InvoiceStatusPendingCreation InvoiceStatus = "pending_creation" // InvoiceStatusCreated is the status of an invoice that has been created. @@ -67,6 +80,7 @@ var InvoiceImmutableStatuses = []InvoiceStatus{ func (s InvoiceStatus) Values() []string { return lo.Map( []InvoiceStatus{ + InvoiceStatusGathering, InvoiceStatusCreated, InvoiceStatusDraft, InvoiceStatusDraftSync, @@ -82,18 +96,32 @@ func (s InvoiceStatus) Values() []string { ) } -type InvoiceNumber struct { - // Number is {SERIES}-{CODE} +func (s InvoiceStatus) Validate() error { + for _, status := range s.Values() { + if string(s) == status { + return nil + } + } - Series string `json:"series"` - Code string `json:"code"` + return fmt.Errorf("invalid invoice status: %s", s) +} + +func (s InvoiceStatus) IsMutable() bool { + for _, status := range InvoiceImmutableStatuses { + if s == status { + return false + } + } + + return true } type Invoice struct { Namespace string `json:"namespace"` ID string `json:"id"` - InvoiceNumber InvoiceNumber `json:"invoiceNumber"` + Number *string `json:"number,omitempty"` + Description *string `json:"description,omitempty"` Type InvoiceType `json:"type"` @@ -103,10 +131,9 @@ type Invoice struct { Timezone timezone.Timezone `json:"timezone,omitempty"` Status InvoiceStatus `json:"status"` - PeriodStart time.Time `json:"periodStart,omitempty"` - PeriodEnd time.Time `json:"periodEnd,omitempty"` + Period *Period `json:"period,omitempty"` - DueDate *time.Time `json:"dueDate,omitempty"` + DueAt *time.Time `json:"dueDate,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` @@ -117,11 +144,12 @@ type Invoice struct { // Customer is either a snapshot of the contact information of the customer at the time of invoice being sent // or the data from the customer entity (draft state) // This is required so that we are not modifying the invoice after it has been sent to the customer. - Profile Profile `json:"profile"` - Customer InvoiceCustomer `json:"customer"` + Customer InvoiceCustomer `json:"customer"` + Supplier SupplierContact `json:"supplier"` + Workflow *InvoiceWorkflow `json:"workflow,omitempty"` // Line items - Items []InvoiceItem `json:"items,omitempty"` + Lines []Line `json:"lines,omitempty"` } type InvoiceWithValidation struct { @@ -129,7 +157,13 @@ type InvoiceWithValidation struct { ValidationErrors []error } -type InvoiceCustomer customerentity.Customer +type InvoiceCustomer struct { + CustomerID string `json:"customerId,omitempty"` + + Name string `json:"name"` + BillingAddress *models.Address `json:"billingAddress,omitempty"` + Timezone *timezone.Timezone `json:"timezone,omitempty"` +} func (i *InvoiceCustomer) Validate() error { if i.Name == "" { diff --git a/openmeter/billing/entity/invoiceitem.go b/openmeter/billing/entity/invoiceitem.go deleted file mode 100644 index 0a3673d7c..000000000 --- a/openmeter/billing/entity/invoiceitem.go +++ /dev/null @@ -1,102 +0,0 @@ -package billingentity - -import ( - "errors" - "time" - - "github.com/alpacahq/alpacadecimal" - - "github.com/openmeterio/openmeter/pkg/currencyx" -) - -type InvoiceItemType string - -const ( - // InvoiceItemTypeStatic is a static item that is not calculated based on usage. - InvoiceItemTypeStatic InvoiceItemType = "static" - // InvoiceItemTypeUsage is an item that is calculated based on usage. - InvoiceItemTypeUsage InvoiceItemType = "usage" -) - -func (InvoiceItemType) Values() []string { - return []string{ - string(InvoiceItemTypeStatic), - string(InvoiceItemTypeUsage), - } -} - -type InvoiceItem struct { - Namespace string `json:"namespace"` - ID string `json:"id"` - - CreatedAt time.Time `json:"createdAt"` - UpdatedAt time.Time `json:"updatedAt"` - DeletedAt *time.Time `json:"deletedAt,omitempty"` - - Metadata map[string]string `json:"metadata"` - InvoiceID *string `json:"invoiceID,omitempty"` - CustomerID string `json:"customer"` - - // Lifecycle - PeriodStart time.Time `json:"periodStart"` - PeriodEnd time.Time `json:"periodEnd"` - InvoiceAt time.Time `json:"invoiceAt"` - - // Item details - Name string `json:"name"` - Type InvoiceItemType `json:"type"` - Quantity *alpacadecimal.Decimal `json:"quantity"` - UnitPrice alpacadecimal.Decimal `json:"unitPrice"` - Currency currencyx.Code `json:"currency"` - - TaxCodeOverride TaxOverrides `json:"taxCodeOverride"` -} - -func (i InvoiceItem) Validate() error { - if i.Namespace == "" { - return errors.New("namespace is required") - } - - if i.CustomerID == "" { - return errors.New("customer id is required") - } - - if i.PeriodStart.IsZero() { - return errors.New("period start is required") - } - - if i.PeriodEnd.IsZero() { - return errors.New("period end is required") - } - - if i.InvoiceAt.IsZero() { - return errors.New("invoice at is required") - } - - if i.Name == "" { - return errors.New("name is required") - } - - if i.Type == "" { - return errors.New("type is required") - } - - if i.Type != InvoiceItemTypeStatic { - // TODO: support usage items - return errors.New("only static items are supported") - } - - if i.Type == InvoiceItemTypeStatic && (i.Quantity == nil || i.Quantity.IsZero()) { - return errors.New("quantity is required for static items") - } - - if i.UnitPrice.IsZero() { - return errors.New("unit price is required") - } - - if i.Currency == "" { - return errors.New("currency is required") - } - - return nil -} diff --git a/openmeter/billing/entity/invoiceline.go b/openmeter/billing/entity/invoiceline.go new file mode 100644 index 000000000..ce1189110 --- /dev/null +++ b/openmeter/billing/entity/invoiceline.go @@ -0,0 +1,170 @@ +package billingentity + +import ( + "errors" + "fmt" + "time" + + "github.com/alpacahq/alpacadecimal" + + "github.com/openmeterio/openmeter/pkg/currencyx" +) + +type InvoiceLineType string + +const ( + // InvoiceLineTypeManualFee is an item that is manually added to the invoice. + InvoiceLineTypeManualFee InvoiceLineType = "manual_fee" + // InvoiceLineTypeFlatFee is an item that is charged at a fixed rate. + InvoiceLineTypeFlatFee InvoiceLineType = "flat_fee" + // InvoiceLineTypeUsageBased is an item that is charged based on usage. + InvoiceLineTypeUsageBased InvoiceLineType = "usage_based" +) + +func (InvoiceLineType) Values() []string { + return []string{ + string(InvoiceLineTypeManualFee), + string(InvoiceLineTypeFlatFee), + string(InvoiceLineTypeUsageBased), + } +} + +type InvoiceLineStatus string + +const ( + // InvoiceLineStatusValid is a valid invoice line. + InvoiceLineStatusValid InvoiceLineStatus = "valid" + // InvoiceLineStatusSplit is a split invoice line (the child lines will have this set as parent). + InvoiceLineStatusSplit InvoiceLineStatus = "split" +) + +func (InvoiceLineStatus) Values() []string { + return []string{ + string(InvoiceLineStatusValid), + string(InvoiceLineStatusSplit), + } +} + +type Period struct { + Start time.Time `json:"start"` + End time.Time `json:"end"` +} + +func (p Period) Validate() error { + if p.Start.IsZero() { + return errors.New("start is required") + } + + if p.End.IsZero() { + return errors.New("end is required") + } + + if p.Start.After(p.End) { + return errors.New("start must be before end") + } + + return nil +} + +// LineBase represents the common fields for an invoice item. +type LineBase struct { + Namespace string `json:"namespace"` + ID string `json:"id"` + + CreatedAt time.Time `json:"createdAt"` + UpdatedAt time.Time `json:"updatedAt"` + DeletedAt *time.Time `json:"deletedAt,omitempty"` + + Metadata map[string]string `json:"metadata"` + Name string `json:"name"` + Type InvoiceLineType `json:"type"` + Description *string `json:"description,omitempty"` + + InvoiceID string `json:"invoiceID,omitempty"` + Currency currencyx.Code `json:"currency"` + + // Lifecycle + Period Period `json:"period"` + InvoiceAt time.Time `json:"invoiceAt"` + + // TODO: Add discounts etc + + // Relationships + ParentLine *string `json:"parentLine,omitempty"` + RelatedLines []string `json:"relatedLine,omitempty"` + Status InvoiceLineStatus `json:"status"` + + TaxOverrides *TaxOverrides `json:"taxOverrides,omitempty"` + + Total alpacadecimal.Decimal `json:"total"` +} + +func (i LineBase) Validate() error { + if i.Namespace == "" { + return errors.New("namespace is required") + } + + if err := i.Period.Validate(); err != nil { + return fmt.Errorf("period: %w", err) + } + + if i.InvoiceAt.IsZero() { + return errors.New("invoice at is required") + } + + if i.Name == "" { + return errors.New("name is required") + } + + if i.Type == "" { + return errors.New("type is required") + } + + if err := i.Currency.Validate(); err != nil { + return errors.New("currency is required") + } + + return nil +} + +type ManualFeeLine struct { + Price alpacadecimal.Decimal + + Quantity alpacadecimal.Decimal `json:"quantity"` +} + +type Line struct { + LineBase + + ManualFee *ManualFeeLine `json:"manualFee,omitempty"` +} + +func (i Line) Validate() error { + if err := i.LineBase.Validate(); err != nil { + return fmt.Errorf("base: %w", err) + } + + switch i.Type { + case InvoiceLineTypeManualFee: + return i.ValidateManualFee() + default: + return fmt.Errorf("unsupported type: %s", i.Type) + } +} + +func (i Line) ValidateManualFee() error { + if i.ManualFee == nil { + return errors.New("manual fee is required") + } + + if !i.ManualFee.Price.IsPositive() { + return errors.New("price should be greater than zero") + } + + if !i.ManualFee.Quantity.IsPositive() { + return errors.New("quantity should be positive required") + } + + // TODO: Validate currency specifics + return nil +} diff --git a/openmeter/billing/entity/profile.go b/openmeter/billing/entity/profile.go index d97948d6a..987c6f6f6 100644 --- a/openmeter/billing/entity/profile.go +++ b/openmeter/billing/entity/profile.go @@ -114,9 +114,9 @@ func (c *CollectionConfig) Validate() error { // InvoiceConfig groups fields related to invoice settings. type InvoicingConfig struct { - AutoAdvance *bool `json:"autoAdvance"` + AutoAdvance *bool `json:"autoAdvance,omitempty"` DraftPeriod datex.Period `json:"draftPeriod,omitempty"` - DueAfter datex.Period `json:"dueAfter"` + DueAfter datex.Period `json:"dueAfter,omitempty"` } func (c *InvoicingConfig) Validate() error { @@ -202,11 +202,11 @@ type BaseProfile struct { Namespace string `json:"namespace"` Name string `json:"name"` - Description *string `json:"description"` + Description *string `json:"description,omitempty"` CreatedAt time.Time `json:"createdAt"` UpdatedAt time.Time `json:"updatedAt"` - DeletedAt *time.Time `json:"deletedAt"` + DeletedAt *time.Time `json:"deletedAt,omitempty"` WorkflowConfig WorkflowConfig `json:"workflow"` @@ -242,8 +242,7 @@ type Profile struct { BaseProfile // Optionaly expanded fields - Apps *ProfileApps `json:"-"` - Customer *customerentity.Customer `json:"-"` + Apps *ProfileApps `json:"-"` } type ProfileApps struct { @@ -313,3 +312,10 @@ func (i ProfileAppReferences) Validate() error { return nil } + +type InvoiceWorkflow struct { + AppReferences ProfileAppReferences `json:"appReferences"` + Apps *ProfileApps `json:"apps,omitempty"` + SourceBillingProfileID string `json:"sourceBillingProfileId,omitempty"` + WorkflowConfig WorkflowConfig `json:"workflow"` +} diff --git a/openmeter/billing/entity/tax.go b/openmeter/billing/entity/tax.go index c5aa1f687..13406427e 100644 --- a/openmeter/billing/entity/tax.go +++ b/openmeter/billing/entity/tax.go @@ -6,6 +6,7 @@ type StripeTaxOverride struct { TaxCode StripeTaxCode `json:"taxCode,omitempty"` } +// TODO: This (and the mappers) should come from product catalog when the API/entities are available type TaxOverrides struct { Stripe *StripeTaxOverride `json:"stripe,omitempty"` } diff --git a/openmeter/billing/errors.go b/openmeter/billing/errors.go index d101a3e17..05dd61446 100644 --- a/openmeter/billing/errors.go +++ b/openmeter/billing/errors.go @@ -44,6 +44,7 @@ const ( EntityCustomerOverride = "BillingCustomerOverride" EntityCustomer = "Customer" EntityDefaultProfile = "DefaultBillingProfile" + EntityInvoice = "Invoice" ) type NotFoundError struct { diff --git a/openmeter/billing/gobldriver/errors.go b/openmeter/billing/gobldriver/errors.go deleted file mode 100644 index 8e642a69d..000000000 --- a/openmeter/billing/gobldriver/errors.go +++ /dev/null @@ -1,28 +0,0 @@ -package gobldriver - -import ( - "github.com/invopop/validation" - - goblvalidation "github.com/openmeterio/openmeter/pkg/gobl/validation" -) - -var ( - ErrLoadingTimezoneLocation = goblvalidation.NewError("invalid_tz", "error loading timezone location") - ErrMissingPaymentMethod = goblvalidation.NewError("missing_payment_method", "missing payment method") - ErrMissingCustomerBillingAddress = goblvalidation.NewError("customer_billing_address_not_found", "missing customer billing address") - - ErrNumberConversion = goblvalidation.NewError("number_conversion", "error converting number") -) - -func NewWithMessage(err validation.Error, msg string) validation.Error { - // TODO: msg is a template, so we can use params if we really want to - return validation.NewError(err.Code(), msg) -} - -func upsertErrors(err validation.Errors) validation.Errors { - if err == nil { - return validation.Errors{} - } - - return err -} diff --git a/openmeter/billing/gobldriver/invoice.go b/openmeter/billing/gobldriver/invoice.go deleted file mode 100644 index 637dd4868..000000000 --- a/openmeter/billing/gobldriver/invoice.go +++ /dev/null @@ -1,328 +0,0 @@ -package gobldriver - -import ( - "context" - "fmt" - "log/slog" - "slices" - "strconv" - "time" - - "cloud.google.com/go/civil" - "github.com/alpacahq/alpacadecimal" - "github.com/invopop/gobl/bill" - "github.com/invopop/gobl/cal" - "github.com/invopop/gobl/cbc" - "github.com/invopop/gobl/currency" - "github.com/invopop/gobl/l10n" - "github.com/invopop/gobl/org" - "github.com/invopop/gobl/pay" - "github.com/invopop/gobl/schema" - "github.com/invopop/gobl/tax" - "github.com/invopop/validation" - "github.com/samber/lo" - - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/pkg/gobl" -) - -type Driver struct { - logger *slog.Logger -} - -type DriverConfig struct { - Logger *slog.Logger -} - -func (c DriverConfig) Validate() error { - if c.Logger == nil { - return fmt.Errorf("logger is required") - } - return nil -} - -func NewDriver(config DriverConfig) (*Driver, error) { - if err := config.Validate(); err != nil { - return nil, fmt.Errorf("error validating driver config: %w", err) - } - - return &Driver{ - logger: config.Logger, - }, nil -} - -type invoiceWithValidation struct { - Invoice *bill.Invoice - ValidationErrors []error -} - -// Generate converts a billing.Invoice to a gobldriver.Invoice -// if error is set, then a non-recordable error occurred -// if the invoice has validation issues then the Invoice's ValidationError will be set -// and the Invoice's Complements will contain the validation notes -func (d *Driver) Generate(ctx context.Context, invoice billingentity.InvoiceWithValidation) (*bill.Invoice, error) { - inv := d.invoiceToGOBL(invoice) - - if err := inv.Invoice.Validate(); err != nil { - inv.ValidationErrors = append(inv.ValidationErrors, err) - } - - if err := inv.Invoice.Calculate(); err != nil { - inv.ValidationErrors = append(inv.ValidationErrors, err) - } - - // TODO[OM-929]: Hook in all provider specific validations (see openmeter/provider/api.go) - - if len(inv.ValidationErrors) > 0 { - complement, err := NewValidationErrorsComplement(inv.ValidationErrors) - if err != nil { - return nil, fmt.Errorf("error creating validation errors complement: %w", err) - } - - object, err := schema.NewObject(complement) - if err != nil { - return nil, fmt.Errorf("error creating schema object: %w", err) - } - - inv.Invoice.Complements = append(inv.Invoice.Complements, object) - } - - return inv.Invoice, nil -} - -// invoiceToGOBL converts a billing.Invoice to a gobl invoice. If error is set, then -// a fatal error has occurred, which should be reported to the caller instead of putting -// it into the validation errors. -func (d *Driver) invoiceToGOBL(input billingentity.InvoiceWithValidation) invoiceWithValidation { - validationErrors := slices.Clone(input.ValidationErrors) - - inv := input.Invoice - - loc, err := inv.Timezone.LoadLocation() - if err != nil { - validationErrors = append(validationErrors, NewWithMessage( - ErrLoadingTimezoneLocation, - fmt.Sprintf("error loading timezone location[%s]: %v", inv.Timezone, err), - )) - - // fallback to UTC - loc = time.UTC - } - - customer, vErr := d.invoiceCustomerToParty(inv.Customer) - if len(vErr) > 0 { - validationErrors = append(validationErrors, validation.Errors{ - "customer": vErr, - }) - } - - invoice := &bill.Invoice{ - Type: inv.Type.CBCKey(), - Series: cbc.Code(inv.InvoiceNumber.Series), - Code: cbc.Code(inv.InvoiceNumber.Code), - IssueDate: cal.Date{ - Date: civil.DateOf(lo.FromPtrOr(inv.IssuedAt, inv.CreatedAt).In(loc)), - }, - Currency: currency.Code(inv.Currency), - Supplier: d.invoiceSupplierContactToParty(inv.Profile.Supplier), - Customer: customer, - Totals: &bill.Totals{}, - Meta: gobl.MetadataToGOBLMeta(inv.Metadata), - } - - // NOTE: We need to add this to the Meta as gobl only supports UUID IDs - invoice.Meta[InvoiceIDKey] = inv.ID - - switch inv.Profile.WorkflowConfig.Payment.CollectionMethod { - case billingentity.CollectionMethodChargeAutomatically: - invoice.Payment = &bill.Payment{ - Terms: &pay.Terms{ - Key: pay.TermKeyInstant, - }, - } - - case billingentity.CollectionMethodSendInvoice: - invoice.Payment = &bill.Payment{ - Terms: &pay.Terms{ - Key: pay.TermKeyDueDate, - DueDates: []*pay.DueDate{ - { - Date: &cal.Date{ - Date: civil.DateOf(inv.DueDate.In(loc)), - }, - }, - }, - }, - } - default: - // Most probably caused by missing billing profile/override - validationErrors = append(validationErrors, ErrMissingPaymentMethod) - } - - var lineValidationErrors validation.Errors - - for idx, item := range inv.Items { - line, err := d.invoiceItemToLine(item, loc) - if err != nil { - lineValidationErrors = upsertErrors(lineValidationErrors) - lineValidationErrors[strconv.Itoa(idx)] = err - } - - // Set the index of the line, as validation makes this required (indexing starts from 1 - // as the validator considers 0 as empty value for index) - line.Index = idx + 1 - - invoice.Lines = append(invoice.Lines, line) - } - - if len(lineValidationErrors) > 0 { - // Let's prepend the lines to the validation errors so that the json structure is correct - validationErrors = append(validationErrors, validation.Errors{ - "lines": lineValidationErrors, - }) - } - - // TODO: Series will most probably end up in Complements - - return invoiceWithValidation{ - Invoice: invoice, - ValidationErrors: validationErrors, - } -} - -func (d *Driver) invoiceItemToLine(item billingentity.InvoiceItem, loc *time.Location) (*bill.Line, validation.Errors) { - var validationErrs validation.Errors - - // TODO: for usage based items we need to add a different logic - quantity, err := gobl.DecimalToAmount(lo.FromPtrOr(item.Quantity, alpacadecimal.Zero)) - if err != nil { - validationErrs = upsertErrors(validationErrs) - - validationErrs["quantity"] = NewWithMessage( - ErrNumberConversion, - fmt.Sprintf("error converting quantity: %v", err)) - } - - unitPrice, err := gobl.DecimalToAmount(item.UnitPrice) - if err != nil { - validationErrs = upsertErrors(validationErrs) - - validationErrs["item"] = validation.Errors{ - "unitPrice": NewWithMessage( - ErrNumberConversion, - fmt.Sprintf("error converting unit price: %v", err)), - } - } - - return &bill.Line{ - Quantity: quantity, - Item: &org.Item{ - // TODO: more fields from product catalog - Name: item.Name, - Price: unitPrice, - Currency: currency.Code(item.Currency), - }, - // NOTE: We need to add these as Notes as only the Items have Meta which is more on the - // product catalog side, so it would be missleading to add the ID there - Notes: []*cbc.Note{ - d.invoiceItemLifecycleNote(item, loc), // Billing period etc. - d.invoiceItemEntityNote(item), - }, - }, validationErrs -} - -func (d *Driver) invoiceItemLifecycleNote(item billingentity.InvoiceItem, loc *time.Location) *cbc.Note { - note := &cbc.Note{ - Key: cbc.NoteKeyReason, - Code: InvoiceItemCodeLifecycle, - Src: InvoiceItemNoteSourceOpenmeter, - Meta: cbc.Meta{ - InvoiceItemBillingPeriodEnd: item.PeriodEnd.In(loc).Format(time.RFC3339), - InvoiceItemBillingPeriodStart: item.PeriodStart.In(loc).Format(time.RFC3339), - InvoiceItemInvoiceAt: item.InvoiceAt.In(loc).Format(time.RFC3339), - InvoiceItemCreated: item.CreatedAt.In(loc).Format(time.RFC3339), - InvoiceItemUpdated: item.UpdatedAt.In(loc).Format(time.RFC3339), - }, - } - - // RFC1123 is used for human readability (as it has human readable timezone) - // The Meta fields contain the RFC3339 format for machine readability - note.Text = fmt.Sprintf("Billing period: %s - %s", - item.PeriodStart.In(loc).Format(time.RFC1123), - item.PeriodEnd.In(loc).Format(time.RFC1123)) - - return note -} - -func (d *Driver) invoiceItemEntityNote(item billingentity.InvoiceItem) *cbc.Note { - note := &cbc.Note{ - Key: cbc.NoteKeyGeneral, - Code: InvoiceItemCodeEntity, - Src: InvoiceItemNoteSourceOpenmeter, - Text: fmt.Sprintf("reference: %s", item.ID), - Meta: cbc.Meta{ - InvoiceItemEntityID: item.ID, - }, - } - - return note -} - -func (d *Driver) invoiceCustomerToParty(i billingentity.InvoiceCustomer) (*org.Party, validation.Errors) { - if i.BillingAddress == nil { - return nil, validation.Errors{ - "billingAddress": ErrMissingCustomerBillingAddress, - } - } - party := &org.Party{ - Name: i.Name, - Addresses: []*org.Address{ - { - Country: l10n.ISOCountryCode(lo.FromPtrOr(i.BillingAddress.Country, "")), - Street: lo.FromPtrOr(i.BillingAddress.Line1, ""), - StreetExtra: lo.FromPtrOr(i.BillingAddress.Line2, ""), - Region: lo.FromPtrOr(i.BillingAddress.State, ""), - Locality: lo.FromPtrOr(i.BillingAddress.City, ""), - - Code: lo.FromPtrOr(i.BillingAddress.PostalCode, ""), - }, - }, - } - - if i.BillingAddress.PhoneNumber != nil { - party.Telephones = append(party.Telephones, &org.Telephone{ - Number: *i.BillingAddress.PhoneNumber, - }) - } - - if i.PrimaryEmail != nil { - party.Emails = append(party.Emails, &org.Email{ - Address: *i.PrimaryEmail, - }) - } - return party, nil -} - -func (d *Driver) invoiceSupplierContactToParty(c billingentity.SupplierContact) *org.Party { - party := &org.Party{ - Name: c.Name, - Addresses: []*org.Address{ - { - Country: l10n.ISOCountryCode(lo.FromPtrOr(c.Address.Country, "")), - Street: lo.FromPtrOr(c.Address.Line1, ""), - StreetExtra: lo.FromPtrOr(c.Address.Line2, ""), - Region: lo.FromPtrOr(c.Address.State, ""), - Locality: lo.FromPtrOr(c.Address.City, ""), - - Code: lo.FromPtrOr(c.Address.PostalCode, ""), - }, - }, - // TODO[OM-931]: we might want to add an option tax ID too - TaxID: &tax.Identity{ - Country: l10n.TaxCountryCode(lo.FromPtrOr(c.Address.Country, "")), - }, - } - - // TODO[OM-932]: add email, phone, etc. - return party -} diff --git a/openmeter/billing/gobldriver/invoice_test.go b/openmeter/billing/gobldriver/invoice_test.go deleted file mode 100644 index fc973aac4..000000000 --- a/openmeter/billing/gobldriver/invoice_test.go +++ /dev/null @@ -1,119 +0,0 @@ -package gobldriver - -import ( - "context" - "encoding/json" - "errors" - "log/slog" - "testing" - "time" - - "github.com/alpacahq/alpacadecimal" - "github.com/invopop/gobl/currency" - "github.com/samber/lo" - "github.com/stretchr/testify/require" - - "github.com/openmeterio/openmeter/openmeter/billing" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/pkg/currencyx" -) - -func TestValidationErrors(t *testing.T) { - now := time.Now() - billingPeriodStart := now.AddDate(0, -1, 0) - billingPeriodEnd := now.AddDate(0, 1, 0) - - invoice := billingentity.InvoiceWithValidation{ - Invoice: &billingentity.Invoice{ - Currency: currencyx.Code(currency.USD), - Items: []billingentity.InvoiceItem{ - { - Name: "item in usd", - Quantity: lo.ToPtr(alpacadecimal.NewFromFloat(1)), - UnitPrice: alpacadecimal.NewFromFloat(100), - Currency: "USD", - PeriodStart: billingPeriodStart, - PeriodEnd: billingPeriodEnd, - CreatedAt: billingPeriodStart, - }, - { - Name: "item in huf", - Quantity: lo.ToPtr(alpacadecimal.NewFromFloat(2)), - UnitPrice: alpacadecimal.NewFromFloat(200), - Currency: "HUF", - PeriodStart: billingPeriodStart, - PeriodEnd: billingPeriodEnd, - CreatedAt: billingPeriodStart, - }, - { - // This tests the line item conversion validation - Name: "item with too big quantity huf", - Quantity: lo.ToPtr(lo.Must(alpacadecimal.NewFromString("19223372036854775807"))), - UnitPrice: alpacadecimal.NewFromFloat(200), - Currency: "HUF", - PeriodStart: billingPeriodStart, - PeriodEnd: billingPeriodEnd, - CreatedAt: billingPeriodStart, - }, - }, - }, - ValidationErrors: []error{ - errors.New("generic error"), - billing.NotFoundError{ - Err: billing.ErrDefaultProfileNotFound, - }, - }, - } - - d := Driver{ - logger: slog.Default(), - } - - inv, err := d.Generate(context.Background(), invoice) - require.NoError(t, err) - require.NotNil(t, inv) - require.Len(t, inv.Complements, 1) - - validationError, err := LookupValidationErrors(inv) - require.NoError(t, err) - require.NotNil(t, validationError) - - expectedOutput := ValidationErrorsComplement{ - Fields: map[string][]ValidationErrorJSON{ - "customer.billingAddress": { - {Code: "customer_billing_address_not_found", Message: "missing customer billing address"}, - }, - "lines.1": { - {Message: "no exchange rate found from 'HUF' to 'USD'"}, - }, - "lines.2.quantity": { - {Code: "number_conversion", Message: "error converting quantity: invalid major number '19223372036854775807', strconv.ParseInt: parsing \"19223372036854775807\": value out of range"}, - }, - "supplier.name": { - {Code: "validation_required", Message: "cannot be blank"}, - }, - "type": { - {Code: "validation_required", Message: "cannot be blank"}, - }, - }, - Global: []ValidationErrorJSON{ - {Message: "generic error"}, - {Code: "default_profile_not_found", Message: "default profile not found"}, - {Code: "missing_payment_method", Message: "missing payment method"}, - }, - } - - require.Equal(t, expectedOutput, validationError) - - // Let's validate marshaling unmarshaling - t.Run("json tags", func(t *testing.T) { - marshaledVE, err := json.Marshal(validationError) - require.NoError(t, err) - require.NotEmpty(t, marshaledVE) - - parsedValidationError := ValidationErrorsComplement{} - require.NoError(t, json.Unmarshal(marshaledVE, &parsedValidationError)) - - require.Equal(t, validationError, parsedValidationError) - }) -} diff --git a/openmeter/billing/gobldriver/metadata.go b/openmeter/billing/gobldriver/metadata.go deleted file mode 100644 index 70c39198c..000000000 --- a/openmeter/billing/gobldriver/metadata.go +++ /dev/null @@ -1,31 +0,0 @@ -package gobldriver - -import "github.com/invopop/gobl/cbc" - -const ( - // Invoice constants - InvoiceIDKey cbc.Key = "openmeter-invoice-id" - - // InvoiceItem note constants - InvoiceItemNoteSourceOpenmeter cbc.Key = "openmeter-billing" - - // Lifecycle note constants - - // InvoiceItemCodeLifecycle is the code for the lifecycle of an invoice item (e.g. billing period, created, etc.) - InvoiceItemCodeLifecycle string = "lifecycle" - - // All metadata field names must match ^(?:[a-z]|[a-z0-9][a-z0-9-+]*[a-z0-9])$` - // see: https://github.com/invopop/gobl/blob/d10f919fd2d9b59972aebb2295c25030eb1ba38e/cbc/key.go#L20 - InvoiceItemBillingPeriodStart cbc.Key = "billing-period-start" - InvoiceItemBillingPeriodEnd cbc.Key = "billing-period-end" - InvoiceItemInvoiceAt cbc.Key = "invoice-at" - InvoiceItemCreated cbc.Key = "created-at" - InvoiceItemUpdated cbc.Key = "updated-at" - - // Entity note constants - - // InvoiceItemCodeEntity is the code for the entity of an invoice item (e.g. id, etc.) - InvoiceItemCodeEntity string = "entity" - - InvoiceItemEntityID cbc.Key = "entity-id" -) diff --git a/openmeter/billing/gobldriver/validationcomplement.go b/openmeter/billing/gobldriver/validationcomplement.go deleted file mode 100644 index 9017c9df7..000000000 --- a/openmeter/billing/gobldriver/validationcomplement.go +++ /dev/null @@ -1,124 +0,0 @@ -package gobldriver - -import ( - "fmt" - "sync" - - "github.com/invopop/gobl/bill" - "github.com/invopop/gobl/schema" - "github.com/invopop/validation" - "github.com/samber/lo" -) - -type ValidationErrorJSON struct { - Code string `json:"code,omitempty"` - Message string `json:"message"` -} - -// ValidationErrorsComplement is a struct that contains validation errors and will be appended to the -// Invoice's Complements field -type ValidationErrorsComplement struct { - // Errors is a map of field names (JSON Path) to validation errors - Fields map[string][]ValidationErrorJSON `json:"fields"` - Global []ValidationErrorJSON `json:"global"` -} - -func (v ValidationErrorsComplement) HasErrors() bool { - return len(v.Fields) > 0 || len(v.Global) > 0 -} - -const ( - openmeterSchemaBase = schema.ID("https://openmeter.io/schema/") -) - -var goblSchemaRegistrationOnce sync.Once - -func registerComplementSchema() { - goblSchemaRegistrationOnce.Do(func() { - schema.Register(openmeterSchemaBase, ValidationErrorsComplement{}) - }) -} - -func NewValidationErrorsComplement(vErrors []error) (ValidationErrorsComplement, error) { - registerComplementSchema() - - if vErrors == nil { - return ValidationErrorsComplement{}, nil - } - - out := ValidationErrorsComplement{ - Fields: make(map[string][]ValidationErrorJSON), - } - - for _, vErr := range vErrors { - if vErr == nil { - continue - } - - if vFieldErrors, ok := lo.ErrorsAs[validation.Errors](vErr); ok { - errorsToFieldList(vFieldErrors, out.Fields) - } else if vGlobalError, ok := lo.ErrorsAs[validation.Error](vErr); ok { - out.Global = append(out.Global, ValidationErrorJSON{ - Code: vGlobalError.Code(), - Message: vGlobalError.Message(), - }) - } else { - out.Global = append(out.Global, ValidationErrorJSON{ - Message: vErr.Error(), - }) - } - } - - return out, nil -} - -func LookupValidationErrors(in *bill.Invoice) (ValidationErrorsComplement, error) { - errorsSchemaID := schema.Lookup(ValidationErrorsComplement{}) - - for _, schemaObject := range in.Complements { - if schemaObject.Schema == errorsSchemaID { - vErrors, ok := schemaObject.Instance().(ValidationErrorsComplement) - if !ok { - return ValidationErrorsComplement{}, fmt.Errorf("unexpected type for validation errors complement: %T", schemaObject.Instance()) - } - - return vErrors, nil - } - } - - return ValidationErrorsComplement{}, nil -} - -func errorsToFieldList(rootErr validation.Errors, target map[string][]ValidationErrorJSON) { - if rootErr == nil { - return - } - - errorsToFieldListImpl(rootErr, "", target) -} - -func errorsToFieldListImpl(rootErr validation.Errors, currentPath string, target map[string][]ValidationErrorJSON) { - for field, err := range rootErr { - if err == nil { - continue - } - - fieldPath := fmt.Sprintf("%s.%s", currentPath, field) - if currentPath == "" { - fieldPath = field - } - - if vErrors, ok := lo.ErrorsAs[validation.Errors](err); ok { - errorsToFieldListImpl(vErrors, fieldPath, target) - } else if vError, ok := lo.ErrorsAs[validation.Error](err); ok { - target[fieldPath] = append(target[field], ValidationErrorJSON{ - Code: vError.Code(), - Message: vError.Message(), - }) - } else { - target[fieldPath] = append(target[field], ValidationErrorJSON{ - Message: err.Error(), - }) - } - } -} diff --git a/openmeter/billing/httpdriver/defaults.go b/openmeter/billing/httpdriver/defaults.go index 73e45bdc7..7c6a96edb 100644 --- a/openmeter/billing/httpdriver/defaults.go +++ b/openmeter/billing/httpdriver/defaults.go @@ -4,4 +4,5 @@ const ( DefaultPageSize = 100 DefaultPageNumber = 1 DefaultIncludeArchived = false + DefaultInvoiceTimezone = "UTC" ) diff --git a/openmeter/billing/httpdriver/errors.go b/openmeter/billing/httpdriver/errors.go index 6e33e898f..76c5944f5 100644 --- a/openmeter/billing/httpdriver/errors.go +++ b/openmeter/billing/httpdriver/errors.go @@ -4,7 +4,9 @@ import ( "context" "net/http" + "github.com/openmeterio/openmeter/openmeter/app" "github.com/openmeterio/openmeter/openmeter/billing" + customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" "github.com/openmeterio/openmeter/pkg/framework/commonhttp" "github.com/openmeterio/openmeter/pkg/framework/transport/httptransport" "github.com/openmeterio/openmeter/pkg/models" @@ -15,6 +17,15 @@ func errorEncoder() httptransport.ErrorEncoder { return commonhttp.HandleErrorIfTypeMatches[*models.GenericUserError](ctx, http.StatusBadRequest, err, w) || commonhttp.HandleErrorIfTypeMatches[billing.NotFoundError](ctx, http.StatusNotFound, err, w) || commonhttp.HandleErrorIfTypeMatches[billing.ValidationError](ctx, http.StatusBadRequest, err, w) || - commonhttp.HandleErrorIfTypeMatches[billing.UpdateAfterDeleteError](ctx, http.StatusConflict, err, w) + commonhttp.HandleErrorIfTypeMatches[billing.UpdateAfterDeleteError](ctx, http.StatusConflict, err, w) || + // dependency: customer + commonhttp.HandleErrorIfTypeMatches[customerentity.NotFoundError](ctx, http.StatusNotFound, err, w) || + commonhttp.HandleErrorIfTypeMatches[customerentity.ValidationError](ctx, http.StatusBadRequest, err, w) || + commonhttp.HandleErrorIfTypeMatches[customerentity.UpdateAfterDeleteError](ctx, http.StatusConflict, err, w) || + commonhttp.HandleErrorIfTypeMatches[customerentity.SubjectKeyConflictError](ctx, http.StatusConflict, err, w) || + // dependency: apps + commonhttp.HandleErrorIfTypeMatches[app.AppNotFoundError](ctx, http.StatusNotFound, err, w) || + commonhttp.HandleErrorIfTypeMatches[app.AppDefaultNotFoundError](ctx, http.StatusNotFound, err, w) || + commonhttp.HandleErrorIfTypeMatches[app.ValidationError](ctx, http.StatusBadRequest, err, w) } } diff --git a/openmeter/billing/httpdriver/handler.go b/openmeter/billing/httpdriver/handler.go index 2802bc583..b45e99145 100644 --- a/openmeter/billing/httpdriver/handler.go +++ b/openmeter/billing/httpdriver/handler.go @@ -13,6 +13,8 @@ import ( type Handler interface { ProfileHandler + InvoiceLineHandler + InvoiceHandler } type ProfileHandler interface { @@ -23,6 +25,14 @@ type ProfileHandler interface { ListProfiles() ListProfilesHandler } +type InvoiceLineHandler interface { + CreateLineByCustomer() CreateLineByCustomerHandler +} + +type InvoiceHandler interface { + ListInvoices() ListInvoicesHandler +} + type handler struct { service billing.Service namespaceDecoder namespacedriver.NamespaceDecoder diff --git a/openmeter/billing/httpdriver/invoice.go b/openmeter/billing/httpdriver/invoice.go new file mode 100644 index 000000000..97536635e --- /dev/null +++ b/openmeter/billing/httpdriver/invoice.go @@ -0,0 +1,212 @@ +package httpdriver + +import ( + "context" + "fmt" + "net/http" + "slices" + + "github.com/samber/lo" + + "github.com/openmeterio/openmeter/api" + "github.com/openmeterio/openmeter/openmeter/billing" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/pkg/framework/commonhttp" + "github.com/openmeterio/openmeter/pkg/framework/transport/httptransport" + "github.com/openmeterio/openmeter/pkg/pagination" +) + +type ( + ListInvoicesRequest = billing.ListInvoicesInput + ListInvoicesResponse = api.InvoicePaginatedResponse + ListInvoicesParams = api.BillingListInvoicesParams + ListInvoicesHandler httptransport.HandlerWithArgs[ListInvoicesRequest, ListInvoicesResponse, ListInvoicesParams] +) + +func (h *handler) ListInvoices() ListInvoicesHandler { + return httptransport.NewHandlerWithArgs( + func(ctx context.Context, r *http.Request, input ListInvoicesParams) (ListInvoicesRequest, error) { + ns, err := h.resolveNamespace(ctx) + if err != nil { + return ListInvoicesRequest{}, fmt.Errorf("failed to resolve namespace: %w", err) + } + + return ListInvoicesRequest{ + Namespace: ns, + + Customers: lo.FromPtrOr(input.Customers, nil), + Statuses: lo.Map( + lo.FromPtrOr(input.Statuses, nil), + func(status api.BillingInvoiceStatus, _ int) billingentity.InvoiceStatus { + return billingentity.InvoiceStatus(status) + }, + ), + + IssuedAfter: input.IssuedAfter, + IssuedBefore: input.IssuedBefore, + Expand: mapInvoiceExpandToEntity(lo.FromPtrOr(input.Expand, nil)), + + Page: pagination.Page{ + PageSize: lo.FromPtrOr(input.PageSize, DefaultPageSize), + PageNumber: lo.FromPtrOr(input.Page, DefaultPageNumber), + }, + }, nil + }, + func(ctx context.Context, request ListInvoicesRequest) (ListInvoicesResponse, error) { + invoices, err := h.service.ListInvoices(ctx, request) + if err != nil { + return ListInvoicesResponse{}, err + } + + res := ListInvoicesResponse{ + Items: make([]api.BillingInvoice, 0, len(invoices.Items)), + Page: invoices.Page.PageNumber, + PageSize: invoices.Page.PageSize, + TotalCount: invoices.TotalCount, + } + + for _, invoice := range invoices.Items { + invoice, err := mapInvoiceToAPI(invoice) + if err != nil { + return ListInvoicesResponse{}, err + } + + res.Items = append(res.Items, invoice) + } + + return res, nil + }, + commonhttp.JSONResponseEncoderWithStatus[ListInvoicesResponse](http.StatusOK), + httptransport.AppendOptions( + h.options, + httptransport.WithOperationName("billingListLinvoices"), + httptransport.WithErrorEncoder(errorEncoder()), + )..., + ) +} + +func mapInvoiceToAPI(invoice billingentity.Invoice) (api.BillingInvoice, error) { + var apps *api.BillingProfileAppsOrReference + + // If the workflow is not expanded we won't have this + if invoice.Workflow != nil { + var err error + + if invoice.Workflow.Apps != nil { + apps, err = mapProfileAppsToAPI(invoice.Workflow.Apps) + if err != nil { + return api.BillingInvoice{}, fmt.Errorf("failed to map profile apps to API: %w", err) + } + } else { + apps, err = mapProfileAppReferencesToAPI(&invoice.Workflow.AppReferences) + if err != nil { + return api.BillingInvoice{}, fmt.Errorf("failed to map profile app references to API: %w", err) + } + } + } + + out := api.BillingInvoice{ + Id: invoice.ID, + + CreatedAt: invoice.CreatedAt, + UpdatedAt: invoice.UpdatedAt, + DeletedAt: invoice.DeletedAt, + IssuedAt: invoice.IssuedAt, + VoidedAt: invoice.VoidedAt, + DueAt: invoice.DueAt, + Period: mapPeriodToAPI(invoice.Period), + + Currency: string(invoice.Currency), + Customer: mapInvoiceCustomerToAPI(invoice.Customer), + + Number: invoice.Number, + Description: invoice.Description, + Metadata: lo.EmptyableToPtr(invoice.Metadata), + + Status: api.BillingInvoiceStatus(invoice.Status), + Supplier: mapSupplierContactToAPI(invoice.Supplier), + // TODO[OM-942]: This needs to be (re)implemented + Totals: api.BillingInvoiceTotals{}, + // TODO[OM-943]: Implement + Payment: nil, + Type: api.BillingInvoiceType(invoice.Type), + } + + if invoice.Workflow != nil { + out.Workflow = &api.BillingInvoiceWorkflowSettings{ + Apps: apps, + SourceBillingProfileID: invoice.Workflow.SourceBillingProfileID, + Workflow: mapWorkflowConfigSettingsToAPI(invoice.Workflow.WorkflowConfig), + Timezone: string(invoice.Timezone), + } + } + + if len(invoice.Lines) > 0 { + outLines := make([]api.BillingInvoiceLine, 0, len(invoice.Lines)) + + for _, line := range invoice.Lines { + mappedLine, err := mapBillingLineToAPI(line) + if err != nil { + return api.BillingInvoice{}, fmt.Errorf("failed to map billing line[%s] to API: %w", line.ID, err) + } + outLines = append(outLines, mappedLine) + } + + out.Lines = &outLines + } + + return out, nil +} + +func mapPeriodToAPI(p *billingentity.Period) *api.BillingPeriod { + if p == nil { + return nil + } + + return &api.BillingPeriod{ + Start: p.Start, + End: p.End, + } +} + +func mapInvoiceCustomerToAPI(c billingentity.InvoiceCustomer) api.BillingParty { + a := c.BillingAddress + + return api.BillingParty{ + Id: lo.ToPtr(c.CustomerID), + Name: lo.EmptyableToPtr(c.Name), + Addresses: lo.ToPtr([]api.Address{ + { + Country: (*string)(a.Country), + PostalCode: a.PostalCode, + State: a.State, + City: a.City, + Line1: a.Line1, + Line2: a.Line2, + PhoneNumber: a.PhoneNumber, + }, + }), + } +} + +func mapInvoiceExpandToEntity(expand []api.BillingInvoiceExpand) billing.InvoiceExpand { + if len(expand) == 0 { + return billing.InvoiceExpand{} + } + + if slices.Contains(expand, api.BillingInvoiceExpandAll) { + return billing.InvoiceExpand{ + Lines: true, + Preceding: true, + Workflow: true, + WorkflowApps: true, + } + } + + return billing.InvoiceExpand{ + Lines: slices.Contains(expand, api.BillingInvoiceExpandLines), + Preceding: slices.Contains(expand, api.BillingInvoiceExpandPreceding), + Workflow: slices.Contains(expand, api.BillingInvoiceExpandWorkflow), + WorkflowApps: slices.Contains(expand, api.BillingInvoiceExpandWorkflowApps), + } +} diff --git a/openmeter/billing/httpdriver/invoiceline.go b/openmeter/billing/httpdriver/invoiceline.go new file mode 100644 index 000000000..838b45aae --- /dev/null +++ b/openmeter/billing/httpdriver/invoiceline.go @@ -0,0 +1,223 @@ +package httpdriver + +import ( + "context" + "fmt" + "net/http" + + "github.com/alpacahq/alpacadecimal" + "github.com/samber/lo" + + "github.com/openmeterio/openmeter/api" + "github.com/openmeterio/openmeter/openmeter/billing" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/framework/commonhttp" + "github.com/openmeterio/openmeter/pkg/framework/transport/httptransport" +) + +type ( + CreateLineByCustomerRequest = billing.CreateInvoiceLinesInput + CreateLineByCustomerResponse = api.BillingCreateLineResult + CreateLineByCustomerHandler httptransport.HandlerWithArgs[CreateLineByCustomerRequest, CreateLineByCustomerResponse, string] +) + +func (h *handler) CreateLineByCustomer() CreateLineByCustomerHandler { + return httptransport.NewHandlerWithArgs( + func(ctx context.Context, r *http.Request, customerKeyOrId string) (CreateLineByCustomerRequest, error) { + body := api.BillingCreateLineByCustomerJSONRequestBody{} + + if err := commonhttp.JSONRequestBodyDecoder(r, &body); err != nil { + return CreateLineByCustomerRequest{}, fmt.Errorf("failed to decode request body: %w", err) + } + + ns, err := h.resolveNamespace(ctx) + if err != nil { + return CreateLineByCustomerRequest{}, fmt.Errorf("failed to resolve namespace: %w", err) + } + + lines := make([]billingentity.Line, 0, len(body.Lines)) + for _, line := range body.Lines { + line, err := mapCreateLineToEntity(line, ns) + if err != nil { + return CreateLineByCustomerRequest{}, fmt.Errorf("failed to map line: %w", err) + } + lines = append(lines, line) + } + + return CreateLineByCustomerRequest{ + CustomerKeyOrID: customerKeyOrId, + Namespace: ns, + Lines: lines, + }, nil + }, + func(ctx context.Context, request CreateLineByCustomerRequest) (CreateLineByCustomerResponse, error) { + lines, err := h.service.CreateInvoiceLines(ctx, request) + if err != nil { + return CreateLineByCustomerResponse{}, fmt.Errorf("failed to create invoice lines: %w", err) + } + + res := CreateLineByCustomerResponse{ + Lines: make([]api.BillingInvoiceLine, 0, len(lines.Lines)), + } + + for _, line := range lines.Lines { + line, err := mapBillingLineToAPI(line) + if err != nil { + return CreateLineByCustomerResponse{}, fmt.Errorf("failed to map line: %w", err) + } + res.Lines = append(res.Lines, line) + } + + return res, nil + }, + commonhttp.JSONResponseEncoderWithStatus[CreateLineByCustomerResponse](http.StatusCreated), + httptransport.AppendOptions( + h.options, + httptransport.WithOperationName("billingCreateLineByCustomer"), + httptransport.WithErrorEncoder(errorEncoder()), + )..., + ) +} + +func mapCreateLineToEntity(line api.BillingInvoiceLineCreateItem, ns string) (billingentity.Line, error) { + // This should not fail, and we would have at least the discriminator unmarshaled + manualFee, err := line.AsBillingManualFeeLineCreateItem() + if err != nil { + return billingentity.Line{}, fmt.Errorf("failed to map manual fee line: %w", err) + } + + switch string(manualFee.Type) { + case string(api.BillingManualFeeLineTypeManualFee): + return mapCreateManualFeeLineToEntity(manualFee, ns) + default: + return billingentity.Line{}, fmt.Errorf("unsupported type: %s", manualFee.Type) + } +} + +func mapCreateManualFeeLineToEntity(line api.BillingManualFeeLineCreateItem, ns string) (billingentity.Line, error) { + qty, err := alpacadecimal.NewFromString(line.Quantity) + if err != nil { + return billingentity.Line{}, fmt.Errorf("failed to map quantity: %w", err) + } + + price, err := alpacadecimal.NewFromString(line.Price) + if err != nil { + return billingentity.Line{}, fmt.Errorf("failed to parse price: %w", err) + } + + invoiceId := "" + if line.Invoice != nil { + invoiceId = line.Invoice.Id + } + + return billingentity.Line{ + LineBase: billingentity.LineBase{ + Namespace: ns, + + Metadata: lo.FromPtrOr(line.Metadata, map[string]string{}), + Name: line.Name, + Type: billingentity.InvoiceLineTypeManualFee, + Description: line.Description, + + InvoiceID: invoiceId, + Status: billingentity.InvoiceLineStatusValid, // This is not settable from outside + Currency: currencyx.Code(line.Currency), + Period: billingentity.Period{ + Start: line.Period.Start, + End: line.Period.End, + }, + + InvoiceAt: line.InvoiceAt, + TaxOverrides: mapTaxConfigToEntity(line.TaxOverrides), + }, + ManualFee: &billingentity.ManualFeeLine{ + Price: price, + Quantity: qty, + }, + }, nil +} + +func mapTaxConfigToEntity(tc *api.TaxConfig) *billingentity.TaxOverrides { + if tc == nil { + return nil + } + + out := &billingentity.TaxOverrides{} + + if tc.Stripe != nil && tc.Stripe.Code != "" { + out.Stripe = &billingentity.StripeTaxOverride{ + TaxCode: billingentity.StripeTaxCode(tc.Stripe.Code), + } + } + + return out +} + +func mapTaxOverridesToAPI(to *billingentity.TaxOverrides) *api.TaxConfig { + if to == nil { + return nil + } + + out := &api.TaxConfig{} + + if to.Stripe != nil { + out.Stripe = &api.StripeTaxConfig{ + Code: string(to.Stripe.TaxCode), + } + } + + return out +} + +func mapBillingLineToAPI(line billingentity.Line) (api.BillingInvoiceLine, error) { + switch line.Type { + case billingentity.InvoiceLineTypeManualFee: + return mapManualFeeLineToAPI(line) + default: + return api.BillingInvoiceLine{}, fmt.Errorf("unsupported type: %s", line.Type) + } +} + +func mapManualFeeLineToAPI(line billingentity.Line) (api.BillingInvoiceLine, error) { + if line.ManualFee == nil { + return api.BillingInvoiceLine{}, fmt.Errorf("manual fee line is nil") + } + + feeLine := api.BillingManualFeeLine{ + Type: api.BillingManualFeeLineTypeManualFee, + Id: line.ID, + + CreatedAt: line.CreatedAt, + DeletedAt: line.DeletedAt, + UpdatedAt: line.UpdatedAt, + InvoiceAt: line.InvoiceAt, + + Currency: string(line.Currency), + + Description: line.Description, + Name: line.Name, + + Invoice: &api.BillingInvoiceReference{ + Id: line.InvoiceID, + }, + + Metadata: lo.EmptyableToPtr(line.Metadata), + Period: api.BillingPeriod{ + Start: line.Period.Start, + End: line.Period.End, + }, + + Price: line.ManualFee.Price.String(), + Quantity: line.ManualFee.Quantity.String(), + TaxOverrides: mapTaxOverridesToAPI(line.TaxOverrides), + } + + out := api.BillingInvoiceLine{} + err := out.FromBillingManualFeeLine(feeLine) + if err != nil { + return api.BillingInvoiceLine{}, fmt.Errorf("failed to map manual fee line: %w", err) + } + + return out, nil +} diff --git a/openmeter/billing/httpdriver/profile.go b/openmeter/billing/httpdriver/profile.go index db2ca45fb..57c2aee4e 100644 --- a/openmeter/billing/httpdriver/profile.go +++ b/openmeter/billing/httpdriver/profile.go @@ -5,6 +5,7 @@ import ( "errors" "fmt" "net/http" + "slices" "github.com/oklog/ulid/v2" "github.com/samber/lo" @@ -81,22 +82,29 @@ func (h *handler) CreateProfile() CreateProfileHandler { } type ( + GetProfileParams struct { + ID string + Expand []api.BillingProfileExpand + } GetProfileRequest = billing.GetProfileInput GetProfileResponse = api.BillingProfile - GetProfileHandler httptransport.HandlerWithArgs[GetProfileRequest, GetProfileResponse, string] + GetProfileHandler httptransport.HandlerWithArgs[GetProfileRequest, GetProfileResponse, GetProfileParams] ) func (h *handler) GetProfile() GetProfileHandler { return httptransport.NewHandlerWithArgs( - func(ctx context.Context, r *http.Request, id string) (GetProfileRequest, error) { + func(ctx context.Context, r *http.Request, params GetProfileParams) (GetProfileRequest, error) { ns, err := h.resolveNamespace(ctx) if err != nil { return GetProfileRequest{}, fmt.Errorf("failed to resolve namespace: %w", err) } return GetProfileRequest{ - Namespace: ns, - ID: id, + Profile: models.NamespacedID{ + Namespace: ns, + ID: params.ID, + }, + Expand: mapProfileExpandToEntity(params.Expand), }, nil }, func(ctx context.Context, request GetProfileRequest) (GetProfileResponse, error) { @@ -263,7 +271,7 @@ func (h *handler) ListProfiles() ListProfilesHandler { commonhttp.JSONResponseEncoderWithStatus[ListProfilesResponse](http.StatusOK), httptransport.AppendOptions( h.options, - httptransport.WithOperationName("billingArchiveProfile"), + httptransport.WithOperationName("billingListProfile"), httptransport.WithErrorEncoder(errorEncoder()), )..., ) @@ -299,7 +307,7 @@ func apiBillingPartyCreateToSupplierContact(c api.BillingPartyCreate) billingent func apiBillingPartyToSupplierContact(c api.BillingParty) billingentity.SupplierContact { out := billingentity.SupplierContact{ - ID: c.Id, + ID: lo.FromPtrOr(c.Id, ""), Name: lo.FromPtrOr(c.Name, ""), } @@ -424,37 +432,111 @@ func MapProfileToApi(p *billingentity.Profile) (api.BillingProfile, error) { Default: p.Default, Name: p.Name, - Supplier: MapSupplierContactToAPI(p.Supplier), - Workflow: MapWorkflowConfigToAPI(p.WorkflowConfig), + Supplier: mapSupplierContactToAPI(p.Supplier), + Workflow: mapWorkflowConfigToAPI(p.WorkflowConfig), } if p.Apps != nil { - tax, err := appshttpdriver.MapAppToAPI(p.Apps.Tax) + apps, err := mapProfileAppsToAPI(p.Apps) if err != nil { - return api.BillingProfile{}, fmt.Errorf("cannot map tax app: %w", err) + return api.BillingProfile{}, fmt.Errorf("failed to map profile apps: %w", err) } - invoicing, err := appshttpdriver.MapAppToAPI(p.Apps.Invoicing) - if err != nil { - return api.BillingProfile{}, fmt.Errorf("cannot map invoicing app: %w", err) + if apps != nil { + out.Apps = *apps } - - payment, err := appshttpdriver.MapAppToAPI(p.Apps.Payment) + } else { + apps, err := mapProfileAppReferencesToAPI(p.AppReferences) if err != nil { - return api.BillingProfile{}, fmt.Errorf("cannot map payment app: %w", err) + return api.BillingProfile{}, fmt.Errorf("failed to map profile app references: %w", err) } - out.Apps = api.BillingProfileApps{ - Tax: tax, - Invoicing: invoicing, - Payment: payment, + if apps != nil { + out.Apps = *apps } } return out, nil } -func MapSupplierContactToAPI(c billingentity.SupplierContact) api.BillingParty { +func mapProfileAppsToAPI(a *billingentity.ProfileApps) (*api.BillingProfileAppsOrReference, error) { + if a == nil { + return nil, nil + } + + tax, err := appshttpdriver.MapAppToAPI(a.Tax) + if err != nil { + return nil, fmt.Errorf("cannot map tax app: %w", err) + } + + invoicing, err := appshttpdriver.MapAppToAPI(a.Invoicing) + if err != nil { + return nil, fmt.Errorf("cannot map invoicing app: %w", err) + } + + payment, err := appshttpdriver.MapAppToAPI(a.Payment) + if err != nil { + return nil, fmt.Errorf("cannot map payment app: %w", err) + } + + apps := api.BillingProfileApps{ + Tax: tax, + Invoicing: invoicing, + Payment: payment, + } + + out := api.BillingProfileAppsOrReference{} + + if err := out.FromBillingProfileApps(apps); err != nil { + return nil, fmt.Errorf("failed to convert apps to API: %w", err) + } + + return &out, nil +} + +func mapProfileAppReferencesToAPI(a *billingentity.ProfileAppReferences) (*api.BillingProfileAppsOrReference, error) { + if a == nil { + return nil, nil + } + + apps := api.BillingProfileAppReferences{ + Tax: api.AppReference{ + Id: a.Tax.ID, + }, + Invoicing: api.AppReference{ + Id: a.Invoicing.ID, + }, + Payment: api.AppReference{ + Id: a.Payment.ID, + }, + } + + out := api.BillingProfileAppsOrReference{} + + if err := out.FromBillingProfileAppReferences(apps); err != nil { + return nil, fmt.Errorf("failed to convert apps to API: %w", err) + } + + return &out, nil +} + +func mapProfileExpandToEntity(expand []api.BillingProfileExpand) billing.ProfileExpand { + if len(expand) == 0 { + return billing.ProfileExpand{} + } + + if slices.Contains(expand, api.BillingProfileExpandAll) { + return billing.ProfileExpand{ + Apps: true, + } + } + + return billing.ProfileExpand{ + Apps: slices.Contains(expand, api.BillingProfileExpandApps), + } +} + +func mapSupplierContactToAPI(c billingentity.SupplierContact) api.BillingParty { a := c.Address out := api.BillingParty{ @@ -481,7 +563,7 @@ func MapSupplierContactToAPI(c billingentity.SupplierContact) api.BillingParty { return out } -func MapWorkflowConfigToAPI(c billingentity.WorkflowConfig) api.BillingWorkflow { +func mapWorkflowConfigToAPI(c billingentity.WorkflowConfig) api.BillingWorkflow { return api.BillingWorkflow{ Id: c.ID, CreatedAt: c.CreatedAt, @@ -504,3 +586,22 @@ func MapWorkflowConfigToAPI(c billingentity.WorkflowConfig) api.BillingWorkflow }, } } + +func mapWorkflowConfigSettingsToAPI(c billingentity.WorkflowConfig) api.BillingWorkflowSettings { + return api.BillingWorkflowSettings{ + Collection: &api.BillingWorkflowCollectionSettings{ + Alignment: (*api.BillingWorkflowCollectionAlignment)(lo.EmptyableToPtr(c.Collection.Alignment)), + Interval: lo.EmptyableToPtr(c.Collection.Interval.String()), + }, + + Invoicing: &api.BillingWorkflowInvoicingSettings{ + AutoAdvance: c.Invoicing.AutoAdvance, + DraftPeriod: lo.EmptyableToPtr(c.Invoicing.DraftPeriod.String()), + DueAfter: lo.EmptyableToPtr(c.Invoicing.DueAfter.String()), + }, + + Payment: &api.BillingWorkflowPaymentSettings{ + CollectionMethod: (*api.BillingWorkflowCollectionMethod)(lo.EmptyableToPtr(string(c.Payment.CollectionMethod))), + }, + } +} diff --git a/openmeter/billing/invoice.go b/openmeter/billing/invoice.go new file mode 100644 index 000000000..f2ad5a21b --- /dev/null +++ b/openmeter/billing/invoice.go @@ -0,0 +1,133 @@ +package billing + +import ( + "errors" + "fmt" + "time" + + "github.com/openmeterio/openmeter/api" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/pagination" + "github.com/openmeterio/openmeter/pkg/sortx" +) + +type InvoiceExpand struct { + Lines bool + Preceding bool + Workflow bool + WorkflowApps bool +} + +var InvoiceExpandAll = InvoiceExpand{ + Lines: true, + Preceding: true, + Workflow: true, + WorkflowApps: true, +} + +func (e InvoiceExpand) Validate() error { + if !e.Workflow && e.WorkflowApps { + return errors.New("workflow.apps can only be expanded when workflow is expanded") + } + + return nil +} + +type GetInvoiceByIdInput struct { + Invoice models.NamespacedID + Expand InvoiceExpand +} + +func (i GetInvoiceByIdInput) Validate() error { + if err := i.Invoice.Validate(); err != nil { + return fmt.Errorf("id: %w", err) + } + + if err := i.Expand.Validate(); err != nil { + return fmt.Errorf("expand: %w", err) + } + + return nil +} + +type ListInvoicesInput struct { + pagination.Page + + Namespace string + Customers []string + Statuses []billingentity.InvoiceStatus + Currencies []currencyx.Code + + IssuedAfter *time.Time + IssuedBefore *time.Time + + Expand InvoiceExpand + + OrderBy api.BillingInvoiceOrderBy + Order sortx.Order +} + +func (i ListInvoicesInput) Validate() error { + if i.Namespace == "" { + return errors.New("namespace is required") + } + + if i.IssuedAfter != nil && i.IssuedBefore != nil && i.IssuedAfter.After(*i.IssuedBefore) { + return errors.New("issuedAfter must be before issuedBefore") + } + + if err := i.Expand.Validate(); err != nil { + return fmt.Errorf("expand: %w", err) + } + + return nil +} + +type ListInvoicesResponse = pagination.PagedResponse[billingentity.Invoice] + +type CreateInvoiceAdapterInput struct { + Namespace string + Customer customerentity.Customer + Profile billingentity.Profile + Currency currencyx.Code + Status billingentity.InvoiceStatus + Metadata map[string]string + IssuedAt time.Time + + Type billingentity.InvoiceType + Description *string + DueAt *time.Time +} + +func (c CreateInvoiceAdapterInput) Validate() error { + if c.Namespace == "" { + return errors.New("namespace is required") + } + + if err := c.Customer.Validate(); err != nil { + return fmt.Errorf("customer: %w", err) + } + + if err := c.Profile.Validate(); err != nil { + return fmt.Errorf("profile: %w", err) + } + + if err := c.Currency.Validate(); err != nil { + return fmt.Errorf("currency: %w", err) + } + + if err := c.Status.Validate(); err != nil { + return fmt.Errorf("status: %w", err) + } + + if err := c.Type.Validate(); err != nil { + return fmt.Errorf("type: %w", err) + } + + return nil +} + +type CreateInvoiceAdapterRespone = billingentity.Invoice diff --git a/openmeter/billing/invoiceitem.go b/openmeter/billing/invoiceitem.go deleted file mode 100644 index 52b79b2a9..000000000 --- a/openmeter/billing/invoiceitem.go +++ /dev/null @@ -1,28 +0,0 @@ -package billing - -import ( - "errors" - "fmt" - - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" -) - -type CreateInvoiceItemsInput struct { - InvoiceID *string - Namespace string - Items []billingentity.InvoiceItem -} - -func (c CreateInvoiceItemsInput) Validate() error { - if c.Namespace == "" { - return errors.New("namespace is required") - } - - for idx, item := range c.Items { - if err := item.Validate(); err != nil { - return fmt.Errorf("item[%d]: %w", idx, err) - } - } - - return nil -} diff --git a/openmeter/billing/invoiceline.go b/openmeter/billing/invoiceline.go new file mode 100644 index 000000000..1529a527c --- /dev/null +++ b/openmeter/billing/invoiceline.go @@ -0,0 +1,59 @@ +package billing + +import ( + "errors" + "fmt" + + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" +) + +type CreateInvoiceLinesInput struct { + CustomerKeyOrID string + Namespace string + Lines []billingentity.Line +} + +func (c CreateInvoiceLinesInput) Validate() error { + if c.Namespace == "" { + return errors.New("namespace is required") + } + + if c.CustomerKeyOrID == "" { + return errors.New("customer key or ID is required") + } + + for _, line := range c.Lines { + if err := line.Validate(); err != nil { + return fmt.Errorf("Line: %w", err) + } + } + + return nil +} + +type CreateInvoiceLinesAdapterInput struct { + Namespace string + Lines []billingentity.Line +} + +func (c CreateInvoiceLinesAdapterInput) Validate() error { + if c.Namespace == "" { + return errors.New("namespace is required") + } + + for i, line := range c.Lines { + if err := line.Validate(); err != nil { + return fmt.Errorf("Line[%d]: %w", i, err) + } + + if line.InvoiceID == "" { + return fmt.Errorf("Line[%d]: invoice id is required", i) + } + } + + return nil +} + +type CreateInvoiceLinesResponse struct { + Lines []billingentity.Line +} diff --git a/openmeter/billing/profile.go b/openmeter/billing/profile.go index b6a14a22b..60f52189a 100644 --- a/openmeter/billing/profile.go +++ b/openmeter/billing/profile.go @@ -8,6 +8,7 @@ import ( "github.com/openmeterio/openmeter/api" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/pkg/models" "github.com/openmeterio/openmeter/pkg/pagination" "github.com/openmeterio/openmeter/pkg/sortx" ) @@ -19,7 +20,7 @@ type CreateWorkflowConfigInput struct { type CreateProfileInput struct { Namespace string `json:"namespace"` Name string `json:"name"` - Description *string `json:"description"` + Description *string `json:"description,omitempty"` Metadata map[string]string `json:"metadata"` Supplier billingentity.SupplierContact `json:"supplier"` Default bool `json:"default"` @@ -90,6 +91,8 @@ type ListProfilesResult = pagination.PagedResponse[billingentity.Profile] type ListProfilesInput struct { pagination.Page + Expand ProfileExpand + Namespace string IncludeArchived bool OrderBy api.BillingProfileOrderBy @@ -105,6 +108,22 @@ func (i ListProfilesInput) Validate() error { return fmt.Errorf("error validating page: %w", err) } + if err := i.Expand.Validate(); err != nil { + return fmt.Errorf("error validating expand: %w", err) + } + + return nil +} + +type ProfileExpand struct { + Apps bool +} + +var ProfileExpandAll = ProfileExpand{ + Apps: true, +} + +func (e ProfileExpand) Validate() error { return nil } @@ -137,10 +156,21 @@ func (i genericNamespaceID) Validate() error { return nil } -type GetProfileInput genericNamespaceID +type GetProfileInput struct { + Profile models.NamespacedID + Expand ProfileExpand +} func (i GetProfileInput) Validate() error { - return genericNamespaceID(i).Validate() + if i.Profile.Namespace == "" { + return errors.New("namespace is required") + } + + if i.Profile.ID == "" { + return errors.New("id is required") + } + + return nil } type DeleteProfileInput genericNamespaceID diff --git a/openmeter/billing/service.go b/openmeter/billing/service.go index ab72a24f2..55994ec35 100644 --- a/openmeter/billing/service.go +++ b/openmeter/billing/service.go @@ -4,13 +4,12 @@ import ( "context" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" ) type Service interface { ProfileService CustomerOverrideService - InvoiceItemService + InvoiceLineService InvoiceService } @@ -32,14 +31,10 @@ type CustomerOverrideService interface { GetProfileWithCustomerOverride(ctx context.Context, input GetProfileWithCustomerOverrideInput) (*billingentity.ProfileWithCustomerDetails, error) } -type InvoiceItemService interface { - CreateInvoiceItems(ctx context.Context, input CreateInvoiceItemsInput) ([]billingentity.InvoiceItem, error) +type InvoiceLineService interface { + CreateInvoiceLines(ctx context.Context, input CreateInvoiceLinesInput) (*CreateInvoiceLinesResponse, error) } type InvoiceService interface { - // GetPendingInvoiceItems returns all pending invoice items for a customer - // The call can return any number of invoices based on multiple factors: - // - The customer has multiple currencies (e.g. USD and EUR) - // - [later] The provider can also mandate separate invoices if needed - GetPendingInvoiceItems(ctx context.Context, customerID customerentity.CustomerID) ([]billingentity.InvoiceWithValidation, error) + ListInvoices(ctx context.Context, input ListInvoicesInput) (ListInvoicesResponse, error) } diff --git a/openmeter/billing/service/customeroverride.go b/openmeter/billing/service/customeroverride.go index c2b2013fd..6073b23bf 100644 --- a/openmeter/billing/service/customeroverride.go +++ b/openmeter/billing/service/customeroverride.go @@ -20,8 +20,10 @@ func (s *Service) CreateCustomerOverride(ctx context.Context, input billing.Crea adapterOverride, err := entutils.TransactingRepo(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) (*billingentity.CustomerOverride, error) { existingOverride, err := txAdapter.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, IncludeDeleted: true, }) @@ -84,8 +86,10 @@ func (s *Service) UpdateCustomerOverride(ctx context.Context, input billing.Upda return entutils.TransactingRepo(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) (*billingentity.CustomerOverride, error) { existingOverride, err := txAdapter.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, }) if err != nil { return nil, err @@ -124,8 +128,10 @@ func (s *Service) GetCustomerOverride(ctx context.Context, input billing.GetCust } adapterOverride, err := s.adapter.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, IncludeDeleted: false, }) @@ -153,8 +159,10 @@ func (s *Service) DeleteCustomerOverride(ctx context.Context, input billing.Dele return entutils.TransactingRepoWithNoValue(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) error { existingOverride, err := txAdapter.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, IncludeDeleted: true, }) @@ -227,8 +235,10 @@ func (s *Service) getProfileWithCustomerOverride(ctx context.Context, adapter bi // This function does not perform validations or customer entity overrides. func (s *Service) getProfileWithCustomerOverrideMerges(ctx context.Context, adapter billing.Adapter, input billing.GetProfileWithCustomerOverrideInput) (*billingentity.Profile, error) { adapterOverride, err := adapter.GetCustomerOverride(ctx, billing.GetCustomerOverrideAdapterInput{ - Namespace: input.Namespace, - CustomerID: input.CustomerID, + Customer: customerentity.CustomerID{ + Namespace: input.Namespace, + ID: input.CustomerID, + }, }) if err != nil { return nil, err @@ -255,7 +265,7 @@ func (s *Service) getProfileWithCustomerOverrideMerges(ctx context.Context, adap } } - return s.resolveBaseProfile(ctx, defaultProfile) + return s.resolveProfileApps(ctx, defaultProfile) } // We have an active override, let's see what's the baseline profile @@ -269,7 +279,7 @@ func (s *Service) getProfileWithCustomerOverrideMerges(ctx context.Context, adap return nil, err } - baselineProfile, err = s.resolveBaseProfile(ctx, defaultBaseProfile) + baselineProfile, err = s.resolveProfileApps(ctx, defaultBaseProfile) if err != nil { return nil, err } @@ -302,7 +312,7 @@ func (s *Service) resolveCustomerOverride(ctx context.Context, input *billingent out := *input if input.Profile != nil { - profile, err := s.resolveBaseProfile(ctx, &input.Profile.BaseProfile) + profile, err := s.resolveProfileApps(ctx, &input.Profile.BaseProfile) if err != nil { return nil, err } diff --git a/openmeter/billing/service/invoice.go b/openmeter/billing/service/invoice.go index 3d042b074..05437671d 100644 --- a/openmeter/billing/service/invoice.go +++ b/openmeter/billing/service/invoice.go @@ -2,107 +2,38 @@ package billingservice import ( "context" - "time" - - "github.com/invopop/validation" - "github.com/samber/lo" + "fmt" "github.com/openmeterio/openmeter/openmeter/billing" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" - "github.com/openmeterio/openmeter/pkg/currencyx" - "github.com/openmeterio/openmeter/pkg/framework/transaction" + "github.com/openmeterio/openmeter/pkg/framework/entutils" ) var _ billing.InvoiceService = (*Service)(nil) -func (s *Service) GetPendingInvoiceItems(ctx context.Context, customerID customerentity.CustomerID) ([]billingentity.InvoiceWithValidation, error) { - customerEntity, err := s.customerService.GetCustomer(ctx, customerentity.GetCustomerInput(customerID)) - if err != nil { - if err, ok := lo.ErrorsAs[customerentity.NotFoundError](err); ok { - return nil, billing.ValidationError{ - Err: err, - } - } - - return nil, err - } - - return transaction.Run(ctx, s.adapter, func(ctx context.Context) ([]billingentity.InvoiceWithValidation, error) { - validationErrors := []error{} - - billingProfile, err := s.getProfileWithCustomerOverride(ctx, s.adapter, billing.GetProfileWithCustomerOverrideInput{ - Namespace: customerEntity.Namespace, - CustomerID: customerEntity.ID, - }) +func (s *Service) ListInvoices(ctx context.Context, input billing.ListInvoicesInput) (billing.ListInvoicesResponse, error) { + return entutils.TransactingRepo(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) (billing.ListInvoicesResponse, error) { + invoices, err := s.adapter.ListInvoices(ctx, input) if err != nil { - // If the customer has no billing profile, we can't create an invoice, but for pending items we can - // report the error and the pending items, so that the caller can decide what to do - - if err, ok := lo.ErrorsAs[validation.Error](err); !ok { - return nil, err - } - - validationErrors = append(validationErrors, err) - } - - pendingItems, err := s.adapter.GetPendingInvoiceItems(ctx, customerID) - if err != nil { - // If we cannot get the pending items, we can bail here, as the caller can't do anything - return nil, err + return billing.ListInvoicesResponse{}, err } - // We don't support multi-currency invoices (as that would require up-to-date exchange rates etc.), so - // let's split the pending invoice items into per currency invoices - - byCurrency := splitInvoicesByCurrency(pendingItems) - - res := make([]billingentity.InvoiceWithValidation, 0, len(byCurrency)) - - for currency, items := range byCurrency { - res = append(res, billingentity.InvoiceWithValidation{ - Invoice: &billingentity.Invoice{ - Namespace: customerEntity.Namespace, - InvoiceNumber: billingentity.InvoiceNumber{ - Series: "INV", - Code: "DRAFT", - }, - Status: billingentity.InvoiceStatusPendingCreation, - Items: items, - Type: billingentity.InvoiceTypeStandard, - - // TODO[OM-931]: Timezone - - // TODO: Period is not captured here, but it should be fine - Currency: currency, - CreatedAt: time.Now(), - UpdatedAt: time.Now(), - - Profile: billingProfile.Profile, - Customer: billingentity.InvoiceCustomer(billingProfile.Customer), - }, - ValidationErrors: validationErrors, - }, - ) + if input.Expand.WorkflowApps { + for i := range invoices.Items { + invoice := &invoices.Items[i] + resolvedApps, err := s.resolveApps(ctx, input.Namespace, invoice.Workflow.AppReferences) + if err != nil { + return billing.ListInvoicesResponse{}, fmt.Errorf("error resolving apps for invoice [%s]: %w", invoice.ID, err) + } + + invoice.Workflow.Apps = &billingentity.ProfileApps{ + Tax: resolvedApps.Tax.App, + Invoicing: resolvedApps.Invoicing.App, + Payment: resolvedApps.Payment.App, + } + } } - return res, nil + return invoices, nil }) } - -func splitInvoicesByCurrency(items []billingentity.InvoiceItem) map[currencyx.Code][]billingentity.InvoiceItem { - byCurrency := make(map[currencyx.Code][]billingentity.InvoiceItem) - - if len(items) == 0 { - return byCurrency - } - - // Optimization: pre-allocate the first currency, assuming that there will be not more than one currency - byCurrency[items[0].Currency] = make([]billingentity.InvoiceItem, 0, len(items)) - - for _, item := range items { - byCurrency[item.Currency] = append(byCurrency[item.Currency], item) - } - - return byCurrency -} diff --git a/openmeter/billing/service/invoiceitem.go b/openmeter/billing/service/invoiceitem.go deleted file mode 100644 index edfc8d0e8..000000000 --- a/openmeter/billing/service/invoiceitem.go +++ /dev/null @@ -1,23 +0,0 @@ -package billingservice - -import ( - "context" - - "github.com/openmeterio/openmeter/openmeter/billing" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/pkg/framework/transaction" -) - -var _ billing.InvoiceItemService = (*Service)(nil) - -func (s *Service) CreateInvoiceItems(ctx context.Context, input billing.CreateInvoiceItemsInput) ([]billingentity.InvoiceItem, error) { - if err := input.Validate(); err != nil { - return nil, billing.ValidationError{ - Err: err, - } - } - - return transaction.Run(ctx, s.adapter, func(ctx context.Context) ([]billingentity.InvoiceItem, error) { - return s.adapter.CreateInvoiceItems(ctx, input) - }) -} diff --git a/openmeter/billing/service/invoiceline.go b/openmeter/billing/service/invoiceline.go new file mode 100644 index 000000000..7f604d772 --- /dev/null +++ b/openmeter/billing/service/invoiceline.go @@ -0,0 +1,138 @@ +package billingservice + +import ( + "context" + "fmt" + + "github.com/openmeterio/openmeter/api" + "github.com/openmeterio/openmeter/openmeter/billing" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/framework/entutils" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/pagination" + "github.com/openmeterio/openmeter/pkg/sortx" +) + +var _ billing.InvoiceLineService = (*Service)(nil) + +func (s *Service) CreateInvoiceLines(ctx context.Context, input billing.CreateInvoiceLinesInput) (*billing.CreateInvoiceLinesResponse, error) { + if err := input.Validate(); err != nil { + return nil, billing.ValidationError{ + Err: err, + } + } + + return entutils.TransactingRepo(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) (*billing.CreateInvoiceLinesResponse, error) { + // let's resolve the customer's settings + customerProfile, err := s.GetProfileWithCustomerOverride(ctx, billing.GetProfileWithCustomerOverrideInput{ + Namespace: input.Namespace, + CustomerID: input.CustomerKeyOrID, + }) + if err != nil { + return nil, fmt.Errorf("fetching customer profile: %w", err) + } + + for i, line := range input.Lines { + updatedLine, err := s.upsertLineInvoice(ctx, txAdapter, line, input, customerProfile) + if err != nil { + return nil, fmt.Errorf("upserting line[%d]: %w", i, err) + } + + input.Lines[i] = updatedLine + } + + // Create the invoice Lines + lines, err := txAdapter.CreateInvoiceLines(ctx, billing.CreateInvoiceLinesAdapterInput{ + Namespace: input.Namespace, + Lines: input.Lines, + }) + if err != nil { + return nil, fmt.Errorf("creating invoice Line: %w", err) + } + + return lines, nil + }) +} + +func (s *Service) upsertLineInvoice(ctx context.Context, txAdapter billing.Adapter, line billingentity.Line, input billing.CreateInvoiceLinesInput, customerProfile *billingentity.ProfileWithCustomerDetails) (billingentity.Line, error) { + // Let's set the default values for the line item + line.Status = billingentity.InvoiceLineStatusValid + + if line.InvoiceID != "" { + // We would want to attach the line to an existing invoice + invoice, err := txAdapter.GetInvoiceById(ctx, billing.GetInvoiceByIdInput{ + Invoice: models.NamespacedID{ + ID: line.InvoiceID, + Namespace: input.Namespace, + }, + }) + if err != nil { + return line, billing.ValidationError{ + Err: fmt.Errorf("fetching invoice [%s]: %w", line.InvoiceID, err), + } + } + + if !invoice.Status.IsMutable() { + return line, billing.ValidationError{ + Err: fmt.Errorf("invoice [%s] is not mutable", line.InvoiceID), + } + } + + if invoice.Currency != line.Currency { + return line, billing.ValidationError{ + Err: fmt.Errorf("currency mismatch: invoice [%s] currency is %s, but line currency is %s", line.InvoiceID, invoice.Currency, line.Currency), + } + } + + line.InvoiceID = invoice.ID + return line, nil + } + + // We would want to stage a pending invoice Line + pendingInvoiceList, err := txAdapter.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, + Customers: []string{input.CustomerKeyOrID}, + Namespace: input.Namespace, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{line.Currency}, + OrderBy: api.BillingInvoiceOrderByCreatedAt, + Order: sortx.OrderAsc, + }) + if err != nil { + return line, fmt.Errorf("fetching gathering invoices: %w", err) + } + + if len(pendingInvoiceList.Items) == 0 { + // Create a new invoice + invoice, err := txAdapter.CreateInvoice(ctx, billing.CreateInvoiceAdapterInput{ + Namespace: input.Namespace, + Customer: customerProfile.Customer, + Profile: customerProfile.Profile, + Currency: line.Currency, + Status: billingentity.InvoiceStatusGathering, + Type: billingentity.InvoiceTypeStandard, + }) + if err != nil { + return line, fmt.Errorf("creating invoice: %w", err) + } + + line.InvoiceID = invoice.ID + } else { + // Attach to the first pending invoice + line.InvoiceID = pendingInvoiceList.Items[0].ID + + if len(pendingInvoiceList.Items) > 1 { + // Note: Given that we are not using serializable transactions (which is fine), we might + // have multiple gathering invoices for the same customer. + // This is a rare case, but we should log it at least, later we can implement a call that + // merges these invoices (it's fine to just move the Lines to the first invoice) + s.logger.Warn("more than one pending invoice found", "customer", input.CustomerKeyOrID, "namespace", input.Namespace) + } + } + + return line, nil +} diff --git a/openmeter/billing/service/profile.go b/openmeter/billing/service/profile.go index 380d7b913..87ede35d5 100644 --- a/openmeter/billing/service/profile.go +++ b/openmeter/billing/service/profile.go @@ -12,6 +12,7 @@ import ( billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" "github.com/openmeterio/openmeter/pkg/framework/entutils" + "github.com/openmeterio/openmeter/pkg/models" "github.com/openmeterio/openmeter/pkg/pagination" ) @@ -43,32 +44,15 @@ func (s *Service) CreateProfile(ctx context.Context, input billing.CreateProfile } } - // let's resolve the applications - taxApp, err := s.validateAppReference(ctx, input.Namespace, input.Apps.Tax, appentitybase.CapabilityTypeCalculateTax) + resolvedApps, err := s.resolveApps(ctx, input.Namespace, input.Apps) if err != nil { - return nil, billing.ValidationError{ - Err: fmt.Errorf("error resolving tax app: %w", err), - } - } - - invocingApp, err := s.validateAppReference(ctx, input.Namespace, input.Apps.Invoicing, appentitybase.CapabilityTypeInvoiceCustomers) - if err != nil { - return nil, billing.ValidationError{ - Err: fmt.Errorf("error resolving invocing app: %w", err), - } - } - - paymentsApp, err := s.validateAppReference(ctx, input.Namespace, input.Apps.Payment, appentitybase.CapabilityTypeCollectPayments) - if err != nil { - return nil, billing.ValidationError{ - Err: fmt.Errorf("error resolving payments app: %w", err), - } + return nil, err } - input.Apps = billing.CreateProfileAppsInput{ - Tax: taxApp.Reference, - Invoicing: invocingApp.Reference, - Payment: paymentsApp.Reference, + input.Apps = billingentity.ProfileAppReferences{ + Tax: resolvedApps.Tax.Reference, + Invoicing: resolvedApps.Invoicing.Reference, + Payment: resolvedApps.Payment.Reference, } profile, err := txAdapter.CreateProfile(ctx, input) @@ -82,10 +66,45 @@ func (s *Service) CreateProfile(ctx context.Context, input billing.CreateProfile } } - return s.resolveBaseProfile(ctx, profile) + return s.resolveProfileApps(ctx, profile) }) } +type resolvedApps struct { + Tax *resolvedAppReference + Invoicing *resolvedAppReference + Payment *resolvedAppReference +} + +func (s *Service) resolveApps(ctx context.Context, ns string, apps billingentity.ProfileAppReferences) (*resolvedApps, error) { + taxApp, err := s.validateAppReference(ctx, ns, apps.Tax, appentitybase.CapabilityTypeCalculateTax) + if err != nil { + return nil, billing.ValidationError{ + Err: fmt.Errorf("error resolving tax app: %w", err), + } + } + + invocingApp, err := s.validateAppReference(ctx, ns, apps.Invoicing, appentitybase.CapabilityTypeInvoiceCustomers) + if err != nil { + return nil, billing.ValidationError{ + Err: fmt.Errorf("error resolving invocing app: %w", err), + } + } + + paymentsApp, err := s.validateAppReference(ctx, ns, apps.Payment, appentitybase.CapabilityTypeCollectPayments) + if err != nil { + return nil, billing.ValidationError{ + Err: fmt.Errorf("error resolving payments app: %w", err), + } + } + + return &resolvedApps{ + Tax: taxApp, + Invoicing: invocingApp, + Payment: paymentsApp, + }, nil +} + func (s *Service) validateAppReference(ctx context.Context, ns string, ref billingentity.AppReference, capabilities ...appentitybase.CapabilityType) (*resolvedAppReference, error) { if err := ref.Validate(); err != nil { return nil, fmt.Errorf("invalid app reference: %w", err) @@ -160,7 +179,7 @@ func (s *Service) GetDefaultProfile(ctx context.Context, input billing.GetDefaul return nil, err } - return s.resolveBaseProfile(ctx, profile) + return s.resolveProfileApps(ctx, profile) } func (s *Service) GetProfile(ctx context.Context, input billing.GetProfileInput) (*billingentity.Profile, error) { @@ -175,7 +194,13 @@ func (s *Service) GetProfile(ctx context.Context, input billing.GetProfileInput) return nil, err } - return s.resolveBaseProfile(ctx, profile) + if input.Expand.Apps { + return s.resolveProfileApps(ctx, profile) + } + + return &billingentity.Profile{ + BaseProfile: *profile, + }, nil } func (s *Service) DeleteProfile(ctx context.Context, input billing.DeleteProfileInput) error { @@ -186,7 +211,12 @@ func (s *Service) DeleteProfile(ctx context.Context, input billing.DeleteProfile } return entutils.TransactingRepoWithNoValue(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) error { - profile, err := txAdapter.GetProfile(ctx, billing.GetProfileInput(input)) + profile, err := txAdapter.GetProfile(ctx, billing.GetProfileInput{ + Profile: models.NamespacedID{ + Namespace: input.Namespace, + ID: input.ID, + }, + }) if err != nil { return err } @@ -246,12 +276,18 @@ func (s *Service) ListProfiles(ctx context.Context, input billing.ListProfilesIn } for _, profile := range profiles.Items { - resolvedProfile, err := s.resolveBaseProfile(ctx, &profile) - if err != nil { - return billing.ListProfilesResult{}, fmt.Errorf("error resolving profile: %w", err) + finalProfile := billingentity.Profile{ + BaseProfile: profile, } - response.Items = append(response.Items, *resolvedProfile) + if input.Expand.Apps { + resolvedProfile, err := s.resolveProfileApps(ctx, &profile) + if err != nil { + return billing.ListProfilesResult{}, fmt.Errorf("error resolving profile: %w", err) + } + finalProfile = *resolvedProfile + } + response.Items = append(response.Items, finalProfile) } return response, nil @@ -266,8 +302,10 @@ func (s *Service) UpdateProfile(ctx context.Context, input billing.UpdateProfile return entutils.TransactingRepo(ctx, s.adapter, func(ctx context.Context, txAdapter billing.Adapter) (*billingentity.Profile, error) { profile, err := txAdapter.GetProfile(ctx, billing.GetProfileInput{ - Namespace: input.Namespace, - ID: input.ID, + Profile: models.NamespacedID{ + Namespace: input.Namespace, + ID: input.ID, + }, }) if err != nil { return nil, err @@ -320,11 +358,11 @@ func (s *Service) UpdateProfile(ctx context.Context, input billing.UpdateProfile } } - return s.resolveBaseProfile(ctx, profile) + return s.resolveProfileApps(ctx, profile) }) } -func (s *Service) resolveBaseProfile(ctx context.Context, input *billingentity.BaseProfile) (*billingentity.Profile, error) { +func (s *Service) resolveProfileApps(ctx context.Context, input *billingentity.BaseProfile) (*billingentity.Profile, error) { if input == nil { return nil, nil } diff --git a/openmeter/billing/service/service.go b/openmeter/billing/service/service.go index 412bb10e6..bdf6fa01d 100644 --- a/openmeter/billing/service/service.go +++ b/openmeter/billing/service/service.go @@ -1,11 +1,15 @@ package billingservice import ( + "context" "errors" + "log/slog" "github.com/openmeterio/openmeter/openmeter/app" "github.com/openmeterio/openmeter/openmeter/billing" "github.com/openmeterio/openmeter/openmeter/customer" + "github.com/openmeterio/openmeter/pkg/framework/entutils" + "github.com/openmeterio/openmeter/pkg/framework/transaction" ) var _ billing.Service = (*Service)(nil) @@ -14,12 +18,14 @@ type Service struct { adapter billing.Adapter customerService customer.CustomerService appService app.Service + logger *slog.Logger } type Config struct { Adapter billing.Adapter CustomerService customer.CustomerService AppService app.Service + Logger *slog.Logger } func (c Config) Validate() error { @@ -35,6 +41,10 @@ func (c Config) Validate() error { return errors.New("app service cannot be null") } + if c.Logger == nil { + return errors.New("logger cannot be null") + } + return nil } @@ -47,5 +57,21 @@ func New(config Config) (*Service, error) { adapter: config.Adapter, customerService: config.CustomerService, appService: config.AppService, + logger: config.Logger, }, nil } + +func Transaction[R any](ctx context.Context, creator billing.Adapter, cb func(ctx context.Context, tx billing.Adapter) (R, error)) (R, error) { + return transaction.Run(ctx, creator, func(ctx context.Context) (R, error) { + return entutils.TransactingRepo[R, billing.Adapter](ctx, creator, cb) + }) +} + +func TransactionWithNoValue(ctx context.Context, creator billing.Adapter, cb func(ctx context.Context, tx billing.Adapter) error) error { + return transaction.RunWithNoValue(ctx, creator, func(ctx context.Context) error { + _, err := entutils.TransactingRepo[interface{}, billing.Adapter](ctx, creator, func(ctx context.Context, rep billing.Adapter) (interface{}, error) { + return nil, cb(ctx, rep) + }) + return err + }) +} diff --git a/openmeter/customer/entity/customer.go b/openmeter/customer/entity/customer.go index 0e24ca414..fa5b12765 100644 --- a/openmeter/customer/entity/customer.go +++ b/openmeter/customer/entity/customer.go @@ -24,6 +24,25 @@ type Customer struct { Apps []CustomerApp `json:"apps"` } +func (c Customer) Validate() error { + if c.Timezone != nil { + if err := c.Timezone.Validate(); err != nil { + return ValidationError{ + Err: err, + } + } + } + + if c.Currency != nil { + if err := c.Currency.Validate(); err != nil { + return ValidationError{ + Err: err, + } + } + } + return nil +} + func (c Customer) GetID() CustomerID { return CustomerID{c.Namespace, c.ID} } @@ -117,6 +136,12 @@ func (i CreateCustomerInput) Validate() error { } } + if err := i.Customer.Validate(); err != nil { + return ValidationError{ + Err: err, + } + } + return nil } @@ -140,6 +165,12 @@ func (i UpdateCustomerInput) Validate() error { } } + if err := i.Customer.Validate(); err != nil { + return ValidationError{ + Err: err, + } + } + return nil } diff --git a/openmeter/ent/db/app.go b/openmeter/ent/db/app.go index aa2cca71f..442cbf08e 100644 --- a/openmeter/ent/db/app.go +++ b/openmeter/ent/db/app.go @@ -49,15 +49,21 @@ type App struct { type AppEdges struct { // CustomerApps holds the value of the customer_apps edge. CustomerApps []*AppCustomer `json:"customer_apps,omitempty"` - // TaxApp holds the value of the tax_app edge. - TaxApp []*BillingProfile `json:"tax_app,omitempty"` - // InvoicingApp holds the value of the invoicing_app edge. - InvoicingApp []*BillingProfile `json:"invoicing_app,omitempty"` - // PaymentApp holds the value of the payment_app edge. - PaymentApp []*BillingProfile `json:"payment_app,omitempty"` + // BillingProfileTaxApp holds the value of the billing_profile_tax_app edge. + BillingProfileTaxApp []*BillingProfile `json:"billing_profile_tax_app,omitempty"` + // BillingProfileInvoicingApp holds the value of the billing_profile_invoicing_app edge. + BillingProfileInvoicingApp []*BillingProfile `json:"billing_profile_invoicing_app,omitempty"` + // BillingProfilePaymentApp holds the value of the billing_profile_payment_app edge. + BillingProfilePaymentApp []*BillingProfile `json:"billing_profile_payment_app,omitempty"` + // BillingInvoiceTaxApp holds the value of the billing_invoice_tax_app edge. + BillingInvoiceTaxApp []*BillingInvoice `json:"billing_invoice_tax_app,omitempty"` + // BillingInvoiceInvoicingApp holds the value of the billing_invoice_invoicing_app edge. + BillingInvoiceInvoicingApp []*BillingInvoice `json:"billing_invoice_invoicing_app,omitempty"` + // BillingInvoicePaymentApp holds the value of the billing_invoice_payment_app edge. + BillingInvoicePaymentApp []*BillingInvoice `json:"billing_invoice_payment_app,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [4]bool + loadedTypes [7]bool } // CustomerAppsOrErr returns the CustomerApps value or an error if the edge @@ -69,31 +75,58 @@ func (e AppEdges) CustomerAppsOrErr() ([]*AppCustomer, error) { return nil, &NotLoadedError{edge: "customer_apps"} } -// TaxAppOrErr returns the TaxApp value or an error if the edge +// BillingProfileTaxAppOrErr returns the BillingProfileTaxApp value or an error if the edge // was not loaded in eager-loading. -func (e AppEdges) TaxAppOrErr() ([]*BillingProfile, error) { +func (e AppEdges) BillingProfileTaxAppOrErr() ([]*BillingProfile, error) { if e.loadedTypes[1] { - return e.TaxApp, nil + return e.BillingProfileTaxApp, nil } - return nil, &NotLoadedError{edge: "tax_app"} + return nil, &NotLoadedError{edge: "billing_profile_tax_app"} } -// InvoicingAppOrErr returns the InvoicingApp value or an error if the edge +// BillingProfileInvoicingAppOrErr returns the BillingProfileInvoicingApp value or an error if the edge // was not loaded in eager-loading. -func (e AppEdges) InvoicingAppOrErr() ([]*BillingProfile, error) { +func (e AppEdges) BillingProfileInvoicingAppOrErr() ([]*BillingProfile, error) { if e.loadedTypes[2] { - return e.InvoicingApp, nil + return e.BillingProfileInvoicingApp, nil } - return nil, &NotLoadedError{edge: "invoicing_app"} + return nil, &NotLoadedError{edge: "billing_profile_invoicing_app"} } -// PaymentAppOrErr returns the PaymentApp value or an error if the edge +// BillingProfilePaymentAppOrErr returns the BillingProfilePaymentApp value or an error if the edge // was not loaded in eager-loading. -func (e AppEdges) PaymentAppOrErr() ([]*BillingProfile, error) { +func (e AppEdges) BillingProfilePaymentAppOrErr() ([]*BillingProfile, error) { if e.loadedTypes[3] { - return e.PaymentApp, nil + return e.BillingProfilePaymentApp, nil } - return nil, &NotLoadedError{edge: "payment_app"} + return nil, &NotLoadedError{edge: "billing_profile_payment_app"} +} + +// BillingInvoiceTaxAppOrErr returns the BillingInvoiceTaxApp value or an error if the edge +// was not loaded in eager-loading. +func (e AppEdges) BillingInvoiceTaxAppOrErr() ([]*BillingInvoice, error) { + if e.loadedTypes[4] { + return e.BillingInvoiceTaxApp, nil + } + return nil, &NotLoadedError{edge: "billing_invoice_tax_app"} +} + +// BillingInvoiceInvoicingAppOrErr returns the BillingInvoiceInvoicingApp value or an error if the edge +// was not loaded in eager-loading. +func (e AppEdges) BillingInvoiceInvoicingAppOrErr() ([]*BillingInvoice, error) { + if e.loadedTypes[5] { + return e.BillingInvoiceInvoicingApp, nil + } + return nil, &NotLoadedError{edge: "billing_invoice_invoicing_app"} +} + +// BillingInvoicePaymentAppOrErr returns the BillingInvoicePaymentApp value or an error if the edge +// was not loaded in eager-loading. +func (e AppEdges) BillingInvoicePaymentAppOrErr() ([]*BillingInvoice, error) { + if e.loadedTypes[6] { + return e.BillingInvoicePaymentApp, nil + } + return nil, &NotLoadedError{edge: "billing_invoice_payment_app"} } // scanValues returns the types for scanning values from sql.Rows. @@ -212,19 +245,34 @@ func (a *App) QueryCustomerApps() *AppCustomerQuery { return NewAppClient(a.config).QueryCustomerApps(a) } -// QueryTaxApp queries the "tax_app" edge of the App entity. -func (a *App) QueryTaxApp() *BillingProfileQuery { - return NewAppClient(a.config).QueryTaxApp(a) +// QueryBillingProfileTaxApp queries the "billing_profile_tax_app" edge of the App entity. +func (a *App) QueryBillingProfileTaxApp() *BillingProfileQuery { + return NewAppClient(a.config).QueryBillingProfileTaxApp(a) +} + +// QueryBillingProfileInvoicingApp queries the "billing_profile_invoicing_app" edge of the App entity. +func (a *App) QueryBillingProfileInvoicingApp() *BillingProfileQuery { + return NewAppClient(a.config).QueryBillingProfileInvoicingApp(a) +} + +// QueryBillingProfilePaymentApp queries the "billing_profile_payment_app" edge of the App entity. +func (a *App) QueryBillingProfilePaymentApp() *BillingProfileQuery { + return NewAppClient(a.config).QueryBillingProfilePaymentApp(a) +} + +// QueryBillingInvoiceTaxApp queries the "billing_invoice_tax_app" edge of the App entity. +func (a *App) QueryBillingInvoiceTaxApp() *BillingInvoiceQuery { + return NewAppClient(a.config).QueryBillingInvoiceTaxApp(a) } -// QueryInvoicingApp queries the "invoicing_app" edge of the App entity. -func (a *App) QueryInvoicingApp() *BillingProfileQuery { - return NewAppClient(a.config).QueryInvoicingApp(a) +// QueryBillingInvoiceInvoicingApp queries the "billing_invoice_invoicing_app" edge of the App entity. +func (a *App) QueryBillingInvoiceInvoicingApp() *BillingInvoiceQuery { + return NewAppClient(a.config).QueryBillingInvoiceInvoicingApp(a) } -// QueryPaymentApp queries the "payment_app" edge of the App entity. -func (a *App) QueryPaymentApp() *BillingProfileQuery { - return NewAppClient(a.config).QueryPaymentApp(a) +// QueryBillingInvoicePaymentApp queries the "billing_invoice_payment_app" edge of the App entity. +func (a *App) QueryBillingInvoicePaymentApp() *BillingInvoiceQuery { + return NewAppClient(a.config).QueryBillingInvoicePaymentApp(a) } // Update returns a builder for updating this App. diff --git a/openmeter/ent/db/app/app.go b/openmeter/ent/db/app/app.go index f99bd1996..f5f29c53c 100644 --- a/openmeter/ent/db/app/app.go +++ b/openmeter/ent/db/app/app.go @@ -36,12 +36,18 @@ const ( FieldIsDefault = "is_default" // EdgeCustomerApps holds the string denoting the customer_apps edge name in mutations. EdgeCustomerApps = "customer_apps" - // EdgeTaxApp holds the string denoting the tax_app edge name in mutations. - EdgeTaxApp = "tax_app" - // EdgeInvoicingApp holds the string denoting the invoicing_app edge name in mutations. - EdgeInvoicingApp = "invoicing_app" - // EdgePaymentApp holds the string denoting the payment_app edge name in mutations. - EdgePaymentApp = "payment_app" + // EdgeBillingProfileTaxApp holds the string denoting the billing_profile_tax_app edge name in mutations. + EdgeBillingProfileTaxApp = "billing_profile_tax_app" + // EdgeBillingProfileInvoicingApp holds the string denoting the billing_profile_invoicing_app edge name in mutations. + EdgeBillingProfileInvoicingApp = "billing_profile_invoicing_app" + // EdgeBillingProfilePaymentApp holds the string denoting the billing_profile_payment_app edge name in mutations. + EdgeBillingProfilePaymentApp = "billing_profile_payment_app" + // EdgeBillingInvoiceTaxApp holds the string denoting the billing_invoice_tax_app edge name in mutations. + EdgeBillingInvoiceTaxApp = "billing_invoice_tax_app" + // EdgeBillingInvoiceInvoicingApp holds the string denoting the billing_invoice_invoicing_app edge name in mutations. + EdgeBillingInvoiceInvoicingApp = "billing_invoice_invoicing_app" + // EdgeBillingInvoicePaymentApp holds the string denoting the billing_invoice_payment_app edge name in mutations. + EdgeBillingInvoicePaymentApp = "billing_invoice_payment_app" // Table holds the table name of the app in the database. Table = "apps" // CustomerAppsTable is the table that holds the customer_apps relation/edge. @@ -51,27 +57,48 @@ const ( CustomerAppsInverseTable = "app_customers" // CustomerAppsColumn is the table column denoting the customer_apps relation/edge. CustomerAppsColumn = "app_id" - // TaxAppTable is the table that holds the tax_app relation/edge. - TaxAppTable = "billing_profiles" - // TaxAppInverseTable is the table name for the BillingProfile entity. + // BillingProfileTaxAppTable is the table that holds the billing_profile_tax_app relation/edge. + BillingProfileTaxAppTable = "billing_profiles" + // BillingProfileTaxAppInverseTable is the table name for the BillingProfile entity. // It exists in this package in order to avoid circular dependency with the "billingprofile" package. - TaxAppInverseTable = "billing_profiles" - // TaxAppColumn is the table column denoting the tax_app relation/edge. - TaxAppColumn = "tax_app_id" - // InvoicingAppTable is the table that holds the invoicing_app relation/edge. - InvoicingAppTable = "billing_profiles" - // InvoicingAppInverseTable is the table name for the BillingProfile entity. + BillingProfileTaxAppInverseTable = "billing_profiles" + // BillingProfileTaxAppColumn is the table column denoting the billing_profile_tax_app relation/edge. + BillingProfileTaxAppColumn = "tax_app_id" + // BillingProfileInvoicingAppTable is the table that holds the billing_profile_invoicing_app relation/edge. + BillingProfileInvoicingAppTable = "billing_profiles" + // BillingProfileInvoicingAppInverseTable is the table name for the BillingProfile entity. // It exists in this package in order to avoid circular dependency with the "billingprofile" package. - InvoicingAppInverseTable = "billing_profiles" - // InvoicingAppColumn is the table column denoting the invoicing_app relation/edge. - InvoicingAppColumn = "invoicing_app_id" - // PaymentAppTable is the table that holds the payment_app relation/edge. - PaymentAppTable = "billing_profiles" - // PaymentAppInverseTable is the table name for the BillingProfile entity. + BillingProfileInvoicingAppInverseTable = "billing_profiles" + // BillingProfileInvoicingAppColumn is the table column denoting the billing_profile_invoicing_app relation/edge. + BillingProfileInvoicingAppColumn = "invoicing_app_id" + // BillingProfilePaymentAppTable is the table that holds the billing_profile_payment_app relation/edge. + BillingProfilePaymentAppTable = "billing_profiles" + // BillingProfilePaymentAppInverseTable is the table name for the BillingProfile entity. // It exists in this package in order to avoid circular dependency with the "billingprofile" package. - PaymentAppInverseTable = "billing_profiles" - // PaymentAppColumn is the table column denoting the payment_app relation/edge. - PaymentAppColumn = "payment_app_id" + BillingProfilePaymentAppInverseTable = "billing_profiles" + // BillingProfilePaymentAppColumn is the table column denoting the billing_profile_payment_app relation/edge. + BillingProfilePaymentAppColumn = "payment_app_id" + // BillingInvoiceTaxAppTable is the table that holds the billing_invoice_tax_app relation/edge. + BillingInvoiceTaxAppTable = "billing_invoices" + // BillingInvoiceTaxAppInverseTable is the table name for the BillingInvoice entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. + BillingInvoiceTaxAppInverseTable = "billing_invoices" + // BillingInvoiceTaxAppColumn is the table column denoting the billing_invoice_tax_app relation/edge. + BillingInvoiceTaxAppColumn = "tax_app_id" + // BillingInvoiceInvoicingAppTable is the table that holds the billing_invoice_invoicing_app relation/edge. + BillingInvoiceInvoicingAppTable = "billing_invoices" + // BillingInvoiceInvoicingAppInverseTable is the table name for the BillingInvoice entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. + BillingInvoiceInvoicingAppInverseTable = "billing_invoices" + // BillingInvoiceInvoicingAppColumn is the table column denoting the billing_invoice_invoicing_app relation/edge. + BillingInvoiceInvoicingAppColumn = "invoicing_app_id" + // BillingInvoicePaymentAppTable is the table that holds the billing_invoice_payment_app relation/edge. + BillingInvoicePaymentAppTable = "billing_invoices" + // BillingInvoicePaymentAppInverseTable is the table name for the BillingInvoice entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. + BillingInvoicePaymentAppInverseTable = "billing_invoices" + // BillingInvoicePaymentAppColumn is the table column denoting the billing_invoice_payment_app relation/edge. + BillingInvoicePaymentAppColumn = "payment_app_id" ) // Columns holds all SQL columns for app fields. @@ -181,45 +208,87 @@ func ByCustomerApps(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { } } -// ByTaxAppCount orders the results by tax_app count. -func ByTaxAppCount(opts ...sql.OrderTermOption) OrderOption { +// ByBillingProfileTaxAppCount orders the results by billing_profile_tax_app count. +func ByBillingProfileTaxAppCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborsCount(s, newTaxAppStep(), opts...) + sqlgraph.OrderByNeighborsCount(s, newBillingProfileTaxAppStep(), opts...) } } -// ByTaxApp orders the results by tax_app terms. -func ByTaxApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { +// ByBillingProfileTaxApp orders the results by billing_profile_tax_app terms. +func ByBillingProfileTaxApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newTaxAppStep(), append([]sql.OrderTerm{term}, terms...)...) + sqlgraph.OrderByNeighborTerms(s, newBillingProfileTaxAppStep(), append([]sql.OrderTerm{term}, terms...)...) } } -// ByInvoicingAppCount orders the results by invoicing_app count. -func ByInvoicingAppCount(opts ...sql.OrderTermOption) OrderOption { +// ByBillingProfileInvoicingAppCount orders the results by billing_profile_invoicing_app count. +func ByBillingProfileInvoicingAppCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborsCount(s, newInvoicingAppStep(), opts...) + sqlgraph.OrderByNeighborsCount(s, newBillingProfileInvoicingAppStep(), opts...) } } -// ByInvoicingApp orders the results by invoicing_app terms. -func ByInvoicingApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { +// ByBillingProfileInvoicingApp orders the results by billing_profile_invoicing_app terms. +func ByBillingProfileInvoicingApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newInvoicingAppStep(), append([]sql.OrderTerm{term}, terms...)...) + sqlgraph.OrderByNeighborTerms(s, newBillingProfileInvoicingAppStep(), append([]sql.OrderTerm{term}, terms...)...) } } -// ByPaymentAppCount orders the results by payment_app count. -func ByPaymentAppCount(opts ...sql.OrderTermOption) OrderOption { +// ByBillingProfilePaymentAppCount orders the results by billing_profile_payment_app count. +func ByBillingProfilePaymentAppCount(opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborsCount(s, newPaymentAppStep(), opts...) + sqlgraph.OrderByNeighborsCount(s, newBillingProfilePaymentAppStep(), opts...) } } -// ByPaymentApp orders the results by payment_app terms. -func ByPaymentApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { +// ByBillingProfilePaymentApp orders the results by billing_profile_payment_app terms. +func ByBillingProfilePaymentApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newPaymentAppStep(), append([]sql.OrderTerm{term}, terms...)...) + sqlgraph.OrderByNeighborTerms(s, newBillingProfilePaymentAppStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByBillingInvoiceTaxAppCount orders the results by billing_invoice_tax_app count. +func ByBillingInvoiceTaxAppCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceTaxAppStep(), opts...) + } +} + +// ByBillingInvoiceTaxApp orders the results by billing_invoice_tax_app terms. +func ByBillingInvoiceTaxApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceTaxAppStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByBillingInvoiceInvoicingAppCount orders the results by billing_invoice_invoicing_app count. +func ByBillingInvoiceInvoicingAppCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceInvoicingAppStep(), opts...) + } +} + +// ByBillingInvoiceInvoicingApp orders the results by billing_invoice_invoicing_app terms. +func ByBillingInvoiceInvoicingApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceInvoicingAppStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByBillingInvoicePaymentAppCount orders the results by billing_invoice_payment_app count. +func ByBillingInvoicePaymentAppCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBillingInvoicePaymentAppStep(), opts...) + } +} + +// ByBillingInvoicePaymentApp orders the results by billing_invoice_payment_app terms. +func ByBillingInvoicePaymentApp(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoicePaymentAppStep(), append([]sql.OrderTerm{term}, terms...)...) } } func newCustomerAppsStep() *sqlgraph.Step { @@ -229,24 +298,45 @@ func newCustomerAppsStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2M, false, CustomerAppsTable, CustomerAppsColumn), ) } -func newTaxAppStep() *sqlgraph.Step { +func newBillingProfileTaxAppStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingProfileTaxAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfileTaxAppTable, BillingProfileTaxAppColumn), + ) +} +func newBillingProfileInvoicingAppStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingProfileInvoicingAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfileInvoicingAppTable, BillingProfileInvoicingAppColumn), + ) +} +func newBillingProfilePaymentAppStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingProfilePaymentAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfilePaymentAppTable, BillingProfilePaymentAppColumn), + ) +} +func newBillingInvoiceTaxAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(TaxAppInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, TaxAppTable, TaxAppColumn), + sqlgraph.To(BillingInvoiceTaxAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceTaxAppTable, BillingInvoiceTaxAppColumn), ) } -func newInvoicingAppStep() *sqlgraph.Step { +func newBillingInvoiceInvoicingAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(InvoicingAppInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, InvoicingAppTable, InvoicingAppColumn), + sqlgraph.To(BillingInvoiceInvoicingAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceInvoicingAppTable, BillingInvoiceInvoicingAppColumn), ) } -func newPaymentAppStep() *sqlgraph.Step { +func newBillingInvoicePaymentAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(PaymentAppInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, PaymentAppTable, PaymentAppColumn), + sqlgraph.To(BillingInvoicePaymentAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoicePaymentAppTable, BillingInvoicePaymentAppColumn), ) } diff --git a/openmeter/ent/db/app/where.go b/openmeter/ent/db/app/where.go index 1dd4b03c2..18567b08b 100644 --- a/openmeter/ent/db/app/where.go +++ b/openmeter/ent/db/app/where.go @@ -659,21 +659,21 @@ func HasCustomerAppsWith(preds ...predicate.AppCustomer) predicate.App { }) } -// HasTaxApp applies the HasEdge predicate on the "tax_app" edge. -func HasTaxApp() predicate.App { +// HasBillingProfileTaxApp applies the HasEdge predicate on the "billing_profile_tax_app" edge. +func HasBillingProfileTaxApp() predicate.App { return predicate.App(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, TaxAppTable, TaxAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfileTaxAppTable, BillingProfileTaxAppColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasTaxAppWith applies the HasEdge predicate on the "tax_app" edge with a given conditions (other predicates). -func HasTaxAppWith(preds ...predicate.BillingProfile) predicate.App { +// HasBillingProfileTaxAppWith applies the HasEdge predicate on the "billing_profile_tax_app" edge with a given conditions (other predicates). +func HasBillingProfileTaxAppWith(preds ...predicate.BillingProfile) predicate.App { return predicate.App(func(s *sql.Selector) { - step := newTaxAppStep() + step := newBillingProfileTaxAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -682,21 +682,21 @@ func HasTaxAppWith(preds ...predicate.BillingProfile) predicate.App { }) } -// HasInvoicingApp applies the HasEdge predicate on the "invoicing_app" edge. -func HasInvoicingApp() predicate.App { +// HasBillingProfileInvoicingApp applies the HasEdge predicate on the "billing_profile_invoicing_app" edge. +func HasBillingProfileInvoicingApp() predicate.App { return predicate.App(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, InvoicingAppTable, InvoicingAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfileInvoicingAppTable, BillingProfileInvoicingAppColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasInvoicingAppWith applies the HasEdge predicate on the "invoicing_app" edge with a given conditions (other predicates). -func HasInvoicingAppWith(preds ...predicate.BillingProfile) predicate.App { +// HasBillingProfileInvoicingAppWith applies the HasEdge predicate on the "billing_profile_invoicing_app" edge with a given conditions (other predicates). +func HasBillingProfileInvoicingAppWith(preds ...predicate.BillingProfile) predicate.App { return predicate.App(func(s *sql.Selector) { - step := newInvoicingAppStep() + step := newBillingProfileInvoicingAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -705,21 +705,90 @@ func HasInvoicingAppWith(preds ...predicate.BillingProfile) predicate.App { }) } -// HasPaymentApp applies the HasEdge predicate on the "payment_app" edge. -func HasPaymentApp() predicate.App { +// HasBillingProfilePaymentApp applies the HasEdge predicate on the "billing_profile_payment_app" edge. +func HasBillingProfilePaymentApp() predicate.App { return predicate.App(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, PaymentAppTable, PaymentAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, BillingProfilePaymentAppTable, BillingProfilePaymentAppColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasPaymentAppWith applies the HasEdge predicate on the "payment_app" edge with a given conditions (other predicates). -func HasPaymentAppWith(preds ...predicate.BillingProfile) predicate.App { +// HasBillingProfilePaymentAppWith applies the HasEdge predicate on the "billing_profile_payment_app" edge with a given conditions (other predicates). +func HasBillingProfilePaymentAppWith(preds ...predicate.BillingProfile) predicate.App { return predicate.App(func(s *sql.Selector) { - step := newPaymentAppStep() + step := newBillingProfilePaymentAppStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasBillingInvoiceTaxApp applies the HasEdge predicate on the "billing_invoice_tax_app" edge. +func HasBillingInvoiceTaxApp() predicate.App { + return predicate.App(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceTaxAppTable, BillingInvoiceTaxAppColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceTaxAppWith applies the HasEdge predicate on the "billing_invoice_tax_app" edge with a given conditions (other predicates). +func HasBillingInvoiceTaxAppWith(preds ...predicate.BillingInvoice) predicate.App { + return predicate.App(func(s *sql.Selector) { + step := newBillingInvoiceTaxAppStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasBillingInvoiceInvoicingApp applies the HasEdge predicate on the "billing_invoice_invoicing_app" edge. +func HasBillingInvoiceInvoicingApp() predicate.App { + return predicate.App(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceInvoicingAppTable, BillingInvoiceInvoicingAppColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceInvoicingAppWith applies the HasEdge predicate on the "billing_invoice_invoicing_app" edge with a given conditions (other predicates). +func HasBillingInvoiceInvoicingAppWith(preds ...predicate.BillingInvoice) predicate.App { + return predicate.App(func(s *sql.Selector) { + step := newBillingInvoiceInvoicingAppStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasBillingInvoicePaymentApp applies the HasEdge predicate on the "billing_invoice_payment_app" edge. +func HasBillingInvoicePaymentApp() predicate.App { + return predicate.App(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoicePaymentAppTable, BillingInvoicePaymentAppColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoicePaymentAppWith applies the HasEdge predicate on the "billing_invoice_payment_app" edge with a given conditions (other predicates). +func HasBillingInvoicePaymentAppWith(preds ...predicate.BillingInvoice) predicate.App { + return predicate.App(func(s *sql.Selector) { + step := newBillingInvoicePaymentAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/openmeter/ent/db/app_create.go b/openmeter/ent/db/app_create.go index cb33c9441..df1e28d01 100644 --- a/openmeter/ent/db/app_create.go +++ b/openmeter/ent/db/app_create.go @@ -15,6 +15,7 @@ import ( appentitybase "github.com/openmeterio/openmeter/openmeter/app/entity/base" "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" ) @@ -155,49 +156,94 @@ func (ac *AppCreate) AddCustomerApps(a ...*AppCustomer) *AppCreate { return ac.AddCustomerAppIDs(ids...) } -// AddTaxAppIDs adds the "tax_app" edge to the BillingProfile entity by IDs. -func (ac *AppCreate) AddTaxAppIDs(ids ...string) *AppCreate { - ac.mutation.AddTaxAppIDs(ids...) +// AddBillingProfileTaxAppIDs adds the "billing_profile_tax_app" edge to the BillingProfile entity by IDs. +func (ac *AppCreate) AddBillingProfileTaxAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingProfileTaxAppIDs(ids...) return ac } -// AddTaxApp adds the "tax_app" edges to the BillingProfile entity. -func (ac *AppCreate) AddTaxApp(b ...*BillingProfile) *AppCreate { +// AddBillingProfileTaxApp adds the "billing_profile_tax_app" edges to the BillingProfile entity. +func (ac *AppCreate) AddBillingProfileTaxApp(b ...*BillingProfile) *AppCreate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return ac.AddTaxAppIDs(ids...) + return ac.AddBillingProfileTaxAppIDs(ids...) } -// AddInvoicingAppIDs adds the "invoicing_app" edge to the BillingProfile entity by IDs. -func (ac *AppCreate) AddInvoicingAppIDs(ids ...string) *AppCreate { - ac.mutation.AddInvoicingAppIDs(ids...) +// AddBillingProfileInvoicingAppIDs adds the "billing_profile_invoicing_app" edge to the BillingProfile entity by IDs. +func (ac *AppCreate) AddBillingProfileInvoicingAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingProfileInvoicingAppIDs(ids...) return ac } -// AddInvoicingApp adds the "invoicing_app" edges to the BillingProfile entity. -func (ac *AppCreate) AddInvoicingApp(b ...*BillingProfile) *AppCreate { +// AddBillingProfileInvoicingApp adds the "billing_profile_invoicing_app" edges to the BillingProfile entity. +func (ac *AppCreate) AddBillingProfileInvoicingApp(b ...*BillingProfile) *AppCreate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return ac.AddInvoicingAppIDs(ids...) + return ac.AddBillingProfileInvoicingAppIDs(ids...) } -// AddPaymentAppIDs adds the "payment_app" edge to the BillingProfile entity by IDs. -func (ac *AppCreate) AddPaymentAppIDs(ids ...string) *AppCreate { - ac.mutation.AddPaymentAppIDs(ids...) +// AddBillingProfilePaymentAppIDs adds the "billing_profile_payment_app" edge to the BillingProfile entity by IDs. +func (ac *AppCreate) AddBillingProfilePaymentAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingProfilePaymentAppIDs(ids...) return ac } -// AddPaymentApp adds the "payment_app" edges to the BillingProfile entity. -func (ac *AppCreate) AddPaymentApp(b ...*BillingProfile) *AppCreate { +// AddBillingProfilePaymentApp adds the "billing_profile_payment_app" edges to the BillingProfile entity. +func (ac *AppCreate) AddBillingProfilePaymentApp(b ...*BillingProfile) *AppCreate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return ac.AddPaymentAppIDs(ids...) + return ac.AddBillingProfilePaymentAppIDs(ids...) +} + +// AddBillingInvoiceTaxAppIDs adds the "billing_invoice_tax_app" edge to the BillingInvoice entity by IDs. +func (ac *AppCreate) AddBillingInvoiceTaxAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingInvoiceTaxAppIDs(ids...) + return ac +} + +// AddBillingInvoiceTaxApp adds the "billing_invoice_tax_app" edges to the BillingInvoice entity. +func (ac *AppCreate) AddBillingInvoiceTaxApp(b ...*BillingInvoice) *AppCreate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return ac.AddBillingInvoiceTaxAppIDs(ids...) +} + +// AddBillingInvoiceInvoicingAppIDs adds the "billing_invoice_invoicing_app" edge to the BillingInvoice entity by IDs. +func (ac *AppCreate) AddBillingInvoiceInvoicingAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingInvoiceInvoicingAppIDs(ids...) + return ac +} + +// AddBillingInvoiceInvoicingApp adds the "billing_invoice_invoicing_app" edges to the BillingInvoice entity. +func (ac *AppCreate) AddBillingInvoiceInvoicingApp(b ...*BillingInvoice) *AppCreate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return ac.AddBillingInvoiceInvoicingAppIDs(ids...) +} + +// AddBillingInvoicePaymentAppIDs adds the "billing_invoice_payment_app" edge to the BillingInvoice entity by IDs. +func (ac *AppCreate) AddBillingInvoicePaymentAppIDs(ids ...string) *AppCreate { + ac.mutation.AddBillingInvoicePaymentAppIDs(ids...) + return ac +} + +// AddBillingInvoicePaymentApp adds the "billing_invoice_payment_app" edges to the BillingInvoice entity. +func (ac *AppCreate) AddBillingInvoicePaymentApp(b ...*BillingInvoice) *AppCreate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return ac.AddBillingInvoicePaymentAppIDs(ids...) } // Mutation returns the AppMutation object of the builder. @@ -373,12 +419,12 @@ func (ac *AppCreate) createSpec() (*App, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.TaxAppIDs(); len(nodes) > 0 { + if nodes := ac.mutation.BillingProfileTaxAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -389,12 +435,12 @@ func (ac *AppCreate) createSpec() (*App, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.InvoicingAppIDs(); len(nodes) > 0 { + if nodes := ac.mutation.BillingProfileInvoicingAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -405,12 +451,12 @@ func (ac *AppCreate) createSpec() (*App, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } - if nodes := ac.mutation.PaymentAppIDs(); len(nodes) > 0 { + if nodes := ac.mutation.BillingProfilePaymentAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -421,6 +467,54 @@ func (ac *AppCreate) createSpec() (*App, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := ac.mutation.BillingInvoiceTaxAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := ac.mutation.BillingInvoiceInvoicingAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := ac.mutation.BillingInvoicePaymentAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/openmeter/ent/db/app_query.go b/openmeter/ent/db/app_query.go index ee6f0bbe7..33a0140b1 100644 --- a/openmeter/ent/db/app_query.go +++ b/openmeter/ent/db/app_query.go @@ -15,6 +15,7 @@ import ( "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" ) @@ -22,15 +23,18 @@ import ( // AppQuery is the builder for querying App entities. type AppQuery struct { config - ctx *QueryContext - order []app.OrderOption - inters []Interceptor - predicates []predicate.App - withCustomerApps *AppCustomerQuery - withTaxApp *BillingProfileQuery - withInvoicingApp *BillingProfileQuery - withPaymentApp *BillingProfileQuery - modifiers []func(*sql.Selector) + ctx *QueryContext + order []app.OrderOption + inters []Interceptor + predicates []predicate.App + withCustomerApps *AppCustomerQuery + withBillingProfileTaxApp *BillingProfileQuery + withBillingProfileInvoicingApp *BillingProfileQuery + withBillingProfilePaymentApp *BillingProfileQuery + withBillingInvoiceTaxApp *BillingInvoiceQuery + withBillingInvoiceInvoicingApp *BillingInvoiceQuery + withBillingInvoicePaymentApp *BillingInvoiceQuery + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -89,8 +93,8 @@ func (aq *AppQuery) QueryCustomerApps() *AppCustomerQuery { return query } -// QueryTaxApp chains the current query on the "tax_app" edge. -func (aq *AppQuery) QueryTaxApp() *BillingProfileQuery { +// QueryBillingProfileTaxApp chains the current query on the "billing_profile_tax_app" edge. +func (aq *AppQuery) QueryBillingProfileTaxApp() *BillingProfileQuery { query := (&BillingProfileClient{config: aq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := aq.prepareQuery(ctx); err != nil { @@ -103,7 +107,7 @@ func (aq *AppQuery) QueryTaxApp() *BillingProfileQuery { step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, selector), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.TaxAppTable, app.TaxAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfileTaxAppTable, app.BillingProfileTaxAppColumn), ) fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) return fromU, nil @@ -111,8 +115,8 @@ func (aq *AppQuery) QueryTaxApp() *BillingProfileQuery { return query } -// QueryInvoicingApp chains the current query on the "invoicing_app" edge. -func (aq *AppQuery) QueryInvoicingApp() *BillingProfileQuery { +// QueryBillingProfileInvoicingApp chains the current query on the "billing_profile_invoicing_app" edge. +func (aq *AppQuery) QueryBillingProfileInvoicingApp() *BillingProfileQuery { query := (&BillingProfileClient{config: aq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := aq.prepareQuery(ctx); err != nil { @@ -125,7 +129,7 @@ func (aq *AppQuery) QueryInvoicingApp() *BillingProfileQuery { step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, selector), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.InvoicingAppTable, app.InvoicingAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfileInvoicingAppTable, app.BillingProfileInvoicingAppColumn), ) fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) return fromU, nil @@ -133,8 +137,8 @@ func (aq *AppQuery) QueryInvoicingApp() *BillingProfileQuery { return query } -// QueryPaymentApp chains the current query on the "payment_app" edge. -func (aq *AppQuery) QueryPaymentApp() *BillingProfileQuery { +// QueryBillingProfilePaymentApp chains the current query on the "billing_profile_payment_app" edge. +func (aq *AppQuery) QueryBillingProfilePaymentApp() *BillingProfileQuery { query := (&BillingProfileClient{config: aq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := aq.prepareQuery(ctx); err != nil { @@ -147,7 +151,73 @@ func (aq *AppQuery) QueryPaymentApp() *BillingProfileQuery { step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, selector), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.PaymentAppTable, app.PaymentAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfilePaymentAppTable, app.BillingProfilePaymentAppColumn), + ) + fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryBillingInvoiceTaxApp chains the current query on the "billing_invoice_tax_app" edge. +func (aq *AppQuery) QueryBillingInvoiceTaxApp() *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := aq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := aq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, selector), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoiceTaxAppTable, app.BillingInvoiceTaxAppColumn), + ) + fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryBillingInvoiceInvoicingApp chains the current query on the "billing_invoice_invoicing_app" edge. +func (aq *AppQuery) QueryBillingInvoiceInvoicingApp() *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := aq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := aq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, selector), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoiceInvoicingAppTable, app.BillingInvoiceInvoicingAppColumn), + ) + fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryBillingInvoicePaymentApp chains the current query on the "billing_invoice_payment_app" edge. +func (aq *AppQuery) QueryBillingInvoicePaymentApp() *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := aq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := aq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, selector), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoicePaymentAppTable, app.BillingInvoicePaymentAppColumn), ) fromU = sqlgraph.SetNeighbors(aq.driver.Dialect(), step) return fromU, nil @@ -342,15 +412,18 @@ func (aq *AppQuery) Clone() *AppQuery { return nil } return &AppQuery{ - config: aq.config, - ctx: aq.ctx.Clone(), - order: append([]app.OrderOption{}, aq.order...), - inters: append([]Interceptor{}, aq.inters...), - predicates: append([]predicate.App{}, aq.predicates...), - withCustomerApps: aq.withCustomerApps.Clone(), - withTaxApp: aq.withTaxApp.Clone(), - withInvoicingApp: aq.withInvoicingApp.Clone(), - withPaymentApp: aq.withPaymentApp.Clone(), + config: aq.config, + ctx: aq.ctx.Clone(), + order: append([]app.OrderOption{}, aq.order...), + inters: append([]Interceptor{}, aq.inters...), + predicates: append([]predicate.App{}, aq.predicates...), + withCustomerApps: aq.withCustomerApps.Clone(), + withBillingProfileTaxApp: aq.withBillingProfileTaxApp.Clone(), + withBillingProfileInvoicingApp: aq.withBillingProfileInvoicingApp.Clone(), + withBillingProfilePaymentApp: aq.withBillingProfilePaymentApp.Clone(), + withBillingInvoiceTaxApp: aq.withBillingInvoiceTaxApp.Clone(), + withBillingInvoiceInvoicingApp: aq.withBillingInvoiceInvoicingApp.Clone(), + withBillingInvoicePaymentApp: aq.withBillingInvoicePaymentApp.Clone(), // clone intermediate query. sql: aq.sql.Clone(), path: aq.path, @@ -368,36 +441,69 @@ func (aq *AppQuery) WithCustomerApps(opts ...func(*AppCustomerQuery)) *AppQuery return aq } -// WithTaxApp tells the query-builder to eager-load the nodes that are connected to -// the "tax_app" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AppQuery) WithTaxApp(opts ...func(*BillingProfileQuery)) *AppQuery { +// WithBillingProfileTaxApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_profile_tax_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingProfileTaxApp(opts ...func(*BillingProfileQuery)) *AppQuery { query := (&BillingProfileClient{config: aq.config}).Query() for _, opt := range opts { opt(query) } - aq.withTaxApp = query + aq.withBillingProfileTaxApp = query return aq } -// WithInvoicingApp tells the query-builder to eager-load the nodes that are connected to -// the "invoicing_app" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AppQuery) WithInvoicingApp(opts ...func(*BillingProfileQuery)) *AppQuery { +// WithBillingProfileInvoicingApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_profile_invoicing_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingProfileInvoicingApp(opts ...func(*BillingProfileQuery)) *AppQuery { query := (&BillingProfileClient{config: aq.config}).Query() for _, opt := range opts { opt(query) } - aq.withInvoicingApp = query + aq.withBillingProfileInvoicingApp = query return aq } -// WithPaymentApp tells the query-builder to eager-load the nodes that are connected to -// the "payment_app" edge. The optional arguments are used to configure the query builder of the edge. -func (aq *AppQuery) WithPaymentApp(opts ...func(*BillingProfileQuery)) *AppQuery { +// WithBillingProfilePaymentApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_profile_payment_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingProfilePaymentApp(opts ...func(*BillingProfileQuery)) *AppQuery { query := (&BillingProfileClient{config: aq.config}).Query() for _, opt := range opts { opt(query) } - aq.withPaymentApp = query + aq.withBillingProfilePaymentApp = query + return aq +} + +// WithBillingInvoiceTaxApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_tax_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingInvoiceTaxApp(opts ...func(*BillingInvoiceQuery)) *AppQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + for _, opt := range opts { + opt(query) + } + aq.withBillingInvoiceTaxApp = query + return aq +} + +// WithBillingInvoiceInvoicingApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_invoicing_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingInvoiceInvoicingApp(opts ...func(*BillingInvoiceQuery)) *AppQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + for _, opt := range opts { + opt(query) + } + aq.withBillingInvoiceInvoicingApp = query + return aq +} + +// WithBillingInvoicePaymentApp tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_payment_app" edge. The optional arguments are used to configure the query builder of the edge. +func (aq *AppQuery) WithBillingInvoicePaymentApp(opts ...func(*BillingInvoiceQuery)) *AppQuery { + query := (&BillingInvoiceClient{config: aq.config}).Query() + for _, opt := range opts { + opt(query) + } + aq.withBillingInvoicePaymentApp = query return aq } @@ -479,11 +585,14 @@ func (aq *AppQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*App, err var ( nodes = []*App{} _spec = aq.querySpec() - loadedTypes = [4]bool{ + loadedTypes = [7]bool{ aq.withCustomerApps != nil, - aq.withTaxApp != nil, - aq.withInvoicingApp != nil, - aq.withPaymentApp != nil, + aq.withBillingProfileTaxApp != nil, + aq.withBillingProfileInvoicingApp != nil, + aq.withBillingProfilePaymentApp != nil, + aq.withBillingInvoiceTaxApp != nil, + aq.withBillingInvoiceInvoicingApp != nil, + aq.withBillingInvoicePaymentApp != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { @@ -514,24 +623,57 @@ func (aq *AppQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*App, err return nil, err } } - if query := aq.withTaxApp; query != nil { - if err := aq.loadTaxApp(ctx, query, nodes, - func(n *App) { n.Edges.TaxApp = []*BillingProfile{} }, - func(n *App, e *BillingProfile) { n.Edges.TaxApp = append(n.Edges.TaxApp, e) }); err != nil { + if query := aq.withBillingProfileTaxApp; query != nil { + if err := aq.loadBillingProfileTaxApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingProfileTaxApp = []*BillingProfile{} }, + func(n *App, e *BillingProfile) { + n.Edges.BillingProfileTaxApp = append(n.Edges.BillingProfileTaxApp, e) + }); err != nil { + return nil, err + } + } + if query := aq.withBillingProfileInvoicingApp; query != nil { + if err := aq.loadBillingProfileInvoicingApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingProfileInvoicingApp = []*BillingProfile{} }, + func(n *App, e *BillingProfile) { + n.Edges.BillingProfileInvoicingApp = append(n.Edges.BillingProfileInvoicingApp, e) + }); err != nil { + return nil, err + } + } + if query := aq.withBillingProfilePaymentApp; query != nil { + if err := aq.loadBillingProfilePaymentApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingProfilePaymentApp = []*BillingProfile{} }, + func(n *App, e *BillingProfile) { + n.Edges.BillingProfilePaymentApp = append(n.Edges.BillingProfilePaymentApp, e) + }); err != nil { + return nil, err + } + } + if query := aq.withBillingInvoiceTaxApp; query != nil { + if err := aq.loadBillingInvoiceTaxApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingInvoiceTaxApp = []*BillingInvoice{} }, + func(n *App, e *BillingInvoice) { + n.Edges.BillingInvoiceTaxApp = append(n.Edges.BillingInvoiceTaxApp, e) + }); err != nil { return nil, err } } - if query := aq.withInvoicingApp; query != nil { - if err := aq.loadInvoicingApp(ctx, query, nodes, - func(n *App) { n.Edges.InvoicingApp = []*BillingProfile{} }, - func(n *App, e *BillingProfile) { n.Edges.InvoicingApp = append(n.Edges.InvoicingApp, e) }); err != nil { + if query := aq.withBillingInvoiceInvoicingApp; query != nil { + if err := aq.loadBillingInvoiceInvoicingApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingInvoiceInvoicingApp = []*BillingInvoice{} }, + func(n *App, e *BillingInvoice) { + n.Edges.BillingInvoiceInvoicingApp = append(n.Edges.BillingInvoiceInvoicingApp, e) + }); err != nil { return nil, err } } - if query := aq.withPaymentApp; query != nil { - if err := aq.loadPaymentApp(ctx, query, nodes, - func(n *App) { n.Edges.PaymentApp = []*BillingProfile{} }, - func(n *App, e *BillingProfile) { n.Edges.PaymentApp = append(n.Edges.PaymentApp, e) }); err != nil { + if query := aq.withBillingInvoicePaymentApp; query != nil { + if err := aq.loadBillingInvoicePaymentApp(ctx, query, nodes, + func(n *App) { n.Edges.BillingInvoicePaymentApp = []*BillingInvoice{} }, + func(n *App, e *BillingInvoice) { + n.Edges.BillingInvoicePaymentApp = append(n.Edges.BillingInvoicePaymentApp, e) + }); err != nil { return nil, err } } @@ -568,7 +710,7 @@ func (aq *AppQuery) loadCustomerApps(ctx context.Context, query *AppCustomerQuer } return nil } -func (aq *AppQuery) loadTaxApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { +func (aq *AppQuery) loadBillingProfileTaxApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*App) for i := range nodes { @@ -582,7 +724,7 @@ func (aq *AppQuery) loadTaxApp(ctx context.Context, query *BillingProfileQuery, query.ctx.AppendFieldOnce(billingprofile.FieldTaxAppID) } query.Where(predicate.BillingProfile(func(s *sql.Selector) { - s.Where(sql.InValues(s.C(app.TaxAppColumn), fks...)) + s.Where(sql.InValues(s.C(app.BillingProfileTaxAppColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { @@ -598,7 +740,7 @@ func (aq *AppQuery) loadTaxApp(ctx context.Context, query *BillingProfileQuery, } return nil } -func (aq *AppQuery) loadInvoicingApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { +func (aq *AppQuery) loadBillingProfileInvoicingApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*App) for i := range nodes { @@ -612,7 +754,7 @@ func (aq *AppQuery) loadInvoicingApp(ctx context.Context, query *BillingProfileQ query.ctx.AppendFieldOnce(billingprofile.FieldInvoicingAppID) } query.Where(predicate.BillingProfile(func(s *sql.Selector) { - s.Where(sql.InValues(s.C(app.InvoicingAppColumn), fks...)) + s.Where(sql.InValues(s.C(app.BillingProfileInvoicingAppColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { @@ -628,7 +770,7 @@ func (aq *AppQuery) loadInvoicingApp(ctx context.Context, query *BillingProfileQ } return nil } -func (aq *AppQuery) loadPaymentApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { +func (aq *AppQuery) loadBillingProfilePaymentApp(ctx context.Context, query *BillingProfileQuery, nodes []*App, init func(*App), assign func(*App, *BillingProfile)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*App) for i := range nodes { @@ -642,7 +784,97 @@ func (aq *AppQuery) loadPaymentApp(ctx context.Context, query *BillingProfileQue query.ctx.AppendFieldOnce(billingprofile.FieldPaymentAppID) } query.Where(predicate.BillingProfile(func(s *sql.Selector) { - s.Where(sql.InValues(s.C(app.PaymentAppColumn), fks...)) + s.Where(sql.InValues(s.C(app.BillingProfilePaymentAppColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.PaymentAppID + node, ok := nodeids[fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "payment_app_id" returned %v for node %v`, fk, n.ID) + } + assign(node, n) + } + return nil +} +func (aq *AppQuery) loadBillingInvoiceTaxApp(ctx context.Context, query *BillingInvoiceQuery, nodes []*App, init func(*App), assign func(*App, *BillingInvoice)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[string]*App) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(billinginvoice.FieldTaxAppID) + } + query.Where(predicate.BillingInvoice(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(app.BillingInvoiceTaxAppColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.TaxAppID + node, ok := nodeids[fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "tax_app_id" returned %v for node %v`, fk, n.ID) + } + assign(node, n) + } + return nil +} +func (aq *AppQuery) loadBillingInvoiceInvoicingApp(ctx context.Context, query *BillingInvoiceQuery, nodes []*App, init func(*App), assign func(*App, *BillingInvoice)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[string]*App) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(billinginvoice.FieldInvoicingAppID) + } + query.Where(predicate.BillingInvoice(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(app.BillingInvoiceInvoicingAppColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.InvoicingAppID + node, ok := nodeids[fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "invoicing_app_id" returned %v for node %v`, fk, n.ID) + } + assign(node, n) + } + return nil +} +func (aq *AppQuery) loadBillingInvoicePaymentApp(ctx context.Context, query *BillingInvoiceQuery, nodes []*App, init func(*App), assign func(*App, *BillingInvoice)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[string]*App) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(billinginvoice.FieldPaymentAppID) + } + query.Where(predicate.BillingInvoice(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(app.BillingInvoicePaymentAppColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { diff --git a/openmeter/ent/db/app_update.go b/openmeter/ent/db/app_update.go index 516459d08..5deaf012f 100644 --- a/openmeter/ent/db/app_update.go +++ b/openmeter/ent/db/app_update.go @@ -14,6 +14,7 @@ import ( appentitybase "github.com/openmeterio/openmeter/openmeter/app/entity/base" "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" ) @@ -146,49 +147,94 @@ func (au *AppUpdate) AddCustomerApps(a ...*AppCustomer) *AppUpdate { return au.AddCustomerAppIDs(ids...) } -// AddTaxAppIDs adds the "tax_app" edge to the BillingProfile entity by IDs. -func (au *AppUpdate) AddTaxAppIDs(ids ...string) *AppUpdate { - au.mutation.AddTaxAppIDs(ids...) +// AddBillingProfileTaxAppIDs adds the "billing_profile_tax_app" edge to the BillingProfile entity by IDs. +func (au *AppUpdate) AddBillingProfileTaxAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingProfileTaxAppIDs(ids...) return au } -// AddTaxApp adds the "tax_app" edges to the BillingProfile entity. -func (au *AppUpdate) AddTaxApp(b ...*BillingProfile) *AppUpdate { +// AddBillingProfileTaxApp adds the "billing_profile_tax_app" edges to the BillingProfile entity. +func (au *AppUpdate) AddBillingProfileTaxApp(b ...*BillingProfile) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.AddTaxAppIDs(ids...) + return au.AddBillingProfileTaxAppIDs(ids...) } -// AddInvoicingAppIDs adds the "invoicing_app" edge to the BillingProfile entity by IDs. -func (au *AppUpdate) AddInvoicingAppIDs(ids ...string) *AppUpdate { - au.mutation.AddInvoicingAppIDs(ids...) +// AddBillingProfileInvoicingAppIDs adds the "billing_profile_invoicing_app" edge to the BillingProfile entity by IDs. +func (au *AppUpdate) AddBillingProfileInvoicingAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingProfileInvoicingAppIDs(ids...) return au } -// AddInvoicingApp adds the "invoicing_app" edges to the BillingProfile entity. -func (au *AppUpdate) AddInvoicingApp(b ...*BillingProfile) *AppUpdate { +// AddBillingProfileInvoicingApp adds the "billing_profile_invoicing_app" edges to the BillingProfile entity. +func (au *AppUpdate) AddBillingProfileInvoicingApp(b ...*BillingProfile) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.AddInvoicingAppIDs(ids...) + return au.AddBillingProfileInvoicingAppIDs(ids...) } -// AddPaymentAppIDs adds the "payment_app" edge to the BillingProfile entity by IDs. -func (au *AppUpdate) AddPaymentAppIDs(ids ...string) *AppUpdate { - au.mutation.AddPaymentAppIDs(ids...) +// AddBillingProfilePaymentAppIDs adds the "billing_profile_payment_app" edge to the BillingProfile entity by IDs. +func (au *AppUpdate) AddBillingProfilePaymentAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingProfilePaymentAppIDs(ids...) return au } -// AddPaymentApp adds the "payment_app" edges to the BillingProfile entity. -func (au *AppUpdate) AddPaymentApp(b ...*BillingProfile) *AppUpdate { +// AddBillingProfilePaymentApp adds the "billing_profile_payment_app" edges to the BillingProfile entity. +func (au *AppUpdate) AddBillingProfilePaymentApp(b ...*BillingProfile) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.AddPaymentAppIDs(ids...) + return au.AddBillingProfilePaymentAppIDs(ids...) +} + +// AddBillingInvoiceTaxAppIDs adds the "billing_invoice_tax_app" edge to the BillingInvoice entity by IDs. +func (au *AppUpdate) AddBillingInvoiceTaxAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingInvoiceTaxAppIDs(ids...) + return au +} + +// AddBillingInvoiceTaxApp adds the "billing_invoice_tax_app" edges to the BillingInvoice entity. +func (au *AppUpdate) AddBillingInvoiceTaxApp(b ...*BillingInvoice) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.AddBillingInvoiceTaxAppIDs(ids...) +} + +// AddBillingInvoiceInvoicingAppIDs adds the "billing_invoice_invoicing_app" edge to the BillingInvoice entity by IDs. +func (au *AppUpdate) AddBillingInvoiceInvoicingAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingInvoiceInvoicingAppIDs(ids...) + return au +} + +// AddBillingInvoiceInvoicingApp adds the "billing_invoice_invoicing_app" edges to the BillingInvoice entity. +func (au *AppUpdate) AddBillingInvoiceInvoicingApp(b ...*BillingInvoice) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.AddBillingInvoiceInvoicingAppIDs(ids...) +} + +// AddBillingInvoicePaymentAppIDs adds the "billing_invoice_payment_app" edge to the BillingInvoice entity by IDs. +func (au *AppUpdate) AddBillingInvoicePaymentAppIDs(ids ...string) *AppUpdate { + au.mutation.AddBillingInvoicePaymentAppIDs(ids...) + return au +} + +// AddBillingInvoicePaymentApp adds the "billing_invoice_payment_app" edges to the BillingInvoice entity. +func (au *AppUpdate) AddBillingInvoicePaymentApp(b ...*BillingInvoice) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.AddBillingInvoicePaymentAppIDs(ids...) } // Mutation returns the AppMutation object of the builder. @@ -217,67 +263,130 @@ func (au *AppUpdate) RemoveCustomerApps(a ...*AppCustomer) *AppUpdate { return au.RemoveCustomerAppIDs(ids...) } -// ClearTaxApp clears all "tax_app" edges to the BillingProfile entity. -func (au *AppUpdate) ClearTaxApp() *AppUpdate { - au.mutation.ClearTaxApp() +// ClearBillingProfileTaxApp clears all "billing_profile_tax_app" edges to the BillingProfile entity. +func (au *AppUpdate) ClearBillingProfileTaxApp() *AppUpdate { + au.mutation.ClearBillingProfileTaxApp() + return au +} + +// RemoveBillingProfileTaxAppIDs removes the "billing_profile_tax_app" edge to BillingProfile entities by IDs. +func (au *AppUpdate) RemoveBillingProfileTaxAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingProfileTaxAppIDs(ids...) + return au +} + +// RemoveBillingProfileTaxApp removes "billing_profile_tax_app" edges to BillingProfile entities. +func (au *AppUpdate) RemoveBillingProfileTaxApp(b ...*BillingProfile) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.RemoveBillingProfileTaxAppIDs(ids...) +} + +// ClearBillingProfileInvoicingApp clears all "billing_profile_invoicing_app" edges to the BillingProfile entity. +func (au *AppUpdate) ClearBillingProfileInvoicingApp() *AppUpdate { + au.mutation.ClearBillingProfileInvoicingApp() return au } -// RemoveTaxAppIDs removes the "tax_app" edge to BillingProfile entities by IDs. -func (au *AppUpdate) RemoveTaxAppIDs(ids ...string) *AppUpdate { - au.mutation.RemoveTaxAppIDs(ids...) +// RemoveBillingProfileInvoicingAppIDs removes the "billing_profile_invoicing_app" edge to BillingProfile entities by IDs. +func (au *AppUpdate) RemoveBillingProfileInvoicingAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingProfileInvoicingAppIDs(ids...) return au } -// RemoveTaxApp removes "tax_app" edges to BillingProfile entities. -func (au *AppUpdate) RemoveTaxApp(b ...*BillingProfile) *AppUpdate { +// RemoveBillingProfileInvoicingApp removes "billing_profile_invoicing_app" edges to BillingProfile entities. +func (au *AppUpdate) RemoveBillingProfileInvoicingApp(b ...*BillingProfile) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.RemoveTaxAppIDs(ids...) + return au.RemoveBillingProfileInvoicingAppIDs(ids...) } -// ClearInvoicingApp clears all "invoicing_app" edges to the BillingProfile entity. -func (au *AppUpdate) ClearInvoicingApp() *AppUpdate { - au.mutation.ClearInvoicingApp() +// ClearBillingProfilePaymentApp clears all "billing_profile_payment_app" edges to the BillingProfile entity. +func (au *AppUpdate) ClearBillingProfilePaymentApp() *AppUpdate { + au.mutation.ClearBillingProfilePaymentApp() return au } -// RemoveInvoicingAppIDs removes the "invoicing_app" edge to BillingProfile entities by IDs. -func (au *AppUpdate) RemoveInvoicingAppIDs(ids ...string) *AppUpdate { - au.mutation.RemoveInvoicingAppIDs(ids...) +// RemoveBillingProfilePaymentAppIDs removes the "billing_profile_payment_app" edge to BillingProfile entities by IDs. +func (au *AppUpdate) RemoveBillingProfilePaymentAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingProfilePaymentAppIDs(ids...) return au } -// RemoveInvoicingApp removes "invoicing_app" edges to BillingProfile entities. -func (au *AppUpdate) RemoveInvoicingApp(b ...*BillingProfile) *AppUpdate { +// RemoveBillingProfilePaymentApp removes "billing_profile_payment_app" edges to BillingProfile entities. +func (au *AppUpdate) RemoveBillingProfilePaymentApp(b ...*BillingProfile) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.RemoveInvoicingAppIDs(ids...) + return au.RemoveBillingProfilePaymentAppIDs(ids...) } -// ClearPaymentApp clears all "payment_app" edges to the BillingProfile entity. -func (au *AppUpdate) ClearPaymentApp() *AppUpdate { - au.mutation.ClearPaymentApp() +// ClearBillingInvoiceTaxApp clears all "billing_invoice_tax_app" edges to the BillingInvoice entity. +func (au *AppUpdate) ClearBillingInvoiceTaxApp() *AppUpdate { + au.mutation.ClearBillingInvoiceTaxApp() return au } -// RemovePaymentAppIDs removes the "payment_app" edge to BillingProfile entities by IDs. -func (au *AppUpdate) RemovePaymentAppIDs(ids ...string) *AppUpdate { - au.mutation.RemovePaymentAppIDs(ids...) +// RemoveBillingInvoiceTaxAppIDs removes the "billing_invoice_tax_app" edge to BillingInvoice entities by IDs. +func (au *AppUpdate) RemoveBillingInvoiceTaxAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingInvoiceTaxAppIDs(ids...) return au } -// RemovePaymentApp removes "payment_app" edges to BillingProfile entities. -func (au *AppUpdate) RemovePaymentApp(b ...*BillingProfile) *AppUpdate { +// RemoveBillingInvoiceTaxApp removes "billing_invoice_tax_app" edges to BillingInvoice entities. +func (au *AppUpdate) RemoveBillingInvoiceTaxApp(b ...*BillingInvoice) *AppUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return au.RemovePaymentAppIDs(ids...) + return au.RemoveBillingInvoiceTaxAppIDs(ids...) +} + +// ClearBillingInvoiceInvoicingApp clears all "billing_invoice_invoicing_app" edges to the BillingInvoice entity. +func (au *AppUpdate) ClearBillingInvoiceInvoicingApp() *AppUpdate { + au.mutation.ClearBillingInvoiceInvoicingApp() + return au +} + +// RemoveBillingInvoiceInvoicingAppIDs removes the "billing_invoice_invoicing_app" edge to BillingInvoice entities by IDs. +func (au *AppUpdate) RemoveBillingInvoiceInvoicingAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingInvoiceInvoicingAppIDs(ids...) + return au +} + +// RemoveBillingInvoiceInvoicingApp removes "billing_invoice_invoicing_app" edges to BillingInvoice entities. +func (au *AppUpdate) RemoveBillingInvoiceInvoicingApp(b ...*BillingInvoice) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.RemoveBillingInvoiceInvoicingAppIDs(ids...) +} + +// ClearBillingInvoicePaymentApp clears all "billing_invoice_payment_app" edges to the BillingInvoice entity. +func (au *AppUpdate) ClearBillingInvoicePaymentApp() *AppUpdate { + au.mutation.ClearBillingInvoicePaymentApp() + return au +} + +// RemoveBillingInvoicePaymentAppIDs removes the "billing_invoice_payment_app" edge to BillingInvoice entities by IDs. +func (au *AppUpdate) RemoveBillingInvoicePaymentAppIDs(ids ...string) *AppUpdate { + au.mutation.RemoveBillingInvoicePaymentAppIDs(ids...) + return au +} + +// RemoveBillingInvoicePaymentApp removes "billing_invoice_payment_app" edges to BillingInvoice entities. +func (au *AppUpdate) RemoveBillingInvoicePaymentApp(b ...*BillingInvoice) *AppUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return au.RemoveBillingInvoicePaymentAppIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. @@ -400,12 +509,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.TaxAppCleared() { + if au.mutation.BillingProfileTaxAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -413,12 +522,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedTaxAppIDs(); len(nodes) > 0 && !au.mutation.TaxAppCleared() { + if nodes := au.mutation.RemovedBillingProfileTaxAppIDs(); len(nodes) > 0 && !au.mutation.BillingProfileTaxAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -429,12 +538,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.TaxAppIDs(); len(nodes) > 0 { + if nodes := au.mutation.BillingProfileTaxAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -445,12 +554,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.InvoicingAppCleared() { + if au.mutation.BillingProfileInvoicingAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -458,12 +567,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedInvoicingAppIDs(); len(nodes) > 0 && !au.mutation.InvoicingAppCleared() { + if nodes := au.mutation.RemovedBillingProfileInvoicingAppIDs(); len(nodes) > 0 && !au.mutation.BillingProfileInvoicingAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -474,12 +583,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.InvoicingAppIDs(); len(nodes) > 0 { + if nodes := au.mutation.BillingProfileInvoicingAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -490,12 +599,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if au.mutation.PaymentAppCleared() { + if au.mutation.BillingProfilePaymentAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -503,12 +612,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.RemovedPaymentAppIDs(); len(nodes) > 0 && !au.mutation.PaymentAppCleared() { + if nodes := au.mutation.RemovedBillingProfilePaymentAppIDs(); len(nodes) > 0 && !au.mutation.BillingProfilePaymentAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -519,12 +628,12 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := au.mutation.PaymentAppIDs(); len(nodes) > 0 { + if nodes := au.mutation.BillingProfilePaymentAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -535,6 +644,141 @@ func (au *AppUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if au.mutation.BillingInvoiceTaxAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.RemovedBillingInvoiceTaxAppIDs(); len(nodes) > 0 && !au.mutation.BillingInvoiceTaxAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.BillingInvoiceTaxAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if au.mutation.BillingInvoiceInvoicingAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.RemovedBillingInvoiceInvoicingAppIDs(); len(nodes) > 0 && !au.mutation.BillingInvoiceInvoicingAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.BillingInvoiceInvoicingAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if au.mutation.BillingInvoicePaymentAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.RemovedBillingInvoicePaymentAppIDs(); len(nodes) > 0 && !au.mutation.BillingInvoicePaymentAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := au.mutation.BillingInvoicePaymentAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, au.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{app.Label} @@ -670,49 +914,94 @@ func (auo *AppUpdateOne) AddCustomerApps(a ...*AppCustomer) *AppUpdateOne { return auo.AddCustomerAppIDs(ids...) } -// AddTaxAppIDs adds the "tax_app" edge to the BillingProfile entity by IDs. -func (auo *AppUpdateOne) AddTaxAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.AddTaxAppIDs(ids...) +// AddBillingProfileTaxAppIDs adds the "billing_profile_tax_app" edge to the BillingProfile entity by IDs. +func (auo *AppUpdateOne) AddBillingProfileTaxAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingProfileTaxAppIDs(ids...) return auo } -// AddTaxApp adds the "tax_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) AddTaxApp(b ...*BillingProfile) *AppUpdateOne { +// AddBillingProfileTaxApp adds the "billing_profile_tax_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) AddBillingProfileTaxApp(b ...*BillingProfile) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.AddTaxAppIDs(ids...) + return auo.AddBillingProfileTaxAppIDs(ids...) } -// AddInvoicingAppIDs adds the "invoicing_app" edge to the BillingProfile entity by IDs. -func (auo *AppUpdateOne) AddInvoicingAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.AddInvoicingAppIDs(ids...) +// AddBillingProfileInvoicingAppIDs adds the "billing_profile_invoicing_app" edge to the BillingProfile entity by IDs. +func (auo *AppUpdateOne) AddBillingProfileInvoicingAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingProfileInvoicingAppIDs(ids...) return auo } -// AddInvoicingApp adds the "invoicing_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) AddInvoicingApp(b ...*BillingProfile) *AppUpdateOne { +// AddBillingProfileInvoicingApp adds the "billing_profile_invoicing_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) AddBillingProfileInvoicingApp(b ...*BillingProfile) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.AddInvoicingAppIDs(ids...) + return auo.AddBillingProfileInvoicingAppIDs(ids...) } -// AddPaymentAppIDs adds the "payment_app" edge to the BillingProfile entity by IDs. -func (auo *AppUpdateOne) AddPaymentAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.AddPaymentAppIDs(ids...) +// AddBillingProfilePaymentAppIDs adds the "billing_profile_payment_app" edge to the BillingProfile entity by IDs. +func (auo *AppUpdateOne) AddBillingProfilePaymentAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingProfilePaymentAppIDs(ids...) return auo } -// AddPaymentApp adds the "payment_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) AddPaymentApp(b ...*BillingProfile) *AppUpdateOne { +// AddBillingProfilePaymentApp adds the "billing_profile_payment_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) AddBillingProfilePaymentApp(b ...*BillingProfile) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.AddPaymentAppIDs(ids...) + return auo.AddBillingProfilePaymentAppIDs(ids...) +} + +// AddBillingInvoiceTaxAppIDs adds the "billing_invoice_tax_app" edge to the BillingInvoice entity by IDs. +func (auo *AppUpdateOne) AddBillingInvoiceTaxAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingInvoiceTaxAppIDs(ids...) + return auo +} + +// AddBillingInvoiceTaxApp adds the "billing_invoice_tax_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) AddBillingInvoiceTaxApp(b ...*BillingInvoice) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.AddBillingInvoiceTaxAppIDs(ids...) +} + +// AddBillingInvoiceInvoicingAppIDs adds the "billing_invoice_invoicing_app" edge to the BillingInvoice entity by IDs. +func (auo *AppUpdateOne) AddBillingInvoiceInvoicingAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingInvoiceInvoicingAppIDs(ids...) + return auo +} + +// AddBillingInvoiceInvoicingApp adds the "billing_invoice_invoicing_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) AddBillingInvoiceInvoicingApp(b ...*BillingInvoice) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.AddBillingInvoiceInvoicingAppIDs(ids...) +} + +// AddBillingInvoicePaymentAppIDs adds the "billing_invoice_payment_app" edge to the BillingInvoice entity by IDs. +func (auo *AppUpdateOne) AddBillingInvoicePaymentAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.AddBillingInvoicePaymentAppIDs(ids...) + return auo +} + +// AddBillingInvoicePaymentApp adds the "billing_invoice_payment_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) AddBillingInvoicePaymentApp(b ...*BillingInvoice) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.AddBillingInvoicePaymentAppIDs(ids...) } // Mutation returns the AppMutation object of the builder. @@ -741,67 +1030,130 @@ func (auo *AppUpdateOne) RemoveCustomerApps(a ...*AppCustomer) *AppUpdateOne { return auo.RemoveCustomerAppIDs(ids...) } -// ClearTaxApp clears all "tax_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) ClearTaxApp() *AppUpdateOne { - auo.mutation.ClearTaxApp() +// ClearBillingProfileTaxApp clears all "billing_profile_tax_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) ClearBillingProfileTaxApp() *AppUpdateOne { + auo.mutation.ClearBillingProfileTaxApp() + return auo +} + +// RemoveBillingProfileTaxAppIDs removes the "billing_profile_tax_app" edge to BillingProfile entities by IDs. +func (auo *AppUpdateOne) RemoveBillingProfileTaxAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingProfileTaxAppIDs(ids...) + return auo +} + +// RemoveBillingProfileTaxApp removes "billing_profile_tax_app" edges to BillingProfile entities. +func (auo *AppUpdateOne) RemoveBillingProfileTaxApp(b ...*BillingProfile) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.RemoveBillingProfileTaxAppIDs(ids...) +} + +// ClearBillingProfileInvoicingApp clears all "billing_profile_invoicing_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) ClearBillingProfileInvoicingApp() *AppUpdateOne { + auo.mutation.ClearBillingProfileInvoicingApp() return auo } -// RemoveTaxAppIDs removes the "tax_app" edge to BillingProfile entities by IDs. -func (auo *AppUpdateOne) RemoveTaxAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.RemoveTaxAppIDs(ids...) +// RemoveBillingProfileInvoicingAppIDs removes the "billing_profile_invoicing_app" edge to BillingProfile entities by IDs. +func (auo *AppUpdateOne) RemoveBillingProfileInvoicingAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingProfileInvoicingAppIDs(ids...) return auo } -// RemoveTaxApp removes "tax_app" edges to BillingProfile entities. -func (auo *AppUpdateOne) RemoveTaxApp(b ...*BillingProfile) *AppUpdateOne { +// RemoveBillingProfileInvoicingApp removes "billing_profile_invoicing_app" edges to BillingProfile entities. +func (auo *AppUpdateOne) RemoveBillingProfileInvoicingApp(b ...*BillingProfile) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.RemoveTaxAppIDs(ids...) + return auo.RemoveBillingProfileInvoicingAppIDs(ids...) } -// ClearInvoicingApp clears all "invoicing_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) ClearInvoicingApp() *AppUpdateOne { - auo.mutation.ClearInvoicingApp() +// ClearBillingProfilePaymentApp clears all "billing_profile_payment_app" edges to the BillingProfile entity. +func (auo *AppUpdateOne) ClearBillingProfilePaymentApp() *AppUpdateOne { + auo.mutation.ClearBillingProfilePaymentApp() return auo } -// RemoveInvoicingAppIDs removes the "invoicing_app" edge to BillingProfile entities by IDs. -func (auo *AppUpdateOne) RemoveInvoicingAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.RemoveInvoicingAppIDs(ids...) +// RemoveBillingProfilePaymentAppIDs removes the "billing_profile_payment_app" edge to BillingProfile entities by IDs. +func (auo *AppUpdateOne) RemoveBillingProfilePaymentAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingProfilePaymentAppIDs(ids...) return auo } -// RemoveInvoicingApp removes "invoicing_app" edges to BillingProfile entities. -func (auo *AppUpdateOne) RemoveInvoicingApp(b ...*BillingProfile) *AppUpdateOne { +// RemoveBillingProfilePaymentApp removes "billing_profile_payment_app" edges to BillingProfile entities. +func (auo *AppUpdateOne) RemoveBillingProfilePaymentApp(b ...*BillingProfile) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.RemoveInvoicingAppIDs(ids...) + return auo.RemoveBillingProfilePaymentAppIDs(ids...) } -// ClearPaymentApp clears all "payment_app" edges to the BillingProfile entity. -func (auo *AppUpdateOne) ClearPaymentApp() *AppUpdateOne { - auo.mutation.ClearPaymentApp() +// ClearBillingInvoiceTaxApp clears all "billing_invoice_tax_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) ClearBillingInvoiceTaxApp() *AppUpdateOne { + auo.mutation.ClearBillingInvoiceTaxApp() return auo } -// RemovePaymentAppIDs removes the "payment_app" edge to BillingProfile entities by IDs. -func (auo *AppUpdateOne) RemovePaymentAppIDs(ids ...string) *AppUpdateOne { - auo.mutation.RemovePaymentAppIDs(ids...) +// RemoveBillingInvoiceTaxAppIDs removes the "billing_invoice_tax_app" edge to BillingInvoice entities by IDs. +func (auo *AppUpdateOne) RemoveBillingInvoiceTaxAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingInvoiceTaxAppIDs(ids...) return auo } -// RemovePaymentApp removes "payment_app" edges to BillingProfile entities. -func (auo *AppUpdateOne) RemovePaymentApp(b ...*BillingProfile) *AppUpdateOne { +// RemoveBillingInvoiceTaxApp removes "billing_invoice_tax_app" edges to BillingInvoice entities. +func (auo *AppUpdateOne) RemoveBillingInvoiceTaxApp(b ...*BillingInvoice) *AppUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return auo.RemovePaymentAppIDs(ids...) + return auo.RemoveBillingInvoiceTaxAppIDs(ids...) +} + +// ClearBillingInvoiceInvoicingApp clears all "billing_invoice_invoicing_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) ClearBillingInvoiceInvoicingApp() *AppUpdateOne { + auo.mutation.ClearBillingInvoiceInvoicingApp() + return auo +} + +// RemoveBillingInvoiceInvoicingAppIDs removes the "billing_invoice_invoicing_app" edge to BillingInvoice entities by IDs. +func (auo *AppUpdateOne) RemoveBillingInvoiceInvoicingAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingInvoiceInvoicingAppIDs(ids...) + return auo +} + +// RemoveBillingInvoiceInvoicingApp removes "billing_invoice_invoicing_app" edges to BillingInvoice entities. +func (auo *AppUpdateOne) RemoveBillingInvoiceInvoicingApp(b ...*BillingInvoice) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.RemoveBillingInvoiceInvoicingAppIDs(ids...) +} + +// ClearBillingInvoicePaymentApp clears all "billing_invoice_payment_app" edges to the BillingInvoice entity. +func (auo *AppUpdateOne) ClearBillingInvoicePaymentApp() *AppUpdateOne { + auo.mutation.ClearBillingInvoicePaymentApp() + return auo +} + +// RemoveBillingInvoicePaymentAppIDs removes the "billing_invoice_payment_app" edge to BillingInvoice entities by IDs. +func (auo *AppUpdateOne) RemoveBillingInvoicePaymentAppIDs(ids ...string) *AppUpdateOne { + auo.mutation.RemoveBillingInvoicePaymentAppIDs(ids...) + return auo +} + +// RemoveBillingInvoicePaymentApp removes "billing_invoice_payment_app" edges to BillingInvoice entities. +func (auo *AppUpdateOne) RemoveBillingInvoicePaymentApp(b ...*BillingInvoice) *AppUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return auo.RemoveBillingInvoicePaymentAppIDs(ids...) } // Where appends a list predicates to the AppUpdate builder. @@ -954,12 +1306,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.TaxAppCleared() { + if auo.mutation.BillingProfileTaxAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -967,12 +1319,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedTaxAppIDs(); len(nodes) > 0 && !auo.mutation.TaxAppCleared() { + if nodes := auo.mutation.RemovedBillingProfileTaxAppIDs(); len(nodes) > 0 && !auo.mutation.BillingProfileTaxAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -983,12 +1335,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.TaxAppIDs(); len(nodes) > 0 { + if nodes := auo.mutation.BillingProfileTaxAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.TaxAppTable, - Columns: []string{app.TaxAppColumn}, + Table: app.BillingProfileTaxAppTable, + Columns: []string{app.BillingProfileTaxAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -999,12 +1351,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.InvoicingAppCleared() { + if auo.mutation.BillingProfileInvoicingAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1012,12 +1364,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedInvoicingAppIDs(); len(nodes) > 0 && !auo.mutation.InvoicingAppCleared() { + if nodes := auo.mutation.RemovedBillingProfileInvoicingAppIDs(); len(nodes) > 0 && !auo.mutation.BillingProfileInvoicingAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1028,12 +1380,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.InvoicingAppIDs(); len(nodes) > 0 { + if nodes := auo.mutation.BillingProfileInvoicingAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.InvoicingAppTable, - Columns: []string{app.InvoicingAppColumn}, + Table: app.BillingProfileInvoicingAppTable, + Columns: []string{app.BillingProfileInvoicingAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1044,12 +1396,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if auo.mutation.PaymentAppCleared() { + if auo.mutation.BillingProfilePaymentAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1057,12 +1409,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.RemovedPaymentAppIDs(); len(nodes) > 0 && !auo.mutation.PaymentAppCleared() { + if nodes := auo.mutation.RemovedBillingProfilePaymentAppIDs(); len(nodes) > 0 && !auo.mutation.BillingProfilePaymentAppCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1073,12 +1425,12 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := auo.mutation.PaymentAppIDs(); len(nodes) > 0 { + if nodes := auo.mutation.BillingProfilePaymentAppIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: app.PaymentAppTable, - Columns: []string{app.PaymentAppColumn}, + Table: app.BillingProfilePaymentAppTable, + Columns: []string{app.BillingProfilePaymentAppColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -1089,6 +1441,141 @@ func (auo *AppUpdateOne) sqlSave(ctx context.Context) (_node *App, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if auo.mutation.BillingInvoiceTaxAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.RemovedBillingInvoiceTaxAppIDs(); len(nodes) > 0 && !auo.mutation.BillingInvoiceTaxAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.BillingInvoiceTaxAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceTaxAppTable, + Columns: []string{app.BillingInvoiceTaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if auo.mutation.BillingInvoiceInvoicingAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.RemovedBillingInvoiceInvoicingAppIDs(); len(nodes) > 0 && !auo.mutation.BillingInvoiceInvoicingAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.BillingInvoiceInvoicingAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoiceInvoicingAppTable, + Columns: []string{app.BillingInvoiceInvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if auo.mutation.BillingInvoicePaymentAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.RemovedBillingInvoicePaymentAppIDs(); len(nodes) > 0 && !auo.mutation.BillingInvoicePaymentAppCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := auo.mutation.BillingInvoicePaymentAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: app.BillingInvoicePaymentAppTable, + Columns: []string{app.BillingInvoicePaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &App{config: auo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/openmeter/ent/db/billingcustomeroverride.go b/openmeter/ent/db/billingcustomeroverride.go index 85b66bb1f..4087eeaf7 100644 --- a/openmeter/ent/db/billingcustomeroverride.go +++ b/openmeter/ent/db/billingcustomeroverride.go @@ -35,8 +35,8 @@ type BillingCustomerOverride struct { BillingProfileID *string `json:"billing_profile_id,omitempty"` // CollectionAlignment holds the value of the "collection_alignment" field. CollectionAlignment *billingentity.AlignmentKind `json:"collection_alignment,omitempty"` - // ItemCollectionPeriod holds the value of the "item_collection_period" field. - ItemCollectionPeriod *datex.ISOString `json:"item_collection_period,omitempty"` + // LineCollectionPeriod holds the value of the "line_collection_period" field. + LineCollectionPeriod *datex.ISOString `json:"line_collection_period,omitempty"` // InvoiceAutoAdvance holds the value of the "invoice_auto_advance" field. InvoiceAutoAdvance *bool `json:"invoice_auto_advance,omitempty"` // InvoiceDraftPeriod holds the value of the "invoice_draft_period" field. @@ -91,7 +91,7 @@ func (*BillingCustomerOverride) scanValues(columns []string) ([]any, error) { switch columns[i] { case billingcustomeroverride.FieldInvoiceAutoAdvance: values[i] = new(sql.NullBool) - case billingcustomeroverride.FieldID, billingcustomeroverride.FieldNamespace, billingcustomeroverride.FieldCustomerID, billingcustomeroverride.FieldBillingProfileID, billingcustomeroverride.FieldCollectionAlignment, billingcustomeroverride.FieldItemCollectionPeriod, billingcustomeroverride.FieldInvoiceDraftPeriod, billingcustomeroverride.FieldInvoiceDueAfter, billingcustomeroverride.FieldInvoiceCollectionMethod: + case billingcustomeroverride.FieldID, billingcustomeroverride.FieldNamespace, billingcustomeroverride.FieldCustomerID, billingcustomeroverride.FieldBillingProfileID, billingcustomeroverride.FieldCollectionAlignment, billingcustomeroverride.FieldLineCollectionPeriod, billingcustomeroverride.FieldInvoiceDraftPeriod, billingcustomeroverride.FieldInvoiceDueAfter, billingcustomeroverride.FieldInvoiceCollectionMethod: values[i] = new(sql.NullString) case billingcustomeroverride.FieldCreatedAt, billingcustomeroverride.FieldUpdatedAt, billingcustomeroverride.FieldDeletedAt: values[i] = new(sql.NullTime) @@ -161,12 +161,12 @@ func (bco *BillingCustomerOverride) assignValues(columns []string, values []any) bco.CollectionAlignment = new(billingentity.AlignmentKind) *bco.CollectionAlignment = billingentity.AlignmentKind(value.String) } - case billingcustomeroverride.FieldItemCollectionPeriod: + case billingcustomeroverride.FieldLineCollectionPeriod: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field item_collection_period", values[i]) + return fmt.Errorf("unexpected type %T for field line_collection_period", values[i]) } else if value.Valid { - bco.ItemCollectionPeriod = new(datex.ISOString) - *bco.ItemCollectionPeriod = datex.ISOString(value.String) + bco.LineCollectionPeriod = new(datex.ISOString) + *bco.LineCollectionPeriod = datex.ISOString(value.String) } case billingcustomeroverride.FieldInvoiceAutoAdvance: if value, ok := values[i].(*sql.NullBool); !ok { @@ -269,8 +269,8 @@ func (bco *BillingCustomerOverride) String() string { builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") - if v := bco.ItemCollectionPeriod; v != nil { - builder.WriteString("item_collection_period=") + if v := bco.LineCollectionPeriod; v != nil { + builder.WriteString("line_collection_period=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") diff --git a/openmeter/ent/db/billingcustomeroverride/billingcustomeroverride.go b/openmeter/ent/db/billingcustomeroverride/billingcustomeroverride.go index 4b1187529..0b67da302 100644 --- a/openmeter/ent/db/billingcustomeroverride/billingcustomeroverride.go +++ b/openmeter/ent/db/billingcustomeroverride/billingcustomeroverride.go @@ -30,8 +30,8 @@ const ( FieldBillingProfileID = "billing_profile_id" // FieldCollectionAlignment holds the string denoting the collection_alignment field in the database. FieldCollectionAlignment = "collection_alignment" - // FieldItemCollectionPeriod holds the string denoting the item_collection_period field in the database. - FieldItemCollectionPeriod = "item_collection_period" + // FieldLineCollectionPeriod holds the string denoting the line_collection_period field in the database. + FieldLineCollectionPeriod = "line_collection_period" // FieldInvoiceAutoAdvance holds the string denoting the invoice_auto_advance field in the database. FieldInvoiceAutoAdvance = "invoice_auto_advance" // FieldInvoiceDraftPeriod holds the string denoting the invoice_draft_period field in the database. @@ -72,7 +72,7 @@ var Columns = []string{ FieldCustomerID, FieldBillingProfileID, FieldCollectionAlignment, - FieldItemCollectionPeriod, + FieldLineCollectionPeriod, FieldInvoiceAutoAdvance, FieldInvoiceDraftPeriod, FieldInvoiceDueAfter, @@ -165,9 +165,9 @@ func ByCollectionAlignment(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCollectionAlignment, opts...).ToFunc() } -// ByItemCollectionPeriod orders the results by the item_collection_period field. -func ByItemCollectionPeriod(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldItemCollectionPeriod, opts...).ToFunc() +// ByLineCollectionPeriod orders the results by the line_collection_period field. +func ByLineCollectionPeriod(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLineCollectionPeriod, opts...).ToFunc() } // ByInvoiceAutoAdvance orders the results by the invoice_auto_advance field. diff --git a/openmeter/ent/db/billingcustomeroverride/where.go b/openmeter/ent/db/billingcustomeroverride/where.go index 500517ce5..83b37ac06 100644 --- a/openmeter/ent/db/billingcustomeroverride/where.go +++ b/openmeter/ent/db/billingcustomeroverride/where.go @@ -97,10 +97,10 @@ func BillingProfileID(v string) predicate.BillingCustomerOverride { return predicate.BillingCustomerOverride(sql.FieldEQ(FieldBillingProfileID, v)) } -// ItemCollectionPeriod applies equality check predicate on the "item_collection_period" field. It's identical to ItemCollectionPeriodEQ. -func ItemCollectionPeriod(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriod applies equality check predicate on the "line_collection_period" field. It's identical to LineCollectionPeriodEQ. +func LineCollectionPeriod(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldEQ(FieldLineCollectionPeriod, vc)) } // InvoiceAutoAdvance applies equality check predicate on the "invoice_auto_advance" field. It's identical to InvoiceAutoAdvanceEQ. @@ -495,98 +495,98 @@ func CollectionAlignmentNotNil() predicate.BillingCustomerOverride { return predicate.BillingCustomerOverride(sql.FieldNotNull(FieldCollectionAlignment)) } -// ItemCollectionPeriodEQ applies the EQ predicate on the "item_collection_period" field. -func ItemCollectionPeriodEQ(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodEQ applies the EQ predicate on the "line_collection_period" field. +func LineCollectionPeriodEQ(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldEQ(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodNEQ applies the NEQ predicate on the "item_collection_period" field. -func ItemCollectionPeriodNEQ(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodNEQ applies the NEQ predicate on the "line_collection_period" field. +func LineCollectionPeriodNEQ(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldNEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldNEQ(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodIn applies the In predicate on the "item_collection_period" field. -func ItemCollectionPeriodIn(vs ...datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodIn applies the In predicate on the "line_collection_period" field. +func LineCollectionPeriodIn(vs ...datex.ISOString) predicate.BillingCustomerOverride { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } - return predicate.BillingCustomerOverride(sql.FieldIn(FieldItemCollectionPeriod, v...)) + return predicate.BillingCustomerOverride(sql.FieldIn(FieldLineCollectionPeriod, v...)) } -// ItemCollectionPeriodNotIn applies the NotIn predicate on the "item_collection_period" field. -func ItemCollectionPeriodNotIn(vs ...datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodNotIn applies the NotIn predicate on the "line_collection_period" field. +func LineCollectionPeriodNotIn(vs ...datex.ISOString) predicate.BillingCustomerOverride { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } - return predicate.BillingCustomerOverride(sql.FieldNotIn(FieldItemCollectionPeriod, v...)) + return predicate.BillingCustomerOverride(sql.FieldNotIn(FieldLineCollectionPeriod, v...)) } -// ItemCollectionPeriodGT applies the GT predicate on the "item_collection_period" field. -func ItemCollectionPeriodGT(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodGT applies the GT predicate on the "line_collection_period" field. +func LineCollectionPeriodGT(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldGT(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldGT(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodGTE applies the GTE predicate on the "item_collection_period" field. -func ItemCollectionPeriodGTE(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodGTE applies the GTE predicate on the "line_collection_period" field. +func LineCollectionPeriodGTE(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldGTE(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldGTE(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodLT applies the LT predicate on the "item_collection_period" field. -func ItemCollectionPeriodLT(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodLT applies the LT predicate on the "line_collection_period" field. +func LineCollectionPeriodLT(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldLT(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldLT(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodLTE applies the LTE predicate on the "item_collection_period" field. -func ItemCollectionPeriodLTE(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodLTE applies the LTE predicate on the "line_collection_period" field. +func LineCollectionPeriodLTE(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldLTE(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldLTE(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodContains applies the Contains predicate on the "item_collection_period" field. -func ItemCollectionPeriodContains(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodContains applies the Contains predicate on the "line_collection_period" field. +func LineCollectionPeriodContains(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldContains(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldContains(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodHasPrefix applies the HasPrefix predicate on the "item_collection_period" field. -func ItemCollectionPeriodHasPrefix(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodHasPrefix applies the HasPrefix predicate on the "line_collection_period" field. +func LineCollectionPeriodHasPrefix(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldHasPrefix(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldHasPrefix(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodHasSuffix applies the HasSuffix predicate on the "item_collection_period" field. -func ItemCollectionPeriodHasSuffix(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodHasSuffix applies the HasSuffix predicate on the "line_collection_period" field. +func LineCollectionPeriodHasSuffix(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldHasSuffix(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldHasSuffix(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodIsNil applies the IsNil predicate on the "item_collection_period" field. -func ItemCollectionPeriodIsNil() predicate.BillingCustomerOverride { - return predicate.BillingCustomerOverride(sql.FieldIsNull(FieldItemCollectionPeriod)) +// LineCollectionPeriodIsNil applies the IsNil predicate on the "line_collection_period" field. +func LineCollectionPeriodIsNil() predicate.BillingCustomerOverride { + return predicate.BillingCustomerOverride(sql.FieldIsNull(FieldLineCollectionPeriod)) } -// ItemCollectionPeriodNotNil applies the NotNil predicate on the "item_collection_period" field. -func ItemCollectionPeriodNotNil() predicate.BillingCustomerOverride { - return predicate.BillingCustomerOverride(sql.FieldNotNull(FieldItemCollectionPeriod)) +// LineCollectionPeriodNotNil applies the NotNil predicate on the "line_collection_period" field. +func LineCollectionPeriodNotNil() predicate.BillingCustomerOverride { + return predicate.BillingCustomerOverride(sql.FieldNotNull(FieldLineCollectionPeriod)) } -// ItemCollectionPeriodEqualFold applies the EqualFold predicate on the "item_collection_period" field. -func ItemCollectionPeriodEqualFold(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodEqualFold applies the EqualFold predicate on the "line_collection_period" field. +func LineCollectionPeriodEqualFold(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldEqualFold(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldEqualFold(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodContainsFold applies the ContainsFold predicate on the "item_collection_period" field. -func ItemCollectionPeriodContainsFold(v datex.ISOString) predicate.BillingCustomerOverride { +// LineCollectionPeriodContainsFold applies the ContainsFold predicate on the "line_collection_period" field. +func LineCollectionPeriodContainsFold(v datex.ISOString) predicate.BillingCustomerOverride { vc := string(v) - return predicate.BillingCustomerOverride(sql.FieldContainsFold(FieldItemCollectionPeriod, vc)) + return predicate.BillingCustomerOverride(sql.FieldContainsFold(FieldLineCollectionPeriod, vc)) } // InvoiceAutoAdvanceEQ applies the EQ predicate on the "invoice_auto_advance" field. diff --git a/openmeter/ent/db/billingcustomeroverride_create.go b/openmeter/ent/db/billingcustomeroverride_create.go index 3f25b19df..e0198c326 100644 --- a/openmeter/ent/db/billingcustomeroverride_create.go +++ b/openmeter/ent/db/billingcustomeroverride_create.go @@ -109,16 +109,16 @@ func (bcoc *BillingCustomerOverrideCreate) SetNillableCollectionAlignment(bk *bi return bcoc } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bcoc *BillingCustomerOverrideCreate) SetItemCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideCreate { - bcoc.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bcoc *BillingCustomerOverrideCreate) SetLineCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideCreate { + bcoc.mutation.SetLineCollectionPeriod(ds) return bcoc } -// SetNillableItemCollectionPeriod sets the "item_collection_period" field if the given value is not nil. -func (bcoc *BillingCustomerOverrideCreate) SetNillableItemCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideCreate { +// SetNillableLineCollectionPeriod sets the "line_collection_period" field if the given value is not nil. +func (bcoc *BillingCustomerOverrideCreate) SetNillableLineCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideCreate { if ds != nil { - bcoc.SetItemCollectionPeriod(*ds) + bcoc.SetLineCollectionPeriod(*ds) } return bcoc } @@ -340,9 +340,9 @@ func (bcoc *BillingCustomerOverrideCreate) createSpec() (*BillingCustomerOverrid _spec.SetField(billingcustomeroverride.FieldCollectionAlignment, field.TypeEnum, value) _node.CollectionAlignment = &value } - if value, ok := bcoc.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingcustomeroverride.FieldItemCollectionPeriod, field.TypeString, value) - _node.ItemCollectionPeriod = &value + if value, ok := bcoc.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingcustomeroverride.FieldLineCollectionPeriod, field.TypeString, value) + _node.LineCollectionPeriod = &value } if value, ok := bcoc.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingcustomeroverride.FieldInvoiceAutoAdvance, field.TypeBool, value) @@ -512,21 +512,21 @@ func (u *BillingCustomerOverrideUpsert) ClearCollectionAlignment() *BillingCusto return u } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsert) SetItemCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsert { - u.Set(billingcustomeroverride.FieldItemCollectionPeriod, v) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsert) SetLineCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsert { + u.Set(billingcustomeroverride.FieldLineCollectionPeriod, v) return u } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingCustomerOverrideUpsert) UpdateItemCollectionPeriod() *BillingCustomerOverrideUpsert { - u.SetExcluded(billingcustomeroverride.FieldItemCollectionPeriod) +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingCustomerOverrideUpsert) UpdateLineCollectionPeriod() *BillingCustomerOverrideUpsert { + u.SetExcluded(billingcustomeroverride.FieldLineCollectionPeriod) return u } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsert) ClearItemCollectionPeriod() *BillingCustomerOverrideUpsert { - u.SetNull(billingcustomeroverride.FieldItemCollectionPeriod) +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsert) ClearLineCollectionPeriod() *BillingCustomerOverrideUpsert { + u.SetNull(billingcustomeroverride.FieldLineCollectionPeriod) return u } @@ -736,24 +736,24 @@ func (u *BillingCustomerOverrideUpsertOne) ClearCollectionAlignment() *BillingCu }) } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsertOne) SetItemCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsertOne { +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsertOne) SetLineCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsertOne { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.SetItemCollectionPeriod(v) + s.SetLineCollectionPeriod(v) }) } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingCustomerOverrideUpsertOne) UpdateItemCollectionPeriod() *BillingCustomerOverrideUpsertOne { +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingCustomerOverrideUpsertOne) UpdateLineCollectionPeriod() *BillingCustomerOverrideUpsertOne { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.UpdateItemCollectionPeriod() + s.UpdateLineCollectionPeriod() }) } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsertOne) ClearItemCollectionPeriod() *BillingCustomerOverrideUpsertOne { +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsertOne) ClearLineCollectionPeriod() *BillingCustomerOverrideUpsertOne { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.ClearItemCollectionPeriod() + s.ClearLineCollectionPeriod() }) } @@ -1142,24 +1142,24 @@ func (u *BillingCustomerOverrideUpsertBulk) ClearCollectionAlignment() *BillingC }) } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsertBulk) SetItemCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsertBulk { +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsertBulk) SetLineCollectionPeriod(v datex.ISOString) *BillingCustomerOverrideUpsertBulk { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.SetItemCollectionPeriod(v) + s.SetLineCollectionPeriod(v) }) } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingCustomerOverrideUpsertBulk) UpdateItemCollectionPeriod() *BillingCustomerOverrideUpsertBulk { +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingCustomerOverrideUpsertBulk) UpdateLineCollectionPeriod() *BillingCustomerOverrideUpsertBulk { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.UpdateItemCollectionPeriod() + s.UpdateLineCollectionPeriod() }) } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (u *BillingCustomerOverrideUpsertBulk) ClearItemCollectionPeriod() *BillingCustomerOverrideUpsertBulk { +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (u *BillingCustomerOverrideUpsertBulk) ClearLineCollectionPeriod() *BillingCustomerOverrideUpsertBulk { return u.Update(func(s *BillingCustomerOverrideUpsert) { - s.ClearItemCollectionPeriod() + s.ClearLineCollectionPeriod() }) } diff --git a/openmeter/ent/db/billingcustomeroverride_update.go b/openmeter/ent/db/billingcustomeroverride_update.go index 38cee0e07..c1ad7bbbe 100644 --- a/openmeter/ent/db/billingcustomeroverride_update.go +++ b/openmeter/ent/db/billingcustomeroverride_update.go @@ -97,23 +97,23 @@ func (bcou *BillingCustomerOverrideUpdate) ClearCollectionAlignment() *BillingCu return bcou } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bcou *BillingCustomerOverrideUpdate) SetItemCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideUpdate { - bcou.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bcou *BillingCustomerOverrideUpdate) SetLineCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideUpdate { + bcou.mutation.SetLineCollectionPeriod(ds) return bcou } -// SetNillableItemCollectionPeriod sets the "item_collection_period" field if the given value is not nil. -func (bcou *BillingCustomerOverrideUpdate) SetNillableItemCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideUpdate { +// SetNillableLineCollectionPeriod sets the "line_collection_period" field if the given value is not nil. +func (bcou *BillingCustomerOverrideUpdate) SetNillableLineCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideUpdate { if ds != nil { - bcou.SetItemCollectionPeriod(*ds) + bcou.SetLineCollectionPeriod(*ds) } return bcou } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (bcou *BillingCustomerOverrideUpdate) ClearItemCollectionPeriod() *BillingCustomerOverrideUpdate { - bcou.mutation.ClearItemCollectionPeriod() +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (bcou *BillingCustomerOverrideUpdate) ClearLineCollectionPeriod() *BillingCustomerOverrideUpdate { + bcou.mutation.ClearLineCollectionPeriod() return bcou } @@ -294,11 +294,11 @@ func (bcou *BillingCustomerOverrideUpdate) sqlSave(ctx context.Context) (n int, if bcou.mutation.CollectionAlignmentCleared() { _spec.ClearField(billingcustomeroverride.FieldCollectionAlignment, field.TypeEnum) } - if value, ok := bcou.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingcustomeroverride.FieldItemCollectionPeriod, field.TypeString, value) + if value, ok := bcou.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingcustomeroverride.FieldLineCollectionPeriod, field.TypeString, value) } - if bcou.mutation.ItemCollectionPeriodCleared() { - _spec.ClearField(billingcustomeroverride.FieldItemCollectionPeriod, field.TypeString) + if bcou.mutation.LineCollectionPeriodCleared() { + _spec.ClearField(billingcustomeroverride.FieldLineCollectionPeriod, field.TypeString) } if value, ok := bcou.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingcustomeroverride.FieldInvoiceAutoAdvance, field.TypeBool, value) @@ -439,23 +439,23 @@ func (bcouo *BillingCustomerOverrideUpdateOne) ClearCollectionAlignment() *Billi return bcouo } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bcouo *BillingCustomerOverrideUpdateOne) SetItemCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideUpdateOne { - bcouo.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bcouo *BillingCustomerOverrideUpdateOne) SetLineCollectionPeriod(ds datex.ISOString) *BillingCustomerOverrideUpdateOne { + bcouo.mutation.SetLineCollectionPeriod(ds) return bcouo } -// SetNillableItemCollectionPeriod sets the "item_collection_period" field if the given value is not nil. -func (bcouo *BillingCustomerOverrideUpdateOne) SetNillableItemCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideUpdateOne { +// SetNillableLineCollectionPeriod sets the "line_collection_period" field if the given value is not nil. +func (bcouo *BillingCustomerOverrideUpdateOne) SetNillableLineCollectionPeriod(ds *datex.ISOString) *BillingCustomerOverrideUpdateOne { if ds != nil { - bcouo.SetItemCollectionPeriod(*ds) + bcouo.SetLineCollectionPeriod(*ds) } return bcouo } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (bcouo *BillingCustomerOverrideUpdateOne) ClearItemCollectionPeriod() *BillingCustomerOverrideUpdateOne { - bcouo.mutation.ClearItemCollectionPeriod() +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (bcouo *BillingCustomerOverrideUpdateOne) ClearLineCollectionPeriod() *BillingCustomerOverrideUpdateOne { + bcouo.mutation.ClearLineCollectionPeriod() return bcouo } @@ -666,11 +666,11 @@ func (bcouo *BillingCustomerOverrideUpdateOne) sqlSave(ctx context.Context) (_no if bcouo.mutation.CollectionAlignmentCleared() { _spec.ClearField(billingcustomeroverride.FieldCollectionAlignment, field.TypeEnum) } - if value, ok := bcouo.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingcustomeroverride.FieldItemCollectionPeriod, field.TypeString, value) + if value, ok := bcouo.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingcustomeroverride.FieldLineCollectionPeriod, field.TypeString, value) } - if bcouo.mutation.ItemCollectionPeriodCleared() { - _spec.ClearField(billingcustomeroverride.FieldItemCollectionPeriod, field.TypeString) + if bcouo.mutation.LineCollectionPeriodCleared() { + _spec.ClearField(billingcustomeroverride.FieldLineCollectionPeriod, field.TypeString) } if value, ok := bcouo.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingcustomeroverride.FieldInvoiceAutoAdvance, field.TypeBool, value) diff --git a/openmeter/ent/db/billinginvoice.go b/openmeter/ent/db/billinginvoice.go index 718d3975f..d0e45241d 100644 --- a/openmeter/ent/db/billinginvoice.go +++ b/openmeter/ent/db/billinginvoice.go @@ -11,9 +11,14 @@ import ( "entgo.io/ent" "entgo.io/ent/dialect/sql" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/customer" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/timezone" ) // BillingInvoice is the model entity for the BillingInvoice schema. @@ -23,36 +28,82 @@ type BillingInvoice struct { ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` + // Metadata holds the value of the "metadata" field. + Metadata map[string]string `json:"metadata,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` - // Metadata holds the value of the "metadata" field. - Metadata map[string]string `json:"metadata,omitempty"` - // Series holds the value of the "series" field. - Series *string `json:"series,omitempty"` - // Code holds the value of the "code" field. - Code *string `json:"code,omitempty"` + // SupplierAddressCountry holds the value of the "supplier_address_country" field. + SupplierAddressCountry *models.CountryCode `json:"supplier_address_country,omitempty"` + // SupplierAddressPostalCode holds the value of the "supplier_address_postal_code" field. + SupplierAddressPostalCode *string `json:"supplier_address_postal_code,omitempty"` + // SupplierAddressState holds the value of the "supplier_address_state" field. + SupplierAddressState *string `json:"supplier_address_state,omitempty"` + // SupplierAddressCity holds the value of the "supplier_address_city" field. + SupplierAddressCity *string `json:"supplier_address_city,omitempty"` + // SupplierAddressLine1 holds the value of the "supplier_address_line1" field. + SupplierAddressLine1 *string `json:"supplier_address_line1,omitempty"` + // SupplierAddressLine2 holds the value of the "supplier_address_line2" field. + SupplierAddressLine2 *string `json:"supplier_address_line2,omitempty"` + // SupplierAddressPhoneNumber holds the value of the "supplier_address_phone_number" field. + SupplierAddressPhoneNumber *string `json:"supplier_address_phone_number,omitempty"` + // CustomerAddressCountry holds the value of the "customer_address_country" field. + CustomerAddressCountry *models.CountryCode `json:"customer_address_country,omitempty"` + // CustomerAddressPostalCode holds the value of the "customer_address_postal_code" field. + CustomerAddressPostalCode *string `json:"customer_address_postal_code,omitempty"` + // CustomerAddressState holds the value of the "customer_address_state" field. + CustomerAddressState *string `json:"customer_address_state,omitempty"` + // CustomerAddressCity holds the value of the "customer_address_city" field. + CustomerAddressCity *string `json:"customer_address_city,omitempty"` + // CustomerAddressLine1 holds the value of the "customer_address_line1" field. + CustomerAddressLine1 *string `json:"customer_address_line1,omitempty"` + // CustomerAddressLine2 holds the value of the "customer_address_line2" field. + CustomerAddressLine2 *string `json:"customer_address_line2,omitempty"` + // CustomerAddressPhoneNumber holds the value of the "customer_address_phone_number" field. + CustomerAddressPhoneNumber *string `json:"customer_address_phone_number,omitempty"` + // SupplierName holds the value of the "supplier_name" field. + SupplierName string `json:"supplier_name,omitempty"` + // SupplierTaxCode holds the value of the "supplier_tax_code" field. + SupplierTaxCode *string `json:"supplier_tax_code,omitempty"` + // CustomerName holds the value of the "customer_name" field. + CustomerName string `json:"customer_name,omitempty"` + // CustomerTimezone holds the value of the "customer_timezone" field. + CustomerTimezone *timezone.Timezone `json:"customer_timezone,omitempty"` + // Number holds the value of the "number" field. + Number *string `json:"number,omitempty"` + // Type holds the value of the "type" field. + Type billingentity.InvoiceType `json:"type,omitempty"` + // Description holds the value of the "description" field. + Description *string `json:"description,omitempty"` // CustomerID holds the value of the "customer_id" field. CustomerID string `json:"customer_id,omitempty"` - // BillingProfileID holds the value of the "billing_profile_id" field. - BillingProfileID string `json:"billing_profile_id,omitempty"` + // SourceBillingProfileID holds the value of the "source_billing_profile_id" field. + SourceBillingProfileID string `json:"source_billing_profile_id,omitempty"` // VoidedAt holds the value of the "voided_at" field. - VoidedAt time.Time `json:"voided_at,omitempty"` + VoidedAt *time.Time `json:"voided_at,omitempty"` + // IssuedAt holds the value of the "issued_at" field. + IssuedAt *time.Time `json:"issued_at,omitempty"` // Currency holds the value of the "currency" field. - Currency string `json:"currency,omitempty"` - // DueDate holds the value of the "due_date" field. - DueDate time.Time `json:"due_date,omitempty"` + Currency currencyx.Code `json:"currency,omitempty"` + // DueAt holds the value of the "due_at" field. + DueAt *time.Time `json:"due_at,omitempty"` // Status holds the value of the "status" field. Status billingentity.InvoiceStatus `json:"status,omitempty"` // WorkflowConfigID holds the value of the "workflow_config_id" field. WorkflowConfigID string `json:"workflow_config_id,omitempty"` + // TaxAppID holds the value of the "tax_app_id" field. + TaxAppID string `json:"tax_app_id,omitempty"` + // InvoicingAppID holds the value of the "invoicing_app_id" field. + InvoicingAppID string `json:"invoicing_app_id,omitempty"` + // PaymentAppID holds the value of the "payment_app_id" field. + PaymentAppID string `json:"payment_app_id,omitempty"` // PeriodStart holds the value of the "period_start" field. - PeriodStart time.Time `json:"period_start,omitempty"` + PeriodStart *time.Time `json:"period_start,omitempty"` // PeriodEnd holds the value of the "period_end" field. - PeriodEnd time.Time `json:"period_end,omitempty"` + PeriodEnd *time.Time `json:"period_end,omitempty"` // Edges holds the relations/edges for other nodes in the graph. // The values are being populated by the BillingInvoiceQuery when eager-loading is set. Edges BillingInvoiceEdges `json:"edges"` @@ -61,26 +112,34 @@ type BillingInvoice struct { // BillingInvoiceEdges holds the relations/edges for other nodes in the graph. type BillingInvoiceEdges struct { - // BillingProfile holds the value of the billing_profile edge. - BillingProfile *BillingProfile `json:"billing_profile,omitempty"` + // SourceBillingProfile holds the value of the source_billing_profile edge. + SourceBillingProfile *BillingProfile `json:"source_billing_profile,omitempty"` // BillingWorkflowConfig holds the value of the billing_workflow_config edge. BillingWorkflowConfig *BillingWorkflowConfig `json:"billing_workflow_config,omitempty"` - // BillingInvoiceItems holds the value of the billing_invoice_items edge. - BillingInvoiceItems []*BillingInvoiceItem `json:"billing_invoice_items,omitempty"` + // BillingInvoiceLines holds the value of the billing_invoice_lines edge. + BillingInvoiceLines []*BillingInvoiceLine `json:"billing_invoice_lines,omitempty"` + // BillingInvoiceCustomer holds the value of the billing_invoice_customer edge. + BillingInvoiceCustomer *Customer `json:"billing_invoice_customer,omitempty"` + // TaxApp holds the value of the tax_app edge. + TaxApp *App `json:"tax_app,omitempty"` + // InvoicingApp holds the value of the invoicing_app edge. + InvoicingApp *App `json:"invoicing_app,omitempty"` + // PaymentApp holds the value of the payment_app edge. + PaymentApp *App `json:"payment_app,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [7]bool } -// BillingProfileOrErr returns the BillingProfile value or an error if the edge +// SourceBillingProfileOrErr returns the SourceBillingProfile value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. -func (e BillingInvoiceEdges) BillingProfileOrErr() (*BillingProfile, error) { - if e.BillingProfile != nil { - return e.BillingProfile, nil +func (e BillingInvoiceEdges) SourceBillingProfileOrErr() (*BillingProfile, error) { + if e.SourceBillingProfile != nil { + return e.SourceBillingProfile, nil } else if e.loadedTypes[0] { return nil, &NotFoundError{label: billingprofile.Label} } - return nil, &NotLoadedError{edge: "billing_profile"} + return nil, &NotLoadedError{edge: "source_billing_profile"} } // BillingWorkflowConfigOrErr returns the BillingWorkflowConfig value or an error if the edge @@ -94,13 +153,57 @@ func (e BillingInvoiceEdges) BillingWorkflowConfigOrErr() (*BillingWorkflowConfi return nil, &NotLoadedError{edge: "billing_workflow_config"} } -// BillingInvoiceItemsOrErr returns the BillingInvoiceItems value or an error if the edge +// BillingInvoiceLinesOrErr returns the BillingInvoiceLines value or an error if the edge // was not loaded in eager-loading. -func (e BillingInvoiceEdges) BillingInvoiceItemsOrErr() ([]*BillingInvoiceItem, error) { +func (e BillingInvoiceEdges) BillingInvoiceLinesOrErr() ([]*BillingInvoiceLine, error) { if e.loadedTypes[2] { - return e.BillingInvoiceItems, nil + return e.BillingInvoiceLines, nil + } + return nil, &NotLoadedError{edge: "billing_invoice_lines"} +} + +// BillingInvoiceCustomerOrErr returns the BillingInvoiceCustomer value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BillingInvoiceEdges) BillingInvoiceCustomerOrErr() (*Customer, error) { + if e.BillingInvoiceCustomer != nil { + return e.BillingInvoiceCustomer, nil + } else if e.loadedTypes[3] { + return nil, &NotFoundError{label: customer.Label} + } + return nil, &NotLoadedError{edge: "billing_invoice_customer"} +} + +// TaxAppOrErr returns the TaxApp value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BillingInvoiceEdges) TaxAppOrErr() (*App, error) { + if e.TaxApp != nil { + return e.TaxApp, nil + } else if e.loadedTypes[4] { + return nil, &NotFoundError{label: app.Label} } - return nil, &NotLoadedError{edge: "billing_invoice_items"} + return nil, &NotLoadedError{edge: "tax_app"} +} + +// InvoicingAppOrErr returns the InvoicingApp value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BillingInvoiceEdges) InvoicingAppOrErr() (*App, error) { + if e.InvoicingApp != nil { + return e.InvoicingApp, nil + } else if e.loadedTypes[5] { + return nil, &NotFoundError{label: app.Label} + } + return nil, &NotLoadedError{edge: "invoicing_app"} +} + +// PaymentAppOrErr returns the PaymentApp value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BillingInvoiceEdges) PaymentAppOrErr() (*App, error) { + if e.PaymentApp != nil { + return e.PaymentApp, nil + } else if e.loadedTypes[6] { + return nil, &NotFoundError{label: app.Label} + } + return nil, &NotLoadedError{edge: "payment_app"} } // scanValues returns the types for scanning values from sql.Rows. @@ -110,9 +213,9 @@ func (*BillingInvoice) scanValues(columns []string) ([]any, error) { switch columns[i] { case billinginvoice.FieldMetadata: values[i] = new([]byte) - case billinginvoice.FieldID, billinginvoice.FieldNamespace, billinginvoice.FieldSeries, billinginvoice.FieldCode, billinginvoice.FieldCustomerID, billinginvoice.FieldBillingProfileID, billinginvoice.FieldCurrency, billinginvoice.FieldStatus, billinginvoice.FieldWorkflowConfigID: + case billinginvoice.FieldID, billinginvoice.FieldNamespace, billinginvoice.FieldSupplierAddressCountry, billinginvoice.FieldSupplierAddressPostalCode, billinginvoice.FieldSupplierAddressState, billinginvoice.FieldSupplierAddressCity, billinginvoice.FieldSupplierAddressLine1, billinginvoice.FieldSupplierAddressLine2, billinginvoice.FieldSupplierAddressPhoneNumber, billinginvoice.FieldCustomerAddressCountry, billinginvoice.FieldCustomerAddressPostalCode, billinginvoice.FieldCustomerAddressState, billinginvoice.FieldCustomerAddressCity, billinginvoice.FieldCustomerAddressLine1, billinginvoice.FieldCustomerAddressLine2, billinginvoice.FieldCustomerAddressPhoneNumber, billinginvoice.FieldSupplierName, billinginvoice.FieldSupplierTaxCode, billinginvoice.FieldCustomerName, billinginvoice.FieldCustomerTimezone, billinginvoice.FieldNumber, billinginvoice.FieldType, billinginvoice.FieldDescription, billinginvoice.FieldCustomerID, billinginvoice.FieldSourceBillingProfileID, billinginvoice.FieldCurrency, billinginvoice.FieldStatus, billinginvoice.FieldWorkflowConfigID, billinginvoice.FieldTaxAppID, billinginvoice.FieldInvoicingAppID, billinginvoice.FieldPaymentAppID: values[i] = new(sql.NullString) - case billinginvoice.FieldCreatedAt, billinginvoice.FieldUpdatedAt, billinginvoice.FieldDeletedAt, billinginvoice.FieldVoidedAt, billinginvoice.FieldDueDate, billinginvoice.FieldPeriodStart, billinginvoice.FieldPeriodEnd: + case billinginvoice.FieldCreatedAt, billinginvoice.FieldUpdatedAt, billinginvoice.FieldDeletedAt, billinginvoice.FieldVoidedAt, billinginvoice.FieldIssuedAt, billinginvoice.FieldDueAt, billinginvoice.FieldPeriodStart, billinginvoice.FieldPeriodEnd: values[i] = new(sql.NullTime) default: values[i] = new(sql.UnknownType) @@ -141,6 +244,14 @@ func (bi *BillingInvoice) assignValues(columns []string, values []any) error { } else if value.Valid { bi.Namespace = value.String } + case billinginvoice.FieldMetadata: + if value, ok := values[i].(*[]byte); !ok { + return fmt.Errorf("unexpected type %T for field metadata", values[i]) + } else if value != nil && len(*value) > 0 { + if err := json.Unmarshal(*value, &bi.Metadata); err != nil { + return fmt.Errorf("unmarshal field metadata: %w", err) + } + } case billinginvoice.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) @@ -160,27 +271,149 @@ func (bi *BillingInvoice) assignValues(columns []string, values []any) error { bi.DeletedAt = new(time.Time) *bi.DeletedAt = value.Time } - case billinginvoice.FieldMetadata: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field metadata", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &bi.Metadata); err != nil { - return fmt.Errorf("unmarshal field metadata: %w", err) - } + case billinginvoice.FieldSupplierAddressCountry: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_address_country", values[i]) + } else if value.Valid { + bi.SupplierAddressCountry = new(models.CountryCode) + *bi.SupplierAddressCountry = models.CountryCode(value.String) + } + case billinginvoice.FieldSupplierAddressPostalCode: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_address_postal_code", values[i]) + } else if value.Valid { + bi.SupplierAddressPostalCode = new(string) + *bi.SupplierAddressPostalCode = value.String } - case billinginvoice.FieldSeries: + case billinginvoice.FieldSupplierAddressState: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field series", values[i]) + return fmt.Errorf("unexpected type %T for field supplier_address_state", values[i]) } else if value.Valid { - bi.Series = new(string) - *bi.Series = value.String + bi.SupplierAddressState = new(string) + *bi.SupplierAddressState = value.String } - case billinginvoice.FieldCode: + case billinginvoice.FieldSupplierAddressCity: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field code", values[i]) + return fmt.Errorf("unexpected type %T for field supplier_address_city", values[i]) } else if value.Valid { - bi.Code = new(string) - *bi.Code = value.String + bi.SupplierAddressCity = new(string) + *bi.SupplierAddressCity = value.String + } + case billinginvoice.FieldSupplierAddressLine1: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_address_line1", values[i]) + } else if value.Valid { + bi.SupplierAddressLine1 = new(string) + *bi.SupplierAddressLine1 = value.String + } + case billinginvoice.FieldSupplierAddressLine2: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_address_line2", values[i]) + } else if value.Valid { + bi.SupplierAddressLine2 = new(string) + *bi.SupplierAddressLine2 = value.String + } + case billinginvoice.FieldSupplierAddressPhoneNumber: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_address_phone_number", values[i]) + } else if value.Valid { + bi.SupplierAddressPhoneNumber = new(string) + *bi.SupplierAddressPhoneNumber = value.String + } + case billinginvoice.FieldCustomerAddressCountry: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_country", values[i]) + } else if value.Valid { + bi.CustomerAddressCountry = new(models.CountryCode) + *bi.CustomerAddressCountry = models.CountryCode(value.String) + } + case billinginvoice.FieldCustomerAddressPostalCode: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_postal_code", values[i]) + } else if value.Valid { + bi.CustomerAddressPostalCode = new(string) + *bi.CustomerAddressPostalCode = value.String + } + case billinginvoice.FieldCustomerAddressState: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_state", values[i]) + } else if value.Valid { + bi.CustomerAddressState = new(string) + *bi.CustomerAddressState = value.String + } + case billinginvoice.FieldCustomerAddressCity: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_city", values[i]) + } else if value.Valid { + bi.CustomerAddressCity = new(string) + *bi.CustomerAddressCity = value.String + } + case billinginvoice.FieldCustomerAddressLine1: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_line1", values[i]) + } else if value.Valid { + bi.CustomerAddressLine1 = new(string) + *bi.CustomerAddressLine1 = value.String + } + case billinginvoice.FieldCustomerAddressLine2: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_line2", values[i]) + } else if value.Valid { + bi.CustomerAddressLine2 = new(string) + *bi.CustomerAddressLine2 = value.String + } + case billinginvoice.FieldCustomerAddressPhoneNumber: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_address_phone_number", values[i]) + } else if value.Valid { + bi.CustomerAddressPhoneNumber = new(string) + *bi.CustomerAddressPhoneNumber = value.String + } + case billinginvoice.FieldSupplierName: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_name", values[i]) + } else if value.Valid { + bi.SupplierName = value.String + } + case billinginvoice.FieldSupplierTaxCode: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field supplier_tax_code", values[i]) + } else if value.Valid { + bi.SupplierTaxCode = new(string) + *bi.SupplierTaxCode = value.String + } + case billinginvoice.FieldCustomerName: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_name", values[i]) + } else if value.Valid { + bi.CustomerName = value.String + } + case billinginvoice.FieldCustomerTimezone: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field customer_timezone", values[i]) + } else if value.Valid { + bi.CustomerTimezone = new(timezone.Timezone) + *bi.CustomerTimezone = timezone.Timezone(value.String) + } + case billinginvoice.FieldNumber: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field number", values[i]) + } else if value.Valid { + bi.Number = new(string) + *bi.Number = value.String + } + case billinginvoice.FieldType: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field type", values[i]) + } else if value.Valid { + bi.Type = billingentity.InvoiceType(value.String) + } + case billinginvoice.FieldDescription: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field description", values[i]) + } else if value.Valid { + bi.Description = new(string) + *bi.Description = value.String } case billinginvoice.FieldCustomerID: if value, ok := values[i].(*sql.NullString); !ok { @@ -188,29 +421,38 @@ func (bi *BillingInvoice) assignValues(columns []string, values []any) error { } else if value.Valid { bi.CustomerID = value.String } - case billinginvoice.FieldBillingProfileID: + case billinginvoice.FieldSourceBillingProfileID: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field billing_profile_id", values[i]) + return fmt.Errorf("unexpected type %T for field source_billing_profile_id", values[i]) } else if value.Valid { - bi.BillingProfileID = value.String + bi.SourceBillingProfileID = value.String } case billinginvoice.FieldVoidedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field voided_at", values[i]) } else if value.Valid { - bi.VoidedAt = value.Time + bi.VoidedAt = new(time.Time) + *bi.VoidedAt = value.Time + } + case billinginvoice.FieldIssuedAt: + if value, ok := values[i].(*sql.NullTime); !ok { + return fmt.Errorf("unexpected type %T for field issued_at", values[i]) + } else if value.Valid { + bi.IssuedAt = new(time.Time) + *bi.IssuedAt = value.Time } case billinginvoice.FieldCurrency: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field currency", values[i]) } else if value.Valid { - bi.Currency = value.String + bi.Currency = currencyx.Code(value.String) } - case billinginvoice.FieldDueDate: + case billinginvoice.FieldDueAt: if value, ok := values[i].(*sql.NullTime); !ok { - return fmt.Errorf("unexpected type %T for field due_date", values[i]) + return fmt.Errorf("unexpected type %T for field due_at", values[i]) } else if value.Valid { - bi.DueDate = value.Time + bi.DueAt = new(time.Time) + *bi.DueAt = value.Time } case billinginvoice.FieldStatus: if value, ok := values[i].(*sql.NullString); !ok { @@ -224,17 +466,37 @@ func (bi *BillingInvoice) assignValues(columns []string, values []any) error { } else if value.Valid { bi.WorkflowConfigID = value.String } + case billinginvoice.FieldTaxAppID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field tax_app_id", values[i]) + } else if value.Valid { + bi.TaxAppID = value.String + } + case billinginvoice.FieldInvoicingAppID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field invoicing_app_id", values[i]) + } else if value.Valid { + bi.InvoicingAppID = value.String + } + case billinginvoice.FieldPaymentAppID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field payment_app_id", values[i]) + } else if value.Valid { + bi.PaymentAppID = value.String + } case billinginvoice.FieldPeriodStart: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field period_start", values[i]) } else if value.Valid { - bi.PeriodStart = value.Time + bi.PeriodStart = new(time.Time) + *bi.PeriodStart = value.Time } case billinginvoice.FieldPeriodEnd: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field period_end", values[i]) } else if value.Valid { - bi.PeriodEnd = value.Time + bi.PeriodEnd = new(time.Time) + *bi.PeriodEnd = value.Time } default: bi.selectValues.Set(columns[i], values[i]) @@ -249,9 +511,9 @@ func (bi *BillingInvoice) Value(name string) (ent.Value, error) { return bi.selectValues.Get(name) } -// QueryBillingProfile queries the "billing_profile" edge of the BillingInvoice entity. -func (bi *BillingInvoice) QueryBillingProfile() *BillingProfileQuery { - return NewBillingInvoiceClient(bi.config).QueryBillingProfile(bi) +// QuerySourceBillingProfile queries the "source_billing_profile" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QuerySourceBillingProfile() *BillingProfileQuery { + return NewBillingInvoiceClient(bi.config).QuerySourceBillingProfile(bi) } // QueryBillingWorkflowConfig queries the "billing_workflow_config" edge of the BillingInvoice entity. @@ -259,9 +521,29 @@ func (bi *BillingInvoice) QueryBillingWorkflowConfig() *BillingWorkflowConfigQue return NewBillingInvoiceClient(bi.config).QueryBillingWorkflowConfig(bi) } -// QueryBillingInvoiceItems queries the "billing_invoice_items" edge of the BillingInvoice entity. -func (bi *BillingInvoice) QueryBillingInvoiceItems() *BillingInvoiceItemQuery { - return NewBillingInvoiceClient(bi.config).QueryBillingInvoiceItems(bi) +// QueryBillingInvoiceLines queries the "billing_invoice_lines" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QueryBillingInvoiceLines() *BillingInvoiceLineQuery { + return NewBillingInvoiceClient(bi.config).QueryBillingInvoiceLines(bi) +} + +// QueryBillingInvoiceCustomer queries the "billing_invoice_customer" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QueryBillingInvoiceCustomer() *CustomerQuery { + return NewBillingInvoiceClient(bi.config).QueryBillingInvoiceCustomer(bi) +} + +// QueryTaxApp queries the "tax_app" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QueryTaxApp() *AppQuery { + return NewBillingInvoiceClient(bi.config).QueryTaxApp(bi) +} + +// QueryInvoicingApp queries the "invoicing_app" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QueryInvoicingApp() *AppQuery { + return NewBillingInvoiceClient(bi.config).QueryInvoicingApp(bi) +} + +// QueryPaymentApp queries the "payment_app" edge of the BillingInvoice entity. +func (bi *BillingInvoice) QueryPaymentApp() *AppQuery { + return NewBillingInvoiceClient(bi.config).QueryPaymentApp(bi) } // Update returns a builder for updating this BillingInvoice. @@ -290,6 +572,9 @@ func (bi *BillingInvoice) String() string { builder.WriteString("namespace=") builder.WriteString(bi.Namespace) builder.WriteString(", ") + builder.WriteString("metadata=") + builder.WriteString(fmt.Sprintf("%v", bi.Metadata)) + builder.WriteString(", ") builder.WriteString("created_at=") builder.WriteString(bi.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") @@ -301,33 +586,128 @@ func (bi *BillingInvoice) String() string { builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") - builder.WriteString("metadata=") - builder.WriteString(fmt.Sprintf("%v", bi.Metadata)) + if v := bi.SupplierAddressCountry; v != nil { + builder.WriteString("supplier_address_country=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + if v := bi.SupplierAddressPostalCode; v != nil { + builder.WriteString("supplier_address_postal_code=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.SupplierAddressState; v != nil { + builder.WriteString("supplier_address_state=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.SupplierAddressCity; v != nil { + builder.WriteString("supplier_address_city=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.SupplierAddressLine1; v != nil { + builder.WriteString("supplier_address_line1=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.SupplierAddressLine2; v != nil { + builder.WriteString("supplier_address_line2=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.SupplierAddressPhoneNumber; v != nil { + builder.WriteString("supplier_address_phone_number=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressCountry; v != nil { + builder.WriteString("customer_address_country=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + if v := bi.CustomerAddressPostalCode; v != nil { + builder.WriteString("customer_address_postal_code=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressState; v != nil { + builder.WriteString("customer_address_state=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressCity; v != nil { + builder.WriteString("customer_address_city=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressLine1; v != nil { + builder.WriteString("customer_address_line1=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressLine2; v != nil { + builder.WriteString("customer_address_line2=") + builder.WriteString(*v) + } + builder.WriteString(", ") + if v := bi.CustomerAddressPhoneNumber; v != nil { + builder.WriteString("customer_address_phone_number=") + builder.WriteString(*v) + } builder.WriteString(", ") - if v := bi.Series; v != nil { - builder.WriteString("series=") + builder.WriteString("supplier_name=") + builder.WriteString(bi.SupplierName) + builder.WriteString(", ") + if v := bi.SupplierTaxCode; v != nil { + builder.WriteString("supplier_tax_code=") builder.WriteString(*v) } builder.WriteString(", ") - if v := bi.Code; v != nil { - builder.WriteString("code=") + builder.WriteString("customer_name=") + builder.WriteString(bi.CustomerName) + builder.WriteString(", ") + if v := bi.CustomerTimezone; v != nil { + builder.WriteString("customer_timezone=") + builder.WriteString(fmt.Sprintf("%v", *v)) + } + builder.WriteString(", ") + if v := bi.Number; v != nil { + builder.WriteString("number=") + builder.WriteString(*v) + } + builder.WriteString(", ") + builder.WriteString("type=") + builder.WriteString(fmt.Sprintf("%v", bi.Type)) + builder.WriteString(", ") + if v := bi.Description; v != nil { + builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") builder.WriteString("customer_id=") builder.WriteString(bi.CustomerID) builder.WriteString(", ") - builder.WriteString("billing_profile_id=") - builder.WriteString(bi.BillingProfileID) + builder.WriteString("source_billing_profile_id=") + builder.WriteString(bi.SourceBillingProfileID) + builder.WriteString(", ") + if v := bi.VoidedAt; v != nil { + builder.WriteString("voided_at=") + builder.WriteString(v.Format(time.ANSIC)) + } builder.WriteString(", ") - builder.WriteString("voided_at=") - builder.WriteString(bi.VoidedAt.Format(time.ANSIC)) + if v := bi.IssuedAt; v != nil { + builder.WriteString("issued_at=") + builder.WriteString(v.Format(time.ANSIC)) + } builder.WriteString(", ") builder.WriteString("currency=") - builder.WriteString(bi.Currency) + builder.WriteString(fmt.Sprintf("%v", bi.Currency)) builder.WriteString(", ") - builder.WriteString("due_date=") - builder.WriteString(bi.DueDate.Format(time.ANSIC)) + if v := bi.DueAt; v != nil { + builder.WriteString("due_at=") + builder.WriteString(v.Format(time.ANSIC)) + } builder.WriteString(", ") builder.WriteString("status=") builder.WriteString(fmt.Sprintf("%v", bi.Status)) @@ -335,11 +715,24 @@ func (bi *BillingInvoice) String() string { builder.WriteString("workflow_config_id=") builder.WriteString(bi.WorkflowConfigID) builder.WriteString(", ") - builder.WriteString("period_start=") - builder.WriteString(bi.PeriodStart.Format(time.ANSIC)) + builder.WriteString("tax_app_id=") + builder.WriteString(bi.TaxAppID) + builder.WriteString(", ") + builder.WriteString("invoicing_app_id=") + builder.WriteString(bi.InvoicingAppID) + builder.WriteString(", ") + builder.WriteString("payment_app_id=") + builder.WriteString(bi.PaymentAppID) builder.WriteString(", ") - builder.WriteString("period_end=") - builder.WriteString(bi.PeriodEnd.Format(time.ANSIC)) + if v := bi.PeriodStart; v != nil { + builder.WriteString("period_start=") + builder.WriteString(v.Format(time.ANSIC)) + } + builder.WriteString(", ") + if v := bi.PeriodEnd; v != nil { + builder.WriteString("period_end=") + builder.WriteString(v.Format(time.ANSIC)) + } builder.WriteByte(')') return builder.String() } diff --git a/openmeter/ent/db/billinginvoice/billinginvoice.go b/openmeter/ent/db/billinginvoice/billinginvoice.go index b8e46f380..641b9ddd1 100644 --- a/openmeter/ent/db/billinginvoice/billinginvoice.go +++ b/openmeter/ent/db/billinginvoice/billinginvoice.go @@ -18,51 +18,105 @@ const ( FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" + // FieldMetadata holds the string denoting the metadata field in the database. + FieldMetadata = "metadata" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" - // FieldMetadata holds the string denoting the metadata field in the database. - FieldMetadata = "metadata" - // FieldSeries holds the string denoting the series field in the database. - FieldSeries = "series" - // FieldCode holds the string denoting the code field in the database. - FieldCode = "code" + // FieldSupplierAddressCountry holds the string denoting the supplier_address_country field in the database. + FieldSupplierAddressCountry = "supplier_address_country" + // FieldSupplierAddressPostalCode holds the string denoting the supplier_address_postal_code field in the database. + FieldSupplierAddressPostalCode = "supplier_address_postal_code" + // FieldSupplierAddressState holds the string denoting the supplier_address_state field in the database. + FieldSupplierAddressState = "supplier_address_state" + // FieldSupplierAddressCity holds the string denoting the supplier_address_city field in the database. + FieldSupplierAddressCity = "supplier_address_city" + // FieldSupplierAddressLine1 holds the string denoting the supplier_address_line1 field in the database. + FieldSupplierAddressLine1 = "supplier_address_line1" + // FieldSupplierAddressLine2 holds the string denoting the supplier_address_line2 field in the database. + FieldSupplierAddressLine2 = "supplier_address_line2" + // FieldSupplierAddressPhoneNumber holds the string denoting the supplier_address_phone_number field in the database. + FieldSupplierAddressPhoneNumber = "supplier_address_phone_number" + // FieldCustomerAddressCountry holds the string denoting the customer_address_country field in the database. + FieldCustomerAddressCountry = "customer_address_country" + // FieldCustomerAddressPostalCode holds the string denoting the customer_address_postal_code field in the database. + FieldCustomerAddressPostalCode = "customer_address_postal_code" + // FieldCustomerAddressState holds the string denoting the customer_address_state field in the database. + FieldCustomerAddressState = "customer_address_state" + // FieldCustomerAddressCity holds the string denoting the customer_address_city field in the database. + FieldCustomerAddressCity = "customer_address_city" + // FieldCustomerAddressLine1 holds the string denoting the customer_address_line1 field in the database. + FieldCustomerAddressLine1 = "customer_address_line1" + // FieldCustomerAddressLine2 holds the string denoting the customer_address_line2 field in the database. + FieldCustomerAddressLine2 = "customer_address_line2" + // FieldCustomerAddressPhoneNumber holds the string denoting the customer_address_phone_number field in the database. + FieldCustomerAddressPhoneNumber = "customer_address_phone_number" + // FieldSupplierName holds the string denoting the supplier_name field in the database. + FieldSupplierName = "supplier_name" + // FieldSupplierTaxCode holds the string denoting the supplier_tax_code field in the database. + FieldSupplierTaxCode = "supplier_tax_code" + // FieldCustomerName holds the string denoting the customer_name field in the database. + FieldCustomerName = "customer_name" + // FieldCustomerTimezone holds the string denoting the customer_timezone field in the database. + FieldCustomerTimezone = "customer_timezone" + // FieldNumber holds the string denoting the number field in the database. + FieldNumber = "number" + // FieldType holds the string denoting the type field in the database. + FieldType = "type" + // FieldDescription holds the string denoting the description field in the database. + FieldDescription = "description" // FieldCustomerID holds the string denoting the customer_id field in the database. FieldCustomerID = "customer_id" - // FieldBillingProfileID holds the string denoting the billing_profile_id field in the database. - FieldBillingProfileID = "billing_profile_id" + // FieldSourceBillingProfileID holds the string denoting the source_billing_profile_id field in the database. + FieldSourceBillingProfileID = "source_billing_profile_id" // FieldVoidedAt holds the string denoting the voided_at field in the database. FieldVoidedAt = "voided_at" + // FieldIssuedAt holds the string denoting the issued_at field in the database. + FieldIssuedAt = "issued_at" // FieldCurrency holds the string denoting the currency field in the database. FieldCurrency = "currency" - // FieldDueDate holds the string denoting the due_date field in the database. - FieldDueDate = "due_date" + // FieldDueAt holds the string denoting the due_at field in the database. + FieldDueAt = "due_at" // FieldStatus holds the string denoting the status field in the database. FieldStatus = "status" // FieldWorkflowConfigID holds the string denoting the workflow_config_id field in the database. FieldWorkflowConfigID = "workflow_config_id" + // FieldTaxAppID holds the string denoting the tax_app_id field in the database. + FieldTaxAppID = "tax_app_id" + // FieldInvoicingAppID holds the string denoting the invoicing_app_id field in the database. + FieldInvoicingAppID = "invoicing_app_id" + // FieldPaymentAppID holds the string denoting the payment_app_id field in the database. + FieldPaymentAppID = "payment_app_id" // FieldPeriodStart holds the string denoting the period_start field in the database. FieldPeriodStart = "period_start" // FieldPeriodEnd holds the string denoting the period_end field in the database. FieldPeriodEnd = "period_end" - // EdgeBillingProfile holds the string denoting the billing_profile edge name in mutations. - EdgeBillingProfile = "billing_profile" + // EdgeSourceBillingProfile holds the string denoting the source_billing_profile edge name in mutations. + EdgeSourceBillingProfile = "source_billing_profile" // EdgeBillingWorkflowConfig holds the string denoting the billing_workflow_config edge name in mutations. EdgeBillingWorkflowConfig = "billing_workflow_config" - // EdgeBillingInvoiceItems holds the string denoting the billing_invoice_items edge name in mutations. - EdgeBillingInvoiceItems = "billing_invoice_items" + // EdgeBillingInvoiceLines holds the string denoting the billing_invoice_lines edge name in mutations. + EdgeBillingInvoiceLines = "billing_invoice_lines" + // EdgeBillingInvoiceCustomer holds the string denoting the billing_invoice_customer edge name in mutations. + EdgeBillingInvoiceCustomer = "billing_invoice_customer" + // EdgeTaxApp holds the string denoting the tax_app edge name in mutations. + EdgeTaxApp = "tax_app" + // EdgeInvoicingApp holds the string denoting the invoicing_app edge name in mutations. + EdgeInvoicingApp = "invoicing_app" + // EdgePaymentApp holds the string denoting the payment_app edge name in mutations. + EdgePaymentApp = "payment_app" // Table holds the table name of the billinginvoice in the database. Table = "billing_invoices" - // BillingProfileTable is the table that holds the billing_profile relation/edge. - BillingProfileTable = "billing_invoices" - // BillingProfileInverseTable is the table name for the BillingProfile entity. + // SourceBillingProfileTable is the table that holds the source_billing_profile relation/edge. + SourceBillingProfileTable = "billing_invoices" + // SourceBillingProfileInverseTable is the table name for the BillingProfile entity. // It exists in this package in order to avoid circular dependency with the "billingprofile" package. - BillingProfileInverseTable = "billing_profiles" - // BillingProfileColumn is the table column denoting the billing_profile relation/edge. - BillingProfileColumn = "billing_profile_id" + SourceBillingProfileInverseTable = "billing_profiles" + // SourceBillingProfileColumn is the table column denoting the source_billing_profile relation/edge. + SourceBillingProfileColumn = "source_billing_profile_id" // BillingWorkflowConfigTable is the table that holds the billing_workflow_config relation/edge. BillingWorkflowConfigTable = "billing_invoices" // BillingWorkflowConfigInverseTable is the table name for the BillingWorkflowConfig entity. @@ -70,32 +124,83 @@ const ( BillingWorkflowConfigInverseTable = "billing_workflow_configs" // BillingWorkflowConfigColumn is the table column denoting the billing_workflow_config relation/edge. BillingWorkflowConfigColumn = "workflow_config_id" - // BillingInvoiceItemsTable is the table that holds the billing_invoice_items relation/edge. - BillingInvoiceItemsTable = "billing_invoice_items" - // BillingInvoiceItemsInverseTable is the table name for the BillingInvoiceItem entity. - // It exists in this package in order to avoid circular dependency with the "billinginvoiceitem" package. - BillingInvoiceItemsInverseTable = "billing_invoice_items" - // BillingInvoiceItemsColumn is the table column denoting the billing_invoice_items relation/edge. - BillingInvoiceItemsColumn = "invoice_id" + // BillingInvoiceLinesTable is the table that holds the billing_invoice_lines relation/edge. + BillingInvoiceLinesTable = "billing_invoice_lines" + // BillingInvoiceLinesInverseTable is the table name for the BillingInvoiceLine entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoiceline" package. + BillingInvoiceLinesInverseTable = "billing_invoice_lines" + // BillingInvoiceLinesColumn is the table column denoting the billing_invoice_lines relation/edge. + BillingInvoiceLinesColumn = "invoice_id" + // BillingInvoiceCustomerTable is the table that holds the billing_invoice_customer relation/edge. + BillingInvoiceCustomerTable = "billing_invoices" + // BillingInvoiceCustomerInverseTable is the table name for the Customer entity. + // It exists in this package in order to avoid circular dependency with the "customer" package. + BillingInvoiceCustomerInverseTable = "customers" + // BillingInvoiceCustomerColumn is the table column denoting the billing_invoice_customer relation/edge. + BillingInvoiceCustomerColumn = "customer_id" + // TaxAppTable is the table that holds the tax_app relation/edge. + TaxAppTable = "billing_invoices" + // TaxAppInverseTable is the table name for the App entity. + // It exists in this package in order to avoid circular dependency with the "app" package. + TaxAppInverseTable = "apps" + // TaxAppColumn is the table column denoting the tax_app relation/edge. + TaxAppColumn = "tax_app_id" + // InvoicingAppTable is the table that holds the invoicing_app relation/edge. + InvoicingAppTable = "billing_invoices" + // InvoicingAppInverseTable is the table name for the App entity. + // It exists in this package in order to avoid circular dependency with the "app" package. + InvoicingAppInverseTable = "apps" + // InvoicingAppColumn is the table column denoting the invoicing_app relation/edge. + InvoicingAppColumn = "invoicing_app_id" + // PaymentAppTable is the table that holds the payment_app relation/edge. + PaymentAppTable = "billing_invoices" + // PaymentAppInverseTable is the table name for the App entity. + // It exists in this package in order to avoid circular dependency with the "app" package. + PaymentAppInverseTable = "apps" + // PaymentAppColumn is the table column denoting the payment_app relation/edge. + PaymentAppColumn = "payment_app_id" ) // Columns holds all SQL columns for billinginvoice fields. var Columns = []string{ FieldID, FieldNamespace, + FieldMetadata, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, - FieldMetadata, - FieldSeries, - FieldCode, + FieldSupplierAddressCountry, + FieldSupplierAddressPostalCode, + FieldSupplierAddressState, + FieldSupplierAddressCity, + FieldSupplierAddressLine1, + FieldSupplierAddressLine2, + FieldSupplierAddressPhoneNumber, + FieldCustomerAddressCountry, + FieldCustomerAddressPostalCode, + FieldCustomerAddressState, + FieldCustomerAddressCity, + FieldCustomerAddressLine1, + FieldCustomerAddressLine2, + FieldCustomerAddressPhoneNumber, + FieldSupplierName, + FieldSupplierTaxCode, + FieldCustomerName, + FieldCustomerTimezone, + FieldNumber, + FieldType, + FieldDescription, FieldCustomerID, - FieldBillingProfileID, + FieldSourceBillingProfileID, FieldVoidedAt, + FieldIssuedAt, FieldCurrency, - FieldDueDate, + FieldDueAt, FieldStatus, FieldWorkflowConfigID, + FieldTaxAppID, + FieldInvoicingAppID, + FieldPaymentAppID, FieldPeriodStart, FieldPeriodEnd, } @@ -119,20 +224,38 @@ var ( DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time + // SupplierAddressCountryValidator is a validator for the "supplier_address_country" field. It is called by the builders before save. + SupplierAddressCountryValidator func(string) error + // CustomerAddressCountryValidator is a validator for the "customer_address_country" field. It is called by the builders before save. + CustomerAddressCountryValidator func(string) error + // SupplierNameValidator is a validator for the "supplier_name" field. It is called by the builders before save. + SupplierNameValidator func(string) error + // CustomerNameValidator is a validator for the "customer_name" field. It is called by the builders before save. + CustomerNameValidator func(string) error // CustomerIDValidator is a validator for the "customer_id" field. It is called by the builders before save. CustomerIDValidator func(string) error - // BillingProfileIDValidator is a validator for the "billing_profile_id" field. It is called by the builders before save. - BillingProfileIDValidator func(string) error + // SourceBillingProfileIDValidator is a validator for the "source_billing_profile_id" field. It is called by the builders before save. + SourceBillingProfileIDValidator func(string) error // CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. CurrencyValidator func(string) error // DefaultID holds the default value on creation for the "id" field. DefaultID func() string ) +// TypeValidator is a validator for the "type" field enum values. It is called by the builders before save. +func TypeValidator(_type billingentity.InvoiceType) error { + switch _type { + case "standard", "credit-note": + return nil + default: + return fmt.Errorf("billinginvoice: invalid enum value for type field: %q", _type) + } +} + // StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. func StatusValidator(s billingentity.InvoiceStatus) error { switch s { - case "created", "draft", "draft_sync", "draft_sync_failed", "issuing", "issued", "issuing_failed", "manual_approval_needed": + case "gathering", "created", "draft", "draft_sync", "draft_sync_failed", "issuing", "issued", "issuing_failed", "manual_approval_needed": return nil default: return fmt.Errorf("billinginvoice: invalid enum value for status field: %q", s) @@ -167,14 +290,109 @@ func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc() } -// BySeries orders the results by the series field. -func BySeries(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldSeries, opts...).ToFunc() +// BySupplierAddressCountry orders the results by the supplier_address_country field. +func BySupplierAddressCountry(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressCountry, opts...).ToFunc() +} + +// BySupplierAddressPostalCode orders the results by the supplier_address_postal_code field. +func BySupplierAddressPostalCode(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressPostalCode, opts...).ToFunc() +} + +// BySupplierAddressState orders the results by the supplier_address_state field. +func BySupplierAddressState(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressState, opts...).ToFunc() +} + +// BySupplierAddressCity orders the results by the supplier_address_city field. +func BySupplierAddressCity(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressCity, opts...).ToFunc() +} + +// BySupplierAddressLine1 orders the results by the supplier_address_line1 field. +func BySupplierAddressLine1(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressLine1, opts...).ToFunc() +} + +// BySupplierAddressLine2 orders the results by the supplier_address_line2 field. +func BySupplierAddressLine2(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressLine2, opts...).ToFunc() +} + +// BySupplierAddressPhoneNumber orders the results by the supplier_address_phone_number field. +func BySupplierAddressPhoneNumber(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierAddressPhoneNumber, opts...).ToFunc() +} + +// ByCustomerAddressCountry orders the results by the customer_address_country field. +func ByCustomerAddressCountry(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressCountry, opts...).ToFunc() +} + +// ByCustomerAddressPostalCode orders the results by the customer_address_postal_code field. +func ByCustomerAddressPostalCode(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressPostalCode, opts...).ToFunc() +} + +// ByCustomerAddressState orders the results by the customer_address_state field. +func ByCustomerAddressState(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressState, opts...).ToFunc() +} + +// ByCustomerAddressCity orders the results by the customer_address_city field. +func ByCustomerAddressCity(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressCity, opts...).ToFunc() +} + +// ByCustomerAddressLine1 orders the results by the customer_address_line1 field. +func ByCustomerAddressLine1(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressLine1, opts...).ToFunc() +} + +// ByCustomerAddressLine2 orders the results by the customer_address_line2 field. +func ByCustomerAddressLine2(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressLine2, opts...).ToFunc() +} + +// ByCustomerAddressPhoneNumber orders the results by the customer_address_phone_number field. +func ByCustomerAddressPhoneNumber(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerAddressPhoneNumber, opts...).ToFunc() +} + +// BySupplierName orders the results by the supplier_name field. +func BySupplierName(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierName, opts...).ToFunc() +} + +// BySupplierTaxCode orders the results by the supplier_tax_code field. +func BySupplierTaxCode(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSupplierTaxCode, opts...).ToFunc() +} + +// ByCustomerName orders the results by the customer_name field. +func ByCustomerName(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerName, opts...).ToFunc() +} + +// ByCustomerTimezone orders the results by the customer_timezone field. +func ByCustomerTimezone(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldCustomerTimezone, opts...).ToFunc() } -// ByCode orders the results by the code field. -func ByCode(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldCode, opts...).ToFunc() +// ByNumber orders the results by the number field. +func ByNumber(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldNumber, opts...).ToFunc() +} + +// ByType orders the results by the type field. +func ByType(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldType, opts...).ToFunc() +} + +// ByDescription orders the results by the description field. +func ByDescription(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDescription, opts...).ToFunc() } // ByCustomerID orders the results by the customer_id field. @@ -182,9 +400,9 @@ func ByCustomerID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCustomerID, opts...).ToFunc() } -// ByBillingProfileID orders the results by the billing_profile_id field. -func ByBillingProfileID(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldBillingProfileID, opts...).ToFunc() +// BySourceBillingProfileID orders the results by the source_billing_profile_id field. +func BySourceBillingProfileID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldSourceBillingProfileID, opts...).ToFunc() } // ByVoidedAt orders the results by the voided_at field. @@ -192,14 +410,19 @@ func ByVoidedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldVoidedAt, opts...).ToFunc() } +// ByIssuedAt orders the results by the issued_at field. +func ByIssuedAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldIssuedAt, opts...).ToFunc() +} + // ByCurrency orders the results by the currency field. func ByCurrency(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCurrency, opts...).ToFunc() } -// ByDueDate orders the results by the due_date field. -func ByDueDate(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldDueDate, opts...).ToFunc() +// ByDueAt orders the results by the due_at field. +func ByDueAt(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDueAt, opts...).ToFunc() } // ByStatus orders the results by the status field. @@ -212,6 +435,21 @@ func ByWorkflowConfigID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldWorkflowConfigID, opts...).ToFunc() } +// ByTaxAppID orders the results by the tax_app_id field. +func ByTaxAppID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldTaxAppID, opts...).ToFunc() +} + +// ByInvoicingAppID orders the results by the invoicing_app_id field. +func ByInvoicingAppID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldInvoicingAppID, opts...).ToFunc() +} + +// ByPaymentAppID orders the results by the payment_app_id field. +func ByPaymentAppID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldPaymentAppID, opts...).ToFunc() +} + // ByPeriodStart orders the results by the period_start field. func ByPeriodStart(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPeriodStart, opts...).ToFunc() @@ -222,10 +460,10 @@ func ByPeriodEnd(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPeriodEnd, opts...).ToFunc() } -// ByBillingProfileField orders the results by billing_profile field. -func ByBillingProfileField(field string, opts ...sql.OrderTermOption) OrderOption { +// BySourceBillingProfileField orders the results by source_billing_profile field. +func BySourceBillingProfileField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newBillingProfileStep(), sql.OrderByField(field, opts...)) + sqlgraph.OrderByNeighborTerms(s, newSourceBillingProfileStep(), sql.OrderByField(field, opts...)) } } @@ -236,24 +474,52 @@ func ByBillingWorkflowConfigField(field string, opts ...sql.OrderTermOption) Ord } } -// ByBillingInvoiceItemsCount orders the results by billing_invoice_items count. -func ByBillingInvoiceItemsCount(opts ...sql.OrderTermOption) OrderOption { +// ByBillingInvoiceLinesCount orders the results by billing_invoice_lines count. +func ByBillingInvoiceLinesCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceLinesStep(), opts...) + } +} + +// ByBillingInvoiceLines orders the results by billing_invoice_lines terms. +func ByBillingInvoiceLines(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceLinesStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} + +// ByBillingInvoiceCustomerField orders the results by billing_invoice_customer field. +func ByBillingInvoiceCustomerField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceCustomerStep(), sql.OrderByField(field, opts...)) + } +} + +// ByTaxAppField orders the results by tax_app field. +func ByTaxAppField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newTaxAppStep(), sql.OrderByField(field, opts...)) + } +} + +// ByInvoicingAppField orders the results by invoicing_app field. +func ByInvoicingAppField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceItemsStep(), opts...) + sqlgraph.OrderByNeighborTerms(s, newInvoicingAppStep(), sql.OrderByField(field, opts...)) } } -// ByBillingInvoiceItems orders the results by billing_invoice_items terms. -func ByBillingInvoiceItems(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { +// ByPaymentAppField orders the results by payment_app field. +func ByPaymentAppField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { - sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceItemsStep(), append([]sql.OrderTerm{term}, terms...)...) + sqlgraph.OrderByNeighborTerms(s, newPaymentAppStep(), sql.OrderByField(field, opts...)) } } -func newBillingProfileStep() *sqlgraph.Step { +func newSourceBillingProfileStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(BillingProfileInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, BillingProfileTable, BillingProfileColumn), + sqlgraph.To(SourceBillingProfileInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, SourceBillingProfileTable, SourceBillingProfileColumn), ) } func newBillingWorkflowConfigStep() *sqlgraph.Step { @@ -263,10 +529,38 @@ func newBillingWorkflowConfigStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2O, true, BillingWorkflowConfigTable, BillingWorkflowConfigColumn), ) } -func newBillingInvoiceItemsStep() *sqlgraph.Step { +func newBillingInvoiceLinesStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingInvoiceLinesInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceLinesTable, BillingInvoiceLinesColumn), + ) +} +func newBillingInvoiceCustomerStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingInvoiceCustomerInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceCustomerTable, BillingInvoiceCustomerColumn), + ) +} +func newTaxAppStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(TaxAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, TaxAppTable, TaxAppColumn), + ) +} +func newInvoicingAppStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(InvoicingAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, InvoicingAppTable, InvoicingAppColumn), + ) +} +func newPaymentAppStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.To(BillingInvoiceItemsInverseTable, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceItemsTable, BillingInvoiceItemsColumn), + sqlgraph.To(PaymentAppInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, PaymentAppTable, PaymentAppColumn), ) } diff --git a/openmeter/ent/db/billinginvoice/where.go b/openmeter/ent/db/billinginvoice/where.go index 29eb2a04a..4f5bee357 100644 --- a/openmeter/ent/db/billinginvoice/where.go +++ b/openmeter/ent/db/billinginvoice/where.go @@ -9,6 +9,9 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/timezone" ) // ID filters vertices based on their ID field. @@ -86,14 +89,107 @@ func DeletedAt(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldDeletedAt, v)) } -// Series applies equality check predicate on the "series" field. It's identical to SeriesEQ. -func Series(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldSeries, v)) +// SupplierAddressCountry applies equality check predicate on the "supplier_address_country" field. It's identical to SupplierAddressCountryEQ. +func SupplierAddressCountry(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressCountry, vc)) } -// Code applies equality check predicate on the "code" field. It's identical to CodeEQ. -func Code(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldCode, v)) +// SupplierAddressPostalCode applies equality check predicate on the "supplier_address_postal_code" field. It's identical to SupplierAddressPostalCodeEQ. +func SupplierAddressPostalCode(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressState applies equality check predicate on the "supplier_address_state" field. It's identical to SupplierAddressStateEQ. +func SupplierAddressState(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressState, v)) +} + +// SupplierAddressCity applies equality check predicate on the "supplier_address_city" field. It's identical to SupplierAddressCityEQ. +func SupplierAddressCity(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressCity, v)) +} + +// SupplierAddressLine1 applies equality check predicate on the "supplier_address_line1" field. It's identical to SupplierAddressLine1EQ. +func SupplierAddressLine1(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine2 applies equality check predicate on the "supplier_address_line2" field. It's identical to SupplierAddressLine2EQ. +func SupplierAddressLine2(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressPhoneNumber applies equality check predicate on the "supplier_address_phone_number" field. It's identical to SupplierAddressPhoneNumberEQ. +func SupplierAddressPhoneNumber(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressPhoneNumber, v)) +} + +// CustomerAddressCountry applies equality check predicate on the "customer_address_country" field. It's identical to CustomerAddressCountryEQ. +func CustomerAddressCountry(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressPostalCode applies equality check predicate on the "customer_address_postal_code" field. It's identical to CustomerAddressPostalCodeEQ. +func CustomerAddressPostalCode(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressState applies equality check predicate on the "customer_address_state" field. It's identical to CustomerAddressStateEQ. +func CustomerAddressState(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressState, v)) +} + +// CustomerAddressCity applies equality check predicate on the "customer_address_city" field. It's identical to CustomerAddressCityEQ. +func CustomerAddressCity(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressCity, v)) +} + +// CustomerAddressLine1 applies equality check predicate on the "customer_address_line1" field. It's identical to CustomerAddressLine1EQ. +func CustomerAddressLine1(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine2 applies equality check predicate on the "customer_address_line2" field. It's identical to CustomerAddressLine2EQ. +func CustomerAddressLine2(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressPhoneNumber applies equality check predicate on the "customer_address_phone_number" field. It's identical to CustomerAddressPhoneNumberEQ. +func CustomerAddressPhoneNumber(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressPhoneNumber, v)) +} + +// SupplierName applies equality check predicate on the "supplier_name" field. It's identical to SupplierNameEQ. +func SupplierName(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierName, v)) +} + +// SupplierTaxCode applies equality check predicate on the "supplier_tax_code" field. It's identical to SupplierTaxCodeEQ. +func SupplierTaxCode(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierTaxCode, v)) +} + +// CustomerName applies equality check predicate on the "customer_name" field. It's identical to CustomerNameEQ. +func CustomerName(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerName, v)) +} + +// CustomerTimezone applies equality check predicate on the "customer_timezone" field. It's identical to CustomerTimezoneEQ. +func CustomerTimezone(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerTimezone, vc)) +} + +// Number applies equality check predicate on the "number" field. It's identical to NumberEQ. +func Number(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldNumber, v)) +} + +// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. +func Description(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldDescription, v)) } // CustomerID applies equality check predicate on the "customer_id" field. It's identical to CustomerIDEQ. @@ -101,9 +197,9 @@ func CustomerID(v string) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerID, v)) } -// BillingProfileID applies equality check predicate on the "billing_profile_id" field. It's identical to BillingProfileIDEQ. -func BillingProfileID(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldBillingProfileID, v)) +// SourceBillingProfileID applies equality check predicate on the "source_billing_profile_id" field. It's identical to SourceBillingProfileIDEQ. +func SourceBillingProfileID(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSourceBillingProfileID, v)) } // VoidedAt applies equality check predicate on the "voided_at" field. It's identical to VoidedAtEQ. @@ -111,14 +207,20 @@ func VoidedAt(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldVoidedAt, v)) } +// IssuedAt applies equality check predicate on the "issued_at" field. It's identical to IssuedAtEQ. +func IssuedAt(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldIssuedAt, v)) +} + // Currency applies equality check predicate on the "currency" field. It's identical to CurrencyEQ. -func Currency(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldCurrency, v)) +func Currency(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCurrency, vc)) } -// DueDate applies equality check predicate on the "due_date" field. It's identical to DueDateEQ. -func DueDate(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldDueDate, v)) +// DueAt applies equality check predicate on the "due_at" field. It's identical to DueAtEQ. +func DueAt(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldDueAt, v)) } // WorkflowConfigID applies equality check predicate on the "workflow_config_id" field. It's identical to WorkflowConfigIDEQ. @@ -126,6 +228,21 @@ func WorkflowConfigID(v string) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldWorkflowConfigID, v)) } +// TaxAppID applies equality check predicate on the "tax_app_id" field. It's identical to TaxAppIDEQ. +func TaxAppID(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldTaxAppID, v)) +} + +// InvoicingAppID applies equality check predicate on the "invoicing_app_id" field. It's identical to InvoicingAppIDEQ. +func InvoicingAppID(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldInvoicingAppID, v)) +} + +// PaymentAppID applies equality check predicate on the "payment_app_id" field. It's identical to PaymentAppIDEQ. +func PaymentAppID(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldPaymentAppID, v)) +} + // PeriodStart applies equality check predicate on the "period_start" field. It's identical to PeriodStartEQ. func PeriodStart(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldPeriodStart, v)) @@ -201,6 +318,16 @@ func NamespaceContainsFold(v string) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldContainsFold(FieldNamespace, v)) } +// MetadataIsNil applies the IsNil predicate on the "metadata" field. +func MetadataIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldMetadata)) +} + +// MetadataNotNil applies the NotNil predicate on the "metadata" field. +func MetadataNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldMetadata)) +} + // CreatedAtEQ applies the EQ predicate on the "created_at" field. func CreatedAtEQ(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldCreatedAt, v)) @@ -251,244 +378,1651 @@ func UpdatedAtNEQ(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldNEQ(FieldUpdatedAt, v)) } -// UpdatedAtIn applies the In predicate on the "updated_at" field. -func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldUpdatedAt, vs...)) +// UpdatedAtIn applies the In predicate on the "updated_at" field. +func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. +func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtGT applies the GT predicate on the "updated_at" field. +func UpdatedAtGT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldUpdatedAt, v)) +} + +// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. +func UpdatedAtGTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldUpdatedAt, v)) +} + +// UpdatedAtLT applies the LT predicate on the "updated_at" field. +func UpdatedAtLT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldUpdatedAt, v)) +} + +// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. +func UpdatedAtLTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldUpdatedAt, v)) +} + +// DeletedAtEQ applies the EQ predicate on the "deleted_at" field. +func DeletedAtEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldDeletedAt, v)) +} + +// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field. +func DeletedAtNEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldDeletedAt, v)) +} + +// DeletedAtIn applies the In predicate on the "deleted_at" field. +func DeletedAtIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldDeletedAt, vs...)) +} + +// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field. +func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldDeletedAt, vs...)) +} + +// DeletedAtGT applies the GT predicate on the "deleted_at" field. +func DeletedAtGT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldDeletedAt, v)) +} + +// DeletedAtGTE applies the GTE predicate on the "deleted_at" field. +func DeletedAtGTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldDeletedAt, v)) +} + +// DeletedAtLT applies the LT predicate on the "deleted_at" field. +func DeletedAtLT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldDeletedAt, v)) +} + +// DeletedAtLTE applies the LTE predicate on the "deleted_at" field. +func DeletedAtLTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldDeletedAt, v)) +} + +// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field. +func DeletedAtIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldDeletedAt)) +} + +// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field. +func DeletedAtNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldDeletedAt)) +} + +// SupplierAddressCountryEQ applies the EQ predicate on the "supplier_address_country" field. +func SupplierAddressCountryEQ(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryNEQ applies the NEQ predicate on the "supplier_address_country" field. +func SupplierAddressCountryNEQ(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryIn applies the In predicate on the "supplier_address_country" field. +func SupplierAddressCountryIn(vs ...models.CountryCode) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressCountry, v...)) +} + +// SupplierAddressCountryNotIn applies the NotIn predicate on the "supplier_address_country" field. +func SupplierAddressCountryNotIn(vs ...models.CountryCode) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressCountry, v...)) +} + +// SupplierAddressCountryGT applies the GT predicate on the "supplier_address_country" field. +func SupplierAddressCountryGT(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryGTE applies the GTE predicate on the "supplier_address_country" field. +func SupplierAddressCountryGTE(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryLT applies the LT predicate on the "supplier_address_country" field. +func SupplierAddressCountryLT(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryLTE applies the LTE predicate on the "supplier_address_country" field. +func SupplierAddressCountryLTE(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryContains applies the Contains predicate on the "supplier_address_country" field. +func SupplierAddressCountryContains(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryHasPrefix applies the HasPrefix predicate on the "supplier_address_country" field. +func SupplierAddressCountryHasPrefix(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryHasSuffix applies the HasSuffix predicate on the "supplier_address_country" field. +func SupplierAddressCountryHasSuffix(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryIsNil applies the IsNil predicate on the "supplier_address_country" field. +func SupplierAddressCountryIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressCountry)) +} + +// SupplierAddressCountryNotNil applies the NotNil predicate on the "supplier_address_country" field. +func SupplierAddressCountryNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressCountry)) +} + +// SupplierAddressCountryEqualFold applies the EqualFold predicate on the "supplier_address_country" field. +func SupplierAddressCountryEqualFold(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressCountryContainsFold applies the ContainsFold predicate on the "supplier_address_country" field. +func SupplierAddressCountryContainsFold(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressCountry, vc)) +} + +// SupplierAddressPostalCodeEQ applies the EQ predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeNEQ applies the NEQ predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeIn applies the In predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressPostalCode, vs...)) +} + +// SupplierAddressPostalCodeNotIn applies the NotIn predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressPostalCode, vs...)) +} + +// SupplierAddressPostalCodeGT applies the GT predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeGTE applies the GTE predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeLT applies the LT predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeLTE applies the LTE predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeContains applies the Contains predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeHasPrefix applies the HasPrefix predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeHasSuffix applies the HasSuffix predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeIsNil applies the IsNil predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressPostalCode)) +} + +// SupplierAddressPostalCodeNotNil applies the NotNil predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressPostalCode)) +} + +// SupplierAddressPostalCodeEqualFold applies the EqualFold predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressPostalCodeContainsFold applies the ContainsFold predicate on the "supplier_address_postal_code" field. +func SupplierAddressPostalCodeContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressPostalCode, v)) +} + +// SupplierAddressStateEQ applies the EQ predicate on the "supplier_address_state" field. +func SupplierAddressStateEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateNEQ applies the NEQ predicate on the "supplier_address_state" field. +func SupplierAddressStateNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateIn applies the In predicate on the "supplier_address_state" field. +func SupplierAddressStateIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressState, vs...)) +} + +// SupplierAddressStateNotIn applies the NotIn predicate on the "supplier_address_state" field. +func SupplierAddressStateNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressState, vs...)) +} + +// SupplierAddressStateGT applies the GT predicate on the "supplier_address_state" field. +func SupplierAddressStateGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateGTE applies the GTE predicate on the "supplier_address_state" field. +func SupplierAddressStateGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateLT applies the LT predicate on the "supplier_address_state" field. +func SupplierAddressStateLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateLTE applies the LTE predicate on the "supplier_address_state" field. +func SupplierAddressStateLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateContains applies the Contains predicate on the "supplier_address_state" field. +func SupplierAddressStateContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateHasPrefix applies the HasPrefix predicate on the "supplier_address_state" field. +func SupplierAddressStateHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateHasSuffix applies the HasSuffix predicate on the "supplier_address_state" field. +func SupplierAddressStateHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateIsNil applies the IsNil predicate on the "supplier_address_state" field. +func SupplierAddressStateIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressState)) +} + +// SupplierAddressStateNotNil applies the NotNil predicate on the "supplier_address_state" field. +func SupplierAddressStateNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressState)) +} + +// SupplierAddressStateEqualFold applies the EqualFold predicate on the "supplier_address_state" field. +func SupplierAddressStateEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressState, v)) +} + +// SupplierAddressStateContainsFold applies the ContainsFold predicate on the "supplier_address_state" field. +func SupplierAddressStateContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressState, v)) +} + +// SupplierAddressCityEQ applies the EQ predicate on the "supplier_address_city" field. +func SupplierAddressCityEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityNEQ applies the NEQ predicate on the "supplier_address_city" field. +func SupplierAddressCityNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityIn applies the In predicate on the "supplier_address_city" field. +func SupplierAddressCityIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressCity, vs...)) +} + +// SupplierAddressCityNotIn applies the NotIn predicate on the "supplier_address_city" field. +func SupplierAddressCityNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressCity, vs...)) +} + +// SupplierAddressCityGT applies the GT predicate on the "supplier_address_city" field. +func SupplierAddressCityGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityGTE applies the GTE predicate on the "supplier_address_city" field. +func SupplierAddressCityGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityLT applies the LT predicate on the "supplier_address_city" field. +func SupplierAddressCityLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityLTE applies the LTE predicate on the "supplier_address_city" field. +func SupplierAddressCityLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityContains applies the Contains predicate on the "supplier_address_city" field. +func SupplierAddressCityContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityHasPrefix applies the HasPrefix predicate on the "supplier_address_city" field. +func SupplierAddressCityHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityHasSuffix applies the HasSuffix predicate on the "supplier_address_city" field. +func SupplierAddressCityHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityIsNil applies the IsNil predicate on the "supplier_address_city" field. +func SupplierAddressCityIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressCity)) +} + +// SupplierAddressCityNotNil applies the NotNil predicate on the "supplier_address_city" field. +func SupplierAddressCityNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressCity)) +} + +// SupplierAddressCityEqualFold applies the EqualFold predicate on the "supplier_address_city" field. +func SupplierAddressCityEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressCity, v)) +} + +// SupplierAddressCityContainsFold applies the ContainsFold predicate on the "supplier_address_city" field. +func SupplierAddressCityContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressCity, v)) +} + +// SupplierAddressLine1EQ applies the EQ predicate on the "supplier_address_line1" field. +func SupplierAddressLine1EQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1NEQ applies the NEQ predicate on the "supplier_address_line1" field. +func SupplierAddressLine1NEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1In applies the In predicate on the "supplier_address_line1" field. +func SupplierAddressLine1In(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressLine1, vs...)) +} + +// SupplierAddressLine1NotIn applies the NotIn predicate on the "supplier_address_line1" field. +func SupplierAddressLine1NotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressLine1, vs...)) +} + +// SupplierAddressLine1GT applies the GT predicate on the "supplier_address_line1" field. +func SupplierAddressLine1GT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1GTE applies the GTE predicate on the "supplier_address_line1" field. +func SupplierAddressLine1GTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1LT applies the LT predicate on the "supplier_address_line1" field. +func SupplierAddressLine1LT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1LTE applies the LTE predicate on the "supplier_address_line1" field. +func SupplierAddressLine1LTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1Contains applies the Contains predicate on the "supplier_address_line1" field. +func SupplierAddressLine1Contains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1HasPrefix applies the HasPrefix predicate on the "supplier_address_line1" field. +func SupplierAddressLine1HasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1HasSuffix applies the HasSuffix predicate on the "supplier_address_line1" field. +func SupplierAddressLine1HasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1IsNil applies the IsNil predicate on the "supplier_address_line1" field. +func SupplierAddressLine1IsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressLine1)) +} + +// SupplierAddressLine1NotNil applies the NotNil predicate on the "supplier_address_line1" field. +func SupplierAddressLine1NotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressLine1)) +} + +// SupplierAddressLine1EqualFold applies the EqualFold predicate on the "supplier_address_line1" field. +func SupplierAddressLine1EqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine1ContainsFold applies the ContainsFold predicate on the "supplier_address_line1" field. +func SupplierAddressLine1ContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressLine1, v)) +} + +// SupplierAddressLine2EQ applies the EQ predicate on the "supplier_address_line2" field. +func SupplierAddressLine2EQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2NEQ applies the NEQ predicate on the "supplier_address_line2" field. +func SupplierAddressLine2NEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2In applies the In predicate on the "supplier_address_line2" field. +func SupplierAddressLine2In(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressLine2, vs...)) +} + +// SupplierAddressLine2NotIn applies the NotIn predicate on the "supplier_address_line2" field. +func SupplierAddressLine2NotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressLine2, vs...)) +} + +// SupplierAddressLine2GT applies the GT predicate on the "supplier_address_line2" field. +func SupplierAddressLine2GT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2GTE applies the GTE predicate on the "supplier_address_line2" field. +func SupplierAddressLine2GTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2LT applies the LT predicate on the "supplier_address_line2" field. +func SupplierAddressLine2LT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2LTE applies the LTE predicate on the "supplier_address_line2" field. +func SupplierAddressLine2LTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2Contains applies the Contains predicate on the "supplier_address_line2" field. +func SupplierAddressLine2Contains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2HasPrefix applies the HasPrefix predicate on the "supplier_address_line2" field. +func SupplierAddressLine2HasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2HasSuffix applies the HasSuffix predicate on the "supplier_address_line2" field. +func SupplierAddressLine2HasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2IsNil applies the IsNil predicate on the "supplier_address_line2" field. +func SupplierAddressLine2IsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressLine2)) +} + +// SupplierAddressLine2NotNil applies the NotNil predicate on the "supplier_address_line2" field. +func SupplierAddressLine2NotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressLine2)) +} + +// SupplierAddressLine2EqualFold applies the EqualFold predicate on the "supplier_address_line2" field. +func SupplierAddressLine2EqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressLine2ContainsFold applies the ContainsFold predicate on the "supplier_address_line2" field. +func SupplierAddressLine2ContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressLine2, v)) +} + +// SupplierAddressPhoneNumberEQ applies the EQ predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberNEQ applies the NEQ predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberIn applies the In predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierAddressPhoneNumber, vs...)) +} + +// SupplierAddressPhoneNumberNotIn applies the NotIn predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierAddressPhoneNumber, vs...)) +} + +// SupplierAddressPhoneNumberGT applies the GT predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberGTE applies the GTE predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberLT applies the LT predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberLTE applies the LTE predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberContains applies the Contains predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberHasPrefix applies the HasPrefix predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberHasSuffix applies the HasSuffix predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberIsNil applies the IsNil predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierAddressPhoneNumber)) +} + +// SupplierAddressPhoneNumberNotNil applies the NotNil predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierAddressPhoneNumber)) +} + +// SupplierAddressPhoneNumberEqualFold applies the EqualFold predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierAddressPhoneNumber, v)) +} + +// SupplierAddressPhoneNumberContainsFold applies the ContainsFold predicate on the "supplier_address_phone_number" field. +func SupplierAddressPhoneNumberContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierAddressPhoneNumber, v)) +} + +// CustomerAddressCountryEQ applies the EQ predicate on the "customer_address_country" field. +func CustomerAddressCountryEQ(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryNEQ applies the NEQ predicate on the "customer_address_country" field. +func CustomerAddressCountryNEQ(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryIn applies the In predicate on the "customer_address_country" field. +func CustomerAddressCountryIn(vs ...models.CountryCode) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressCountry, v...)) +} + +// CustomerAddressCountryNotIn applies the NotIn predicate on the "customer_address_country" field. +func CustomerAddressCountryNotIn(vs ...models.CountryCode) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressCountry, v...)) +} + +// CustomerAddressCountryGT applies the GT predicate on the "customer_address_country" field. +func CustomerAddressCountryGT(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryGTE applies the GTE predicate on the "customer_address_country" field. +func CustomerAddressCountryGTE(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryLT applies the LT predicate on the "customer_address_country" field. +func CustomerAddressCountryLT(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryLTE applies the LTE predicate on the "customer_address_country" field. +func CustomerAddressCountryLTE(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryContains applies the Contains predicate on the "customer_address_country" field. +func CustomerAddressCountryContains(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryHasPrefix applies the HasPrefix predicate on the "customer_address_country" field. +func CustomerAddressCountryHasPrefix(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryHasSuffix applies the HasSuffix predicate on the "customer_address_country" field. +func CustomerAddressCountryHasSuffix(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryIsNil applies the IsNil predicate on the "customer_address_country" field. +func CustomerAddressCountryIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressCountry)) +} + +// CustomerAddressCountryNotNil applies the NotNil predicate on the "customer_address_country" field. +func CustomerAddressCountryNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressCountry)) +} + +// CustomerAddressCountryEqualFold applies the EqualFold predicate on the "customer_address_country" field. +func CustomerAddressCountryEqualFold(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressCountryContainsFold applies the ContainsFold predicate on the "customer_address_country" field. +func CustomerAddressCountryContainsFold(v models.CountryCode) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressCountry, vc)) +} + +// CustomerAddressPostalCodeEQ applies the EQ predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeNEQ applies the NEQ predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeIn applies the In predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressPostalCode, vs...)) +} + +// CustomerAddressPostalCodeNotIn applies the NotIn predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressPostalCode, vs...)) +} + +// CustomerAddressPostalCodeGT applies the GT predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeGTE applies the GTE predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeLT applies the LT predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeLTE applies the LTE predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeContains applies the Contains predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeHasPrefix applies the HasPrefix predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeHasSuffix applies the HasSuffix predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeIsNil applies the IsNil predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressPostalCode)) +} + +// CustomerAddressPostalCodeNotNil applies the NotNil predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressPostalCode)) +} + +// CustomerAddressPostalCodeEqualFold applies the EqualFold predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressPostalCodeContainsFold applies the ContainsFold predicate on the "customer_address_postal_code" field. +func CustomerAddressPostalCodeContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressPostalCode, v)) +} + +// CustomerAddressStateEQ applies the EQ predicate on the "customer_address_state" field. +func CustomerAddressStateEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateNEQ applies the NEQ predicate on the "customer_address_state" field. +func CustomerAddressStateNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateIn applies the In predicate on the "customer_address_state" field. +func CustomerAddressStateIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressState, vs...)) +} + +// CustomerAddressStateNotIn applies the NotIn predicate on the "customer_address_state" field. +func CustomerAddressStateNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressState, vs...)) +} + +// CustomerAddressStateGT applies the GT predicate on the "customer_address_state" field. +func CustomerAddressStateGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateGTE applies the GTE predicate on the "customer_address_state" field. +func CustomerAddressStateGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateLT applies the LT predicate on the "customer_address_state" field. +func CustomerAddressStateLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateLTE applies the LTE predicate on the "customer_address_state" field. +func CustomerAddressStateLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateContains applies the Contains predicate on the "customer_address_state" field. +func CustomerAddressStateContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateHasPrefix applies the HasPrefix predicate on the "customer_address_state" field. +func CustomerAddressStateHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateHasSuffix applies the HasSuffix predicate on the "customer_address_state" field. +func CustomerAddressStateHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateIsNil applies the IsNil predicate on the "customer_address_state" field. +func CustomerAddressStateIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressState)) +} + +// CustomerAddressStateNotNil applies the NotNil predicate on the "customer_address_state" field. +func CustomerAddressStateNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressState)) +} + +// CustomerAddressStateEqualFold applies the EqualFold predicate on the "customer_address_state" field. +func CustomerAddressStateEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressState, v)) +} + +// CustomerAddressStateContainsFold applies the ContainsFold predicate on the "customer_address_state" field. +func CustomerAddressStateContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressState, v)) +} + +// CustomerAddressCityEQ applies the EQ predicate on the "customer_address_city" field. +func CustomerAddressCityEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityNEQ applies the NEQ predicate on the "customer_address_city" field. +func CustomerAddressCityNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityIn applies the In predicate on the "customer_address_city" field. +func CustomerAddressCityIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressCity, vs...)) +} + +// CustomerAddressCityNotIn applies the NotIn predicate on the "customer_address_city" field. +func CustomerAddressCityNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressCity, vs...)) +} + +// CustomerAddressCityGT applies the GT predicate on the "customer_address_city" field. +func CustomerAddressCityGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityGTE applies the GTE predicate on the "customer_address_city" field. +func CustomerAddressCityGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityLT applies the LT predicate on the "customer_address_city" field. +func CustomerAddressCityLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityLTE applies the LTE predicate on the "customer_address_city" field. +func CustomerAddressCityLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityContains applies the Contains predicate on the "customer_address_city" field. +func CustomerAddressCityContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityHasPrefix applies the HasPrefix predicate on the "customer_address_city" field. +func CustomerAddressCityHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityHasSuffix applies the HasSuffix predicate on the "customer_address_city" field. +func CustomerAddressCityHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityIsNil applies the IsNil predicate on the "customer_address_city" field. +func CustomerAddressCityIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressCity)) +} + +// CustomerAddressCityNotNil applies the NotNil predicate on the "customer_address_city" field. +func CustomerAddressCityNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressCity)) +} + +// CustomerAddressCityEqualFold applies the EqualFold predicate on the "customer_address_city" field. +func CustomerAddressCityEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressCity, v)) +} + +// CustomerAddressCityContainsFold applies the ContainsFold predicate on the "customer_address_city" field. +func CustomerAddressCityContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressCity, v)) +} + +// CustomerAddressLine1EQ applies the EQ predicate on the "customer_address_line1" field. +func CustomerAddressLine1EQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1NEQ applies the NEQ predicate on the "customer_address_line1" field. +func CustomerAddressLine1NEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1In applies the In predicate on the "customer_address_line1" field. +func CustomerAddressLine1In(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressLine1, vs...)) +} + +// CustomerAddressLine1NotIn applies the NotIn predicate on the "customer_address_line1" field. +func CustomerAddressLine1NotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressLine1, vs...)) +} + +// CustomerAddressLine1GT applies the GT predicate on the "customer_address_line1" field. +func CustomerAddressLine1GT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1GTE applies the GTE predicate on the "customer_address_line1" field. +func CustomerAddressLine1GTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1LT applies the LT predicate on the "customer_address_line1" field. +func CustomerAddressLine1LT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1LTE applies the LTE predicate on the "customer_address_line1" field. +func CustomerAddressLine1LTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1Contains applies the Contains predicate on the "customer_address_line1" field. +func CustomerAddressLine1Contains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1HasPrefix applies the HasPrefix predicate on the "customer_address_line1" field. +func CustomerAddressLine1HasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1HasSuffix applies the HasSuffix predicate on the "customer_address_line1" field. +func CustomerAddressLine1HasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1IsNil applies the IsNil predicate on the "customer_address_line1" field. +func CustomerAddressLine1IsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressLine1)) +} + +// CustomerAddressLine1NotNil applies the NotNil predicate on the "customer_address_line1" field. +func CustomerAddressLine1NotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressLine1)) +} + +// CustomerAddressLine1EqualFold applies the EqualFold predicate on the "customer_address_line1" field. +func CustomerAddressLine1EqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine1ContainsFold applies the ContainsFold predicate on the "customer_address_line1" field. +func CustomerAddressLine1ContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressLine1, v)) +} + +// CustomerAddressLine2EQ applies the EQ predicate on the "customer_address_line2" field. +func CustomerAddressLine2EQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2NEQ applies the NEQ predicate on the "customer_address_line2" field. +func CustomerAddressLine2NEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2In applies the In predicate on the "customer_address_line2" field. +func CustomerAddressLine2In(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressLine2, vs...)) +} + +// CustomerAddressLine2NotIn applies the NotIn predicate on the "customer_address_line2" field. +func CustomerAddressLine2NotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressLine2, vs...)) +} + +// CustomerAddressLine2GT applies the GT predicate on the "customer_address_line2" field. +func CustomerAddressLine2GT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2GTE applies the GTE predicate on the "customer_address_line2" field. +func CustomerAddressLine2GTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2LT applies the LT predicate on the "customer_address_line2" field. +func CustomerAddressLine2LT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2LTE applies the LTE predicate on the "customer_address_line2" field. +func CustomerAddressLine2LTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2Contains applies the Contains predicate on the "customer_address_line2" field. +func CustomerAddressLine2Contains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2HasPrefix applies the HasPrefix predicate on the "customer_address_line2" field. +func CustomerAddressLine2HasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2HasSuffix applies the HasSuffix predicate on the "customer_address_line2" field. +func CustomerAddressLine2HasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2IsNil applies the IsNil predicate on the "customer_address_line2" field. +func CustomerAddressLine2IsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressLine2)) +} + +// CustomerAddressLine2NotNil applies the NotNil predicate on the "customer_address_line2" field. +func CustomerAddressLine2NotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressLine2)) +} + +// CustomerAddressLine2EqualFold applies the EqualFold predicate on the "customer_address_line2" field. +func CustomerAddressLine2EqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressLine2ContainsFold applies the ContainsFold predicate on the "customer_address_line2" field. +func CustomerAddressLine2ContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressLine2, v)) +} + +// CustomerAddressPhoneNumberEQ applies the EQ predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberNEQ applies the NEQ predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberIn applies the In predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerAddressPhoneNumber, vs...)) +} + +// CustomerAddressPhoneNumberNotIn applies the NotIn predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerAddressPhoneNumber, vs...)) +} + +// CustomerAddressPhoneNumberGT applies the GT predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberGTE applies the GTE predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberLT applies the LT predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberLTE applies the LTE predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberContains applies the Contains predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberHasPrefix applies the HasPrefix predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberHasSuffix applies the HasSuffix predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberIsNil applies the IsNil predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerAddressPhoneNumber)) +} + +// CustomerAddressPhoneNumberNotNil applies the NotNil predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerAddressPhoneNumber)) +} + +// CustomerAddressPhoneNumberEqualFold applies the EqualFold predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerAddressPhoneNumber, v)) +} + +// CustomerAddressPhoneNumberContainsFold applies the ContainsFold predicate on the "customer_address_phone_number" field. +func CustomerAddressPhoneNumberContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerAddressPhoneNumber, v)) +} + +// SupplierNameEQ applies the EQ predicate on the "supplier_name" field. +func SupplierNameEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierName, v)) +} + +// SupplierNameNEQ applies the NEQ predicate on the "supplier_name" field. +func SupplierNameNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierName, v)) +} + +// SupplierNameIn applies the In predicate on the "supplier_name" field. +func SupplierNameIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierName, vs...)) +} + +// SupplierNameNotIn applies the NotIn predicate on the "supplier_name" field. +func SupplierNameNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierName, vs...)) +} + +// SupplierNameGT applies the GT predicate on the "supplier_name" field. +func SupplierNameGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierName, v)) +} + +// SupplierNameGTE applies the GTE predicate on the "supplier_name" field. +func SupplierNameGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierName, v)) +} + +// SupplierNameLT applies the LT predicate on the "supplier_name" field. +func SupplierNameLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierName, v)) +} + +// SupplierNameLTE applies the LTE predicate on the "supplier_name" field. +func SupplierNameLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierName, v)) +} + +// SupplierNameContains applies the Contains predicate on the "supplier_name" field. +func SupplierNameContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierName, v)) +} + +// SupplierNameHasPrefix applies the HasPrefix predicate on the "supplier_name" field. +func SupplierNameHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierName, v)) +} + +// SupplierNameHasSuffix applies the HasSuffix predicate on the "supplier_name" field. +func SupplierNameHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierName, v)) +} + +// SupplierNameEqualFold applies the EqualFold predicate on the "supplier_name" field. +func SupplierNameEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierName, v)) +} + +// SupplierNameContainsFold applies the ContainsFold predicate on the "supplier_name" field. +func SupplierNameContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierName, v)) +} + +// SupplierTaxCodeEQ applies the EQ predicate on the "supplier_tax_code" field. +func SupplierTaxCodeEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeNEQ applies the NEQ predicate on the "supplier_tax_code" field. +func SupplierTaxCodeNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeIn applies the In predicate on the "supplier_tax_code" field. +func SupplierTaxCodeIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSupplierTaxCode, vs...)) +} + +// SupplierTaxCodeNotIn applies the NotIn predicate on the "supplier_tax_code" field. +func SupplierTaxCodeNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSupplierTaxCode, vs...)) +} + +// SupplierTaxCodeGT applies the GT predicate on the "supplier_tax_code" field. +func SupplierTaxCodeGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeGTE applies the GTE predicate on the "supplier_tax_code" field. +func SupplierTaxCodeGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeLT applies the LT predicate on the "supplier_tax_code" field. +func SupplierTaxCodeLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeLTE applies the LTE predicate on the "supplier_tax_code" field. +func SupplierTaxCodeLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeContains applies the Contains predicate on the "supplier_tax_code" field. +func SupplierTaxCodeContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeHasPrefix applies the HasPrefix predicate on the "supplier_tax_code" field. +func SupplierTaxCodeHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeHasSuffix applies the HasSuffix predicate on the "supplier_tax_code" field. +func SupplierTaxCodeHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeIsNil applies the IsNil predicate on the "supplier_tax_code" field. +func SupplierTaxCodeIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldSupplierTaxCode)) +} + +// SupplierTaxCodeNotNil applies the NotNil predicate on the "supplier_tax_code" field. +func SupplierTaxCodeNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldSupplierTaxCode)) +} + +// SupplierTaxCodeEqualFold applies the EqualFold predicate on the "supplier_tax_code" field. +func SupplierTaxCodeEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSupplierTaxCode, v)) +} + +// SupplierTaxCodeContainsFold applies the ContainsFold predicate on the "supplier_tax_code" field. +func SupplierTaxCodeContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSupplierTaxCode, v)) +} + +// CustomerNameEQ applies the EQ predicate on the "customer_name" field. +func CustomerNameEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerName, v)) +} + +// CustomerNameNEQ applies the NEQ predicate on the "customer_name" field. +func CustomerNameNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerName, v)) +} + +// CustomerNameIn applies the In predicate on the "customer_name" field. +func CustomerNameIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerName, vs...)) +} + +// CustomerNameNotIn applies the NotIn predicate on the "customer_name" field. +func CustomerNameNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerName, vs...)) +} + +// CustomerNameGT applies the GT predicate on the "customer_name" field. +func CustomerNameGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerName, v)) +} + +// CustomerNameGTE applies the GTE predicate on the "customer_name" field. +func CustomerNameGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerName, v)) +} + +// CustomerNameLT applies the LT predicate on the "customer_name" field. +func CustomerNameLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerName, v)) +} + +// CustomerNameLTE applies the LTE predicate on the "customer_name" field. +func CustomerNameLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerName, v)) +} + +// CustomerNameContains applies the Contains predicate on the "customer_name" field. +func CustomerNameContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerName, v)) +} + +// CustomerNameHasPrefix applies the HasPrefix predicate on the "customer_name" field. +func CustomerNameHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerName, v)) +} + +// CustomerNameHasSuffix applies the HasSuffix predicate on the "customer_name" field. +func CustomerNameHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerName, v)) +} + +// CustomerNameEqualFold applies the EqualFold predicate on the "customer_name" field. +func CustomerNameEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerName, v)) +} + +// CustomerNameContainsFold applies the ContainsFold predicate on the "customer_name" field. +func CustomerNameContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerName, v)) +} + +// CustomerTimezoneEQ applies the EQ predicate on the "customer_timezone" field. +func CustomerTimezoneEQ(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCustomerTimezone, vc)) } -// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. -func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldUpdatedAt, vs...)) +// CustomerTimezoneNEQ applies the NEQ predicate on the "customer_timezone" field. +func CustomerTimezoneNEQ(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldNEQ(FieldCustomerTimezone, vc)) } -// UpdatedAtGT applies the GT predicate on the "updated_at" field. -func UpdatedAtGT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldUpdatedAt, v)) +// CustomerTimezoneIn applies the In predicate on the "customer_timezone" field. +func CustomerTimezoneIn(vs ...timezone.Timezone) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldIn(FieldCustomerTimezone, v...)) } -// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. -func UpdatedAtGTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldUpdatedAt, v)) +// CustomerTimezoneNotIn applies the NotIn predicate on the "customer_timezone" field. +func CustomerTimezoneNotIn(vs ...timezone.Timezone) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldNotIn(FieldCustomerTimezone, v...)) } -// UpdatedAtLT applies the LT predicate on the "updated_at" field. -func UpdatedAtLT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldUpdatedAt, v)) +// CustomerTimezoneGT applies the GT predicate on the "customer_timezone" field. +func CustomerTimezoneGT(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGT(FieldCustomerTimezone, vc)) } -// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. -func UpdatedAtLTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldUpdatedAt, v)) +// CustomerTimezoneGTE applies the GTE predicate on the "customer_timezone" field. +func CustomerTimezoneGTE(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGTE(FieldCustomerTimezone, vc)) } -// DeletedAtEQ applies the EQ predicate on the "deleted_at" field. -func DeletedAtEQ(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldDeletedAt, v)) +// CustomerTimezoneLT applies the LT predicate on the "customer_timezone" field. +func CustomerTimezoneLT(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLT(FieldCustomerTimezone, vc)) } -// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field. -func DeletedAtNEQ(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldDeletedAt, v)) +// CustomerTimezoneLTE applies the LTE predicate on the "customer_timezone" field. +func CustomerTimezoneLTE(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLTE(FieldCustomerTimezone, vc)) } -// DeletedAtIn applies the In predicate on the "deleted_at" field. -func DeletedAtIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldDeletedAt, vs...)) +// CustomerTimezoneContains applies the Contains predicate on the "customer_timezone" field. +func CustomerTimezoneContains(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContains(FieldCustomerTimezone, vc)) } -// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field. -func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldDeletedAt, vs...)) +// CustomerTimezoneHasPrefix applies the HasPrefix predicate on the "customer_timezone" field. +func CustomerTimezoneHasPrefix(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCustomerTimezone, vc)) } -// DeletedAtGT applies the GT predicate on the "deleted_at" field. -func DeletedAtGT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldDeletedAt, v)) +// CustomerTimezoneHasSuffix applies the HasSuffix predicate on the "customer_timezone" field. +func CustomerTimezoneHasSuffix(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCustomerTimezone, vc)) } -// DeletedAtGTE applies the GTE predicate on the "deleted_at" field. -func DeletedAtGTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldDeletedAt, v)) +// CustomerTimezoneIsNil applies the IsNil predicate on the "customer_timezone" field. +func CustomerTimezoneIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldCustomerTimezone)) } -// DeletedAtLT applies the LT predicate on the "deleted_at" field. -func DeletedAtLT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldDeletedAt, v)) +// CustomerTimezoneNotNil applies the NotNil predicate on the "customer_timezone" field. +func CustomerTimezoneNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldCustomerTimezone)) } -// DeletedAtLTE applies the LTE predicate on the "deleted_at" field. -func DeletedAtLTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldDeletedAt, v)) +// CustomerTimezoneEqualFold applies the EqualFold predicate on the "customer_timezone" field. +func CustomerTimezoneEqualFold(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCustomerTimezone, vc)) } -// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field. -func DeletedAtIsNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIsNull(FieldDeletedAt)) +// CustomerTimezoneContainsFold applies the ContainsFold predicate on the "customer_timezone" field. +func CustomerTimezoneContainsFold(v timezone.Timezone) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerTimezone, vc)) } -// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field. -func DeletedAtNotNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotNull(FieldDeletedAt)) +// NumberEQ applies the EQ predicate on the "number" field. +func NumberEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldNumber, v)) } -// MetadataIsNil applies the IsNil predicate on the "metadata" field. -func MetadataIsNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIsNull(FieldMetadata)) +// NumberNEQ applies the NEQ predicate on the "number" field. +func NumberNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldNumber, v)) } -// MetadataNotNil applies the NotNil predicate on the "metadata" field. -func MetadataNotNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotNull(FieldMetadata)) +// NumberIn applies the In predicate on the "number" field. +func NumberIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldNumber, vs...)) } -// SeriesEQ applies the EQ predicate on the "series" field. -func SeriesEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldSeries, v)) +// NumberNotIn applies the NotIn predicate on the "number" field. +func NumberNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldNumber, vs...)) } -// SeriesNEQ applies the NEQ predicate on the "series" field. -func SeriesNEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldSeries, v)) +// NumberGT applies the GT predicate on the "number" field. +func NumberGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldNumber, v)) } -// SeriesIn applies the In predicate on the "series" field. -func SeriesIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldSeries, vs...)) +// NumberGTE applies the GTE predicate on the "number" field. +func NumberGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldNumber, v)) } -// SeriesNotIn applies the NotIn predicate on the "series" field. -func SeriesNotIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldSeries, vs...)) +// NumberLT applies the LT predicate on the "number" field. +func NumberLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldNumber, v)) } -// SeriesGT applies the GT predicate on the "series" field. -func SeriesGT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldSeries, v)) +// NumberLTE applies the LTE predicate on the "number" field. +func NumberLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldNumber, v)) } -// SeriesGTE applies the GTE predicate on the "series" field. -func SeriesGTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldSeries, v)) +// NumberContains applies the Contains predicate on the "number" field. +func NumberContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldNumber, v)) } -// SeriesLT applies the LT predicate on the "series" field. -func SeriesLT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldSeries, v)) +// NumberHasPrefix applies the HasPrefix predicate on the "number" field. +func NumberHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldNumber, v)) } -// SeriesLTE applies the LTE predicate on the "series" field. -func SeriesLTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldSeries, v)) +// NumberHasSuffix applies the HasSuffix predicate on the "number" field. +func NumberHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldNumber, v)) } -// SeriesContains applies the Contains predicate on the "series" field. -func SeriesContains(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContains(FieldSeries, v)) +// NumberIsNil applies the IsNil predicate on the "number" field. +func NumberIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldNumber)) } -// SeriesHasPrefix applies the HasPrefix predicate on the "series" field. -func SeriesHasPrefix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSeries, v)) +// NumberNotNil applies the NotNil predicate on the "number" field. +func NumberNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldNumber)) } -// SeriesHasSuffix applies the HasSuffix predicate on the "series" field. -func SeriesHasSuffix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSeries, v)) +// NumberEqualFold applies the EqualFold predicate on the "number" field. +func NumberEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldNumber, v)) } -// SeriesIsNil applies the IsNil predicate on the "series" field. -func SeriesIsNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIsNull(FieldSeries)) +// NumberContainsFold applies the ContainsFold predicate on the "number" field. +func NumberContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldNumber, v)) } -// SeriesNotNil applies the NotNil predicate on the "series" field. -func SeriesNotNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotNull(FieldSeries)) +// TypeEQ applies the EQ predicate on the "type" field. +func TypeEQ(v billingentity.InvoiceType) predicate.BillingInvoice { + vc := v + return predicate.BillingInvoice(sql.FieldEQ(FieldType, vc)) +} + +// TypeNEQ applies the NEQ predicate on the "type" field. +func TypeNEQ(v billingentity.InvoiceType) predicate.BillingInvoice { + vc := v + return predicate.BillingInvoice(sql.FieldNEQ(FieldType, vc)) } -// SeriesEqualFold applies the EqualFold predicate on the "series" field. -func SeriesEqualFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEqualFold(FieldSeries, v)) +// TypeIn applies the In predicate on the "type" field. +func TypeIn(vs ...billingentity.InvoiceType) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoice(sql.FieldIn(FieldType, v...)) } -// SeriesContainsFold applies the ContainsFold predicate on the "series" field. -func SeriesContainsFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContainsFold(FieldSeries, v)) +// TypeNotIn applies the NotIn predicate on the "type" field. +func TypeNotIn(vs ...billingentity.InvoiceType) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoice(sql.FieldNotIn(FieldType, v...)) } -// CodeEQ applies the EQ predicate on the "code" field. -func CodeEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldCode, v)) +// DescriptionEQ applies the EQ predicate on the "description" field. +func DescriptionEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldDescription, v)) } -// CodeNEQ applies the NEQ predicate on the "code" field. -func CodeNEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldCode, v)) +// DescriptionNEQ applies the NEQ predicate on the "description" field. +func DescriptionNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldDescription, v)) } -// CodeIn applies the In predicate on the "code" field. -func CodeIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldCode, vs...)) +// DescriptionIn applies the In predicate on the "description" field. +func DescriptionIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldDescription, vs...)) } -// CodeNotIn applies the NotIn predicate on the "code" field. -func CodeNotIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldCode, vs...)) +// DescriptionNotIn applies the NotIn predicate on the "description" field. +func DescriptionNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldDescription, vs...)) } -// CodeGT applies the GT predicate on the "code" field. -func CodeGT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldCode, v)) +// DescriptionGT applies the GT predicate on the "description" field. +func DescriptionGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldDescription, v)) } -// CodeGTE applies the GTE predicate on the "code" field. -func CodeGTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldCode, v)) +// DescriptionGTE applies the GTE predicate on the "description" field. +func DescriptionGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldDescription, v)) } -// CodeLT applies the LT predicate on the "code" field. -func CodeLT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldCode, v)) +// DescriptionLT applies the LT predicate on the "description" field. +func DescriptionLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldDescription, v)) } -// CodeLTE applies the LTE predicate on the "code" field. -func CodeLTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldCode, v)) +// DescriptionLTE applies the LTE predicate on the "description" field. +func DescriptionLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldDescription, v)) } -// CodeContains applies the Contains predicate on the "code" field. -func CodeContains(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContains(FieldCode, v)) +// DescriptionContains applies the Contains predicate on the "description" field. +func DescriptionContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldDescription, v)) } -// CodeHasPrefix applies the HasPrefix predicate on the "code" field. -func CodeHasPrefix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCode, v)) +// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. +func DescriptionHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldDescription, v)) } -// CodeHasSuffix applies the HasSuffix predicate on the "code" field. -func CodeHasSuffix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCode, v)) +// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. +func DescriptionHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldDescription, v)) } -// CodeIsNil applies the IsNil predicate on the "code" field. -func CodeIsNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIsNull(FieldCode)) +// DescriptionIsNil applies the IsNil predicate on the "description" field. +func DescriptionIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldDescription)) } -// CodeNotNil applies the NotNil predicate on the "code" field. -func CodeNotNil() predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotNull(FieldCode)) +// DescriptionNotNil applies the NotNil predicate on the "description" field. +func DescriptionNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldDescription)) } -// CodeEqualFold applies the EqualFold predicate on the "code" field. -func CodeEqualFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEqualFold(FieldCode, v)) +// DescriptionEqualFold applies the EqualFold predicate on the "description" field. +func DescriptionEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldDescription, v)) } -// CodeContainsFold applies the ContainsFold predicate on the "code" field. -func CodeContainsFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContainsFold(FieldCode, v)) +// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. +func DescriptionContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldDescription, v)) } // CustomerIDEQ applies the EQ predicate on the "customer_id" field. @@ -556,69 +2090,69 @@ func CustomerIDContainsFold(v string) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldContainsFold(FieldCustomerID, v)) } -// BillingProfileIDEQ applies the EQ predicate on the "billing_profile_id" field. -func BillingProfileIDEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldBillingProfileID, v)) +// SourceBillingProfileIDEQ applies the EQ predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldSourceBillingProfileID, v)) } -// BillingProfileIDNEQ applies the NEQ predicate on the "billing_profile_id" field. -func BillingProfileIDNEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldBillingProfileID, v)) +// SourceBillingProfileIDNEQ applies the NEQ predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldSourceBillingProfileID, v)) } -// BillingProfileIDIn applies the In predicate on the "billing_profile_id" field. -func BillingProfileIDIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldBillingProfileID, vs...)) +// SourceBillingProfileIDIn applies the In predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldSourceBillingProfileID, vs...)) } -// BillingProfileIDNotIn applies the NotIn predicate on the "billing_profile_id" field. -func BillingProfileIDNotIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldBillingProfileID, vs...)) +// SourceBillingProfileIDNotIn applies the NotIn predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldSourceBillingProfileID, vs...)) } -// BillingProfileIDGT applies the GT predicate on the "billing_profile_id" field. -func BillingProfileIDGT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldBillingProfileID, v)) +// SourceBillingProfileIDGT applies the GT predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldSourceBillingProfileID, v)) } -// BillingProfileIDGTE applies the GTE predicate on the "billing_profile_id" field. -func BillingProfileIDGTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldBillingProfileID, v)) +// SourceBillingProfileIDGTE applies the GTE predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldSourceBillingProfileID, v)) } -// BillingProfileIDLT applies the LT predicate on the "billing_profile_id" field. -func BillingProfileIDLT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldBillingProfileID, v)) +// SourceBillingProfileIDLT applies the LT predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldSourceBillingProfileID, v)) } -// BillingProfileIDLTE applies the LTE predicate on the "billing_profile_id" field. -func BillingProfileIDLTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldBillingProfileID, v)) +// SourceBillingProfileIDLTE applies the LTE predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldSourceBillingProfileID, v)) } -// BillingProfileIDContains applies the Contains predicate on the "billing_profile_id" field. -func BillingProfileIDContains(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContains(FieldBillingProfileID, v)) +// SourceBillingProfileIDContains applies the Contains predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldSourceBillingProfileID, v)) } -// BillingProfileIDHasPrefix applies the HasPrefix predicate on the "billing_profile_id" field. -func BillingProfileIDHasPrefix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasPrefix(FieldBillingProfileID, v)) +// SourceBillingProfileIDHasPrefix applies the HasPrefix predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldSourceBillingProfileID, v)) } -// BillingProfileIDHasSuffix applies the HasSuffix predicate on the "billing_profile_id" field. -func BillingProfileIDHasSuffix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasSuffix(FieldBillingProfileID, v)) +// SourceBillingProfileIDHasSuffix applies the HasSuffix predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldSourceBillingProfileID, v)) } -// BillingProfileIDEqualFold applies the EqualFold predicate on the "billing_profile_id" field. -func BillingProfileIDEqualFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEqualFold(FieldBillingProfileID, v)) +// SourceBillingProfileIDEqualFold applies the EqualFold predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldSourceBillingProfileID, v)) } -// BillingProfileIDContainsFold applies the ContainsFold predicate on the "billing_profile_id" field. -func BillingProfileIDContainsFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContainsFold(FieldBillingProfileID, v)) +// SourceBillingProfileIDContainsFold applies the ContainsFold predicate on the "source_billing_profile_id" field. +func SourceBillingProfileIDContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldSourceBillingProfileID, v)) } // VoidedAtEQ applies the EQ predicate on the "voided_at" field. @@ -671,109 +2205,188 @@ func VoidedAtNotNil() predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldNotNull(FieldVoidedAt)) } +// IssuedAtEQ applies the EQ predicate on the "issued_at" field. +func IssuedAtEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldIssuedAt, v)) +} + +// IssuedAtNEQ applies the NEQ predicate on the "issued_at" field. +func IssuedAtNEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldIssuedAt, v)) +} + +// IssuedAtIn applies the In predicate on the "issued_at" field. +func IssuedAtIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldIssuedAt, vs...)) +} + +// IssuedAtNotIn applies the NotIn predicate on the "issued_at" field. +func IssuedAtNotIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldIssuedAt, vs...)) +} + +// IssuedAtGT applies the GT predicate on the "issued_at" field. +func IssuedAtGT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldIssuedAt, v)) +} + +// IssuedAtGTE applies the GTE predicate on the "issued_at" field. +func IssuedAtGTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldIssuedAt, v)) +} + +// IssuedAtLT applies the LT predicate on the "issued_at" field. +func IssuedAtLT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldIssuedAt, v)) +} + +// IssuedAtLTE applies the LTE predicate on the "issued_at" field. +func IssuedAtLTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldIssuedAt, v)) +} + +// IssuedAtIsNil applies the IsNil predicate on the "issued_at" field. +func IssuedAtIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldIssuedAt)) +} + +// IssuedAtNotNil applies the NotNil predicate on the "issued_at" field. +func IssuedAtNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldIssuedAt)) +} + // CurrencyEQ applies the EQ predicate on the "currency" field. -func CurrencyEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldCurrency, v)) +func CurrencyEQ(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEQ(FieldCurrency, vc)) } // CurrencyNEQ applies the NEQ predicate on the "currency" field. -func CurrencyNEQ(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldCurrency, v)) +func CurrencyNEQ(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldNEQ(FieldCurrency, vc)) } // CurrencyIn applies the In predicate on the "currency" field. -func CurrencyIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldCurrency, vs...)) +func CurrencyIn(vs ...currencyx.Code) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldIn(FieldCurrency, v...)) } // CurrencyNotIn applies the NotIn predicate on the "currency" field. -func CurrencyNotIn(vs ...string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldCurrency, vs...)) +func CurrencyNotIn(vs ...currencyx.Code) predicate.BillingInvoice { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoice(sql.FieldNotIn(FieldCurrency, v...)) } // CurrencyGT applies the GT predicate on the "currency" field. -func CurrencyGT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldCurrency, v)) +func CurrencyGT(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGT(FieldCurrency, vc)) } // CurrencyGTE applies the GTE predicate on the "currency" field. -func CurrencyGTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldCurrency, v)) +func CurrencyGTE(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldGTE(FieldCurrency, vc)) } // CurrencyLT applies the LT predicate on the "currency" field. -func CurrencyLT(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldCurrency, v)) +func CurrencyLT(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLT(FieldCurrency, vc)) } // CurrencyLTE applies the LTE predicate on the "currency" field. -func CurrencyLTE(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldCurrency, v)) +func CurrencyLTE(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldLTE(FieldCurrency, vc)) } // CurrencyContains applies the Contains predicate on the "currency" field. -func CurrencyContains(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContains(FieldCurrency, v)) +func CurrencyContains(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContains(FieldCurrency, vc)) } // CurrencyHasPrefix applies the HasPrefix predicate on the "currency" field. -func CurrencyHasPrefix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCurrency, v)) +func CurrencyHasPrefix(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldCurrency, vc)) } // CurrencyHasSuffix applies the HasSuffix predicate on the "currency" field. -func CurrencyHasSuffix(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCurrency, v)) +func CurrencyHasSuffix(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldCurrency, vc)) } // CurrencyEqualFold applies the EqualFold predicate on the "currency" field. -func CurrencyEqualFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEqualFold(FieldCurrency, v)) +func CurrencyEqualFold(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldEqualFold(FieldCurrency, vc)) } // CurrencyContainsFold applies the ContainsFold predicate on the "currency" field. -func CurrencyContainsFold(v string) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldContainsFold(FieldCurrency, v)) +func CurrencyContainsFold(v currencyx.Code) predicate.BillingInvoice { + vc := string(v) + return predicate.BillingInvoice(sql.FieldContainsFold(FieldCurrency, vc)) +} + +// DueAtEQ applies the EQ predicate on the "due_at" field. +func DueAtEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldDueAt, v)) } -// DueDateEQ applies the EQ predicate on the "due_date" field. -func DueDateEQ(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldEQ(FieldDueDate, v)) +// DueAtNEQ applies the NEQ predicate on the "due_at" field. +func DueAtNEQ(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldDueAt, v)) } -// DueDateNEQ applies the NEQ predicate on the "due_date" field. -func DueDateNEQ(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNEQ(FieldDueDate, v)) +// DueAtIn applies the In predicate on the "due_at" field. +func DueAtIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldDueAt, vs...)) } -// DueDateIn applies the In predicate on the "due_date" field. -func DueDateIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldIn(FieldDueDate, vs...)) +// DueAtNotIn applies the NotIn predicate on the "due_at" field. +func DueAtNotIn(vs ...time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldDueAt, vs...)) } -// DueDateNotIn applies the NotIn predicate on the "due_date" field. -func DueDateNotIn(vs ...time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldNotIn(FieldDueDate, vs...)) +// DueAtGT applies the GT predicate on the "due_at" field. +func DueAtGT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldDueAt, v)) } -// DueDateGT applies the GT predicate on the "due_date" field. -func DueDateGT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGT(FieldDueDate, v)) +// DueAtGTE applies the GTE predicate on the "due_at" field. +func DueAtGTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldDueAt, v)) } -// DueDateGTE applies the GTE predicate on the "due_date" field. -func DueDateGTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldGTE(FieldDueDate, v)) +// DueAtLT applies the LT predicate on the "due_at" field. +func DueAtLT(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldDueAt, v)) } -// DueDateLT applies the LT predicate on the "due_date" field. -func DueDateLT(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLT(FieldDueDate, v)) +// DueAtLTE applies the LTE predicate on the "due_at" field. +func DueAtLTE(v time.Time) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldDueAt, v)) } -// DueDateLTE applies the LTE predicate on the "due_date" field. -func DueDateLTE(v time.Time) predicate.BillingInvoice { - return predicate.BillingInvoice(sql.FieldLTE(FieldDueDate, v)) +// DueAtIsNil applies the IsNil predicate on the "due_at" field. +func DueAtIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldDueAt)) +} + +// DueAtNotNil applies the NotNil predicate on the "due_at" field. +func DueAtNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldDueAt)) } // StatusEQ applies the EQ predicate on the "status" field. @@ -871,6 +2484,201 @@ func WorkflowConfigIDContainsFold(v string) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldContainsFold(FieldWorkflowConfigID, v)) } +// TaxAppIDEQ applies the EQ predicate on the "tax_app_id" field. +func TaxAppIDEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldTaxAppID, v)) +} + +// TaxAppIDNEQ applies the NEQ predicate on the "tax_app_id" field. +func TaxAppIDNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldTaxAppID, v)) +} + +// TaxAppIDIn applies the In predicate on the "tax_app_id" field. +func TaxAppIDIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldTaxAppID, vs...)) +} + +// TaxAppIDNotIn applies the NotIn predicate on the "tax_app_id" field. +func TaxAppIDNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldTaxAppID, vs...)) +} + +// TaxAppIDGT applies the GT predicate on the "tax_app_id" field. +func TaxAppIDGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldTaxAppID, v)) +} + +// TaxAppIDGTE applies the GTE predicate on the "tax_app_id" field. +func TaxAppIDGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldTaxAppID, v)) +} + +// TaxAppIDLT applies the LT predicate on the "tax_app_id" field. +func TaxAppIDLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldTaxAppID, v)) +} + +// TaxAppIDLTE applies the LTE predicate on the "tax_app_id" field. +func TaxAppIDLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldTaxAppID, v)) +} + +// TaxAppIDContains applies the Contains predicate on the "tax_app_id" field. +func TaxAppIDContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldTaxAppID, v)) +} + +// TaxAppIDHasPrefix applies the HasPrefix predicate on the "tax_app_id" field. +func TaxAppIDHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldTaxAppID, v)) +} + +// TaxAppIDHasSuffix applies the HasSuffix predicate on the "tax_app_id" field. +func TaxAppIDHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldTaxAppID, v)) +} + +// TaxAppIDEqualFold applies the EqualFold predicate on the "tax_app_id" field. +func TaxAppIDEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldTaxAppID, v)) +} + +// TaxAppIDContainsFold applies the ContainsFold predicate on the "tax_app_id" field. +func TaxAppIDContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldTaxAppID, v)) +} + +// InvoicingAppIDEQ applies the EQ predicate on the "invoicing_app_id" field. +func InvoicingAppIDEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDNEQ applies the NEQ predicate on the "invoicing_app_id" field. +func InvoicingAppIDNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDIn applies the In predicate on the "invoicing_app_id" field. +func InvoicingAppIDIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldInvoicingAppID, vs...)) +} + +// InvoicingAppIDNotIn applies the NotIn predicate on the "invoicing_app_id" field. +func InvoicingAppIDNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldInvoicingAppID, vs...)) +} + +// InvoicingAppIDGT applies the GT predicate on the "invoicing_app_id" field. +func InvoicingAppIDGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDGTE applies the GTE predicate on the "invoicing_app_id" field. +func InvoicingAppIDGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDLT applies the LT predicate on the "invoicing_app_id" field. +func InvoicingAppIDLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDLTE applies the LTE predicate on the "invoicing_app_id" field. +func InvoicingAppIDLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDContains applies the Contains predicate on the "invoicing_app_id" field. +func InvoicingAppIDContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDHasPrefix applies the HasPrefix predicate on the "invoicing_app_id" field. +func InvoicingAppIDHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDHasSuffix applies the HasSuffix predicate on the "invoicing_app_id" field. +func InvoicingAppIDHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDEqualFold applies the EqualFold predicate on the "invoicing_app_id" field. +func InvoicingAppIDEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldInvoicingAppID, v)) +} + +// InvoicingAppIDContainsFold applies the ContainsFold predicate on the "invoicing_app_id" field. +func InvoicingAppIDContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldInvoicingAppID, v)) +} + +// PaymentAppIDEQ applies the EQ predicate on the "payment_app_id" field. +func PaymentAppIDEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEQ(FieldPaymentAppID, v)) +} + +// PaymentAppIDNEQ applies the NEQ predicate on the "payment_app_id" field. +func PaymentAppIDNEQ(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNEQ(FieldPaymentAppID, v)) +} + +// PaymentAppIDIn applies the In predicate on the "payment_app_id" field. +func PaymentAppIDIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIn(FieldPaymentAppID, vs...)) +} + +// PaymentAppIDNotIn applies the NotIn predicate on the "payment_app_id" field. +func PaymentAppIDNotIn(vs ...string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotIn(FieldPaymentAppID, vs...)) +} + +// PaymentAppIDGT applies the GT predicate on the "payment_app_id" field. +func PaymentAppIDGT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGT(FieldPaymentAppID, v)) +} + +// PaymentAppIDGTE applies the GTE predicate on the "payment_app_id" field. +func PaymentAppIDGTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldGTE(FieldPaymentAppID, v)) +} + +// PaymentAppIDLT applies the LT predicate on the "payment_app_id" field. +func PaymentAppIDLT(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLT(FieldPaymentAppID, v)) +} + +// PaymentAppIDLTE applies the LTE predicate on the "payment_app_id" field. +func PaymentAppIDLTE(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldLTE(FieldPaymentAppID, v)) +} + +// PaymentAppIDContains applies the Contains predicate on the "payment_app_id" field. +func PaymentAppIDContains(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContains(FieldPaymentAppID, v)) +} + +// PaymentAppIDHasPrefix applies the HasPrefix predicate on the "payment_app_id" field. +func PaymentAppIDHasPrefix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasPrefix(FieldPaymentAppID, v)) +} + +// PaymentAppIDHasSuffix applies the HasSuffix predicate on the "payment_app_id" field. +func PaymentAppIDHasSuffix(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldHasSuffix(FieldPaymentAppID, v)) +} + +// PaymentAppIDEqualFold applies the EqualFold predicate on the "payment_app_id" field. +func PaymentAppIDEqualFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldEqualFold(FieldPaymentAppID, v)) +} + +// PaymentAppIDContainsFold applies the ContainsFold predicate on the "payment_app_id" field. +func PaymentAppIDContainsFold(v string) predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldContainsFold(FieldPaymentAppID, v)) +} + // PeriodStartEQ applies the EQ predicate on the "period_start" field. func PeriodStartEQ(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldPeriodStart, v)) @@ -911,6 +2719,16 @@ func PeriodStartLTE(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldLTE(FieldPeriodStart, v)) } +// PeriodStartIsNil applies the IsNil predicate on the "period_start" field. +func PeriodStartIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldPeriodStart)) +} + +// PeriodStartNotNil applies the NotNil predicate on the "period_start" field. +func PeriodStartNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldPeriodStart)) +} + // PeriodEndEQ applies the EQ predicate on the "period_end" field. func PeriodEndEQ(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldEQ(FieldPeriodEnd, v)) @@ -951,21 +2769,31 @@ func PeriodEndLTE(v time.Time) predicate.BillingInvoice { return predicate.BillingInvoice(sql.FieldLTE(FieldPeriodEnd, v)) } -// HasBillingProfile applies the HasEdge predicate on the "billing_profile" edge. -func HasBillingProfile() predicate.BillingInvoice { +// PeriodEndIsNil applies the IsNil predicate on the "period_end" field. +func PeriodEndIsNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldIsNull(FieldPeriodEnd)) +} + +// PeriodEndNotNil applies the NotNil predicate on the "period_end" field. +func PeriodEndNotNil() predicate.BillingInvoice { + return predicate.BillingInvoice(sql.FieldNotNull(FieldPeriodEnd)) +} + +// HasSourceBillingProfile applies the HasEdge predicate on the "source_billing_profile" edge. +func HasSourceBillingProfile() predicate.BillingInvoice { return predicate.BillingInvoice(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, BillingProfileTable, BillingProfileColumn), + sqlgraph.Edge(sqlgraph.M2O, true, SourceBillingProfileTable, SourceBillingProfileColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasBillingProfileWith applies the HasEdge predicate on the "billing_profile" edge with a given conditions (other predicates). -func HasBillingProfileWith(preds ...predicate.BillingProfile) predicate.BillingInvoice { +// HasSourceBillingProfileWith applies the HasEdge predicate on the "source_billing_profile" edge with a given conditions (other predicates). +func HasSourceBillingProfileWith(preds ...predicate.BillingProfile) predicate.BillingInvoice { return predicate.BillingInvoice(func(s *sql.Selector) { - step := newBillingProfileStep() + step := newSourceBillingProfileStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) @@ -997,21 +2825,113 @@ func HasBillingWorkflowConfigWith(preds ...predicate.BillingWorkflowConfig) pred }) } -// HasBillingInvoiceItems applies the HasEdge predicate on the "billing_invoice_items" edge. -func HasBillingInvoiceItems() predicate.BillingInvoice { +// HasBillingInvoiceLines applies the HasEdge predicate on the "billing_invoice_lines" edge. +func HasBillingInvoiceLines() predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceLinesTable, BillingInvoiceLinesColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceLinesWith applies the HasEdge predicate on the "billing_invoice_lines" edge with a given conditions (other predicates). +func HasBillingInvoiceLinesWith(preds ...predicate.BillingInvoiceLine) predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := newBillingInvoiceLinesStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasBillingInvoiceCustomer applies the HasEdge predicate on the "billing_invoice_customer" edge. +func HasBillingInvoiceCustomer() predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceCustomerTable, BillingInvoiceCustomerColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceCustomerWith applies the HasEdge predicate on the "billing_invoice_customer" edge with a given conditions (other predicates). +func HasBillingInvoiceCustomerWith(preds ...predicate.Customer) predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := newBillingInvoiceCustomerStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasTaxApp applies the HasEdge predicate on the "tax_app" edge. +func HasTaxApp() predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, TaxAppTable, TaxAppColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasTaxAppWith applies the HasEdge predicate on the "tax_app" edge with a given conditions (other predicates). +func HasTaxAppWith(preds ...predicate.App) predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := newTaxAppStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasInvoicingApp applies the HasEdge predicate on the "invoicing_app" edge. +func HasInvoicingApp() predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, InvoicingAppTable, InvoicingAppColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasInvoicingAppWith applies the HasEdge predicate on the "invoicing_app" edge with a given conditions (other predicates). +func HasInvoicingAppWith(preds ...predicate.App) predicate.BillingInvoice { + return predicate.BillingInvoice(func(s *sql.Selector) { + step := newInvoicingAppStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasPaymentApp applies the HasEdge predicate on the "payment_app" edge. +func HasPaymentApp() predicate.BillingInvoice { return predicate.BillingInvoice(func(s *sql.Selector) { step := sqlgraph.NewStep( sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceItemsTable, BillingInvoiceItemsColumn), + sqlgraph.Edge(sqlgraph.M2O, true, PaymentAppTable, PaymentAppColumn), ) sqlgraph.HasNeighbors(s, step) }) } -// HasBillingInvoiceItemsWith applies the HasEdge predicate on the "billing_invoice_items" edge with a given conditions (other predicates). -func HasBillingInvoiceItemsWith(preds ...predicate.BillingInvoiceItem) predicate.BillingInvoice { +// HasPaymentAppWith applies the HasEdge predicate on the "payment_app" edge with a given conditions (other predicates). +func HasPaymentAppWith(preds ...predicate.App) predicate.BillingInvoice { return predicate.BillingInvoice(func(s *sql.Selector) { - step := newBillingInvoiceItemsStep() + step := newPaymentAppStep() sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { for _, p := range preds { p(s) diff --git a/openmeter/ent/db/billinginvoice_create.go b/openmeter/ent/db/billinginvoice_create.go index 60eb51c7a..d2cb6382c 100644 --- a/openmeter/ent/db/billinginvoice_create.go +++ b/openmeter/ent/db/billinginvoice_create.go @@ -13,10 +13,15 @@ import ( "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/customer" + "github.com/openmeterio/openmeter/pkg/currencyx" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/timezone" ) // BillingInvoiceCreate is the builder for creating a BillingInvoice entity. @@ -33,6 +38,12 @@ func (bic *BillingInvoiceCreate) SetNamespace(s string) *BillingInvoiceCreate { return bic } +// SetMetadata sets the "metadata" field. +func (bic *BillingInvoiceCreate) SetMetadata(m map[string]string) *BillingInvoiceCreate { + bic.mutation.SetMetadata(m) + return bic +} + // SetCreatedAt sets the "created_at" field. func (bic *BillingInvoiceCreate) SetCreatedAt(t time.Time) *BillingInvoiceCreate { bic.mutation.SetCreatedAt(t) @@ -75,36 +86,272 @@ func (bic *BillingInvoiceCreate) SetNillableDeletedAt(t *time.Time) *BillingInvo return bic } -// SetMetadata sets the "metadata" field. -func (bic *BillingInvoiceCreate) SetMetadata(m map[string]string) *BillingInvoiceCreate { - bic.mutation.SetMetadata(m) +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressCountry(mc models.CountryCode) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressCountry(mc) + return bic +} + +// SetNillableSupplierAddressCountry sets the "supplier_address_country" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressCountry(mc *models.CountryCode) *BillingInvoiceCreate { + if mc != nil { + bic.SetSupplierAddressCountry(*mc) + } + return bic +} + +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressPostalCode(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressPostalCode(s) + return bic +} + +// SetNillableSupplierAddressPostalCode sets the "supplier_address_postal_code" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressPostalCode(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressPostalCode(*s) + } + return bic +} + +// SetSupplierAddressState sets the "supplier_address_state" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressState(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressState(s) + return bic +} + +// SetNillableSupplierAddressState sets the "supplier_address_state" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressState(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressState(*s) + } + return bic +} + +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressCity(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressCity(s) + return bic +} + +// SetNillableSupplierAddressCity sets the "supplier_address_city" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressCity(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressCity(*s) + } + return bic +} + +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressLine1(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressLine1(s) + return bic +} + +// SetNillableSupplierAddressLine1 sets the "supplier_address_line1" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressLine1(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressLine1(*s) + } + return bic +} + +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressLine2(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressLine2(s) + return bic +} + +// SetNillableSupplierAddressLine2 sets the "supplier_address_line2" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressLine2(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressLine2(*s) + } + return bic +} + +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (bic *BillingInvoiceCreate) SetSupplierAddressPhoneNumber(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierAddressPhoneNumber(s) + return bic +} + +// SetNillableSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierAddressPhoneNumber(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierAddressPhoneNumber(*s) + } + return bic +} + +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressCountry(mc models.CountryCode) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressCountry(mc) + return bic +} + +// SetNillableCustomerAddressCountry sets the "customer_address_country" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressCountry(mc *models.CountryCode) *BillingInvoiceCreate { + if mc != nil { + bic.SetCustomerAddressCountry(*mc) + } + return bic +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressPostalCode(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressPostalCode(s) + return bic +} + +// SetNillableCustomerAddressPostalCode sets the "customer_address_postal_code" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressPostalCode(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressPostalCode(*s) + } + return bic +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressState(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressState(s) + return bic +} + +// SetNillableCustomerAddressState sets the "customer_address_state" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressState(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressState(*s) + } + return bic +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressCity(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressCity(s) + return bic +} + +// SetNillableCustomerAddressCity sets the "customer_address_city" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressCity(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressCity(*s) + } + return bic +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressLine1(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressLine1(s) + return bic +} + +// SetNillableCustomerAddressLine1 sets the "customer_address_line1" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressLine1(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressLine1(*s) + } + return bic +} + +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressLine2(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressLine2(s) + return bic +} + +// SetNillableCustomerAddressLine2 sets the "customer_address_line2" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressLine2(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressLine2(*s) + } + return bic +} + +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (bic *BillingInvoiceCreate) SetCustomerAddressPhoneNumber(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerAddressPhoneNumber(s) + return bic +} + +// SetNillableCustomerAddressPhoneNumber sets the "customer_address_phone_number" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerAddressPhoneNumber(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetCustomerAddressPhoneNumber(*s) + } + return bic +} + +// SetSupplierName sets the "supplier_name" field. +func (bic *BillingInvoiceCreate) SetSupplierName(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierName(s) + return bic +} + +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (bic *BillingInvoiceCreate) SetSupplierTaxCode(s string) *BillingInvoiceCreate { + bic.mutation.SetSupplierTaxCode(s) + return bic +} + +// SetNillableSupplierTaxCode sets the "supplier_tax_code" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableSupplierTaxCode(s *string) *BillingInvoiceCreate { + if s != nil { + bic.SetSupplierTaxCode(*s) + } + return bic +} + +// SetCustomerName sets the "customer_name" field. +func (bic *BillingInvoiceCreate) SetCustomerName(s string) *BillingInvoiceCreate { + bic.mutation.SetCustomerName(s) + return bic +} + +// SetCustomerTimezone sets the "customer_timezone" field. +func (bic *BillingInvoiceCreate) SetCustomerTimezone(t timezone.Timezone) *BillingInvoiceCreate { + bic.mutation.SetCustomerTimezone(t) + return bic +} + +// SetNillableCustomerTimezone sets the "customer_timezone" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableCustomerTimezone(t *timezone.Timezone) *BillingInvoiceCreate { + if t != nil { + bic.SetCustomerTimezone(*t) + } return bic } -// SetSeries sets the "series" field. -func (bic *BillingInvoiceCreate) SetSeries(s string) *BillingInvoiceCreate { - bic.mutation.SetSeries(s) +// SetNumber sets the "number" field. +func (bic *BillingInvoiceCreate) SetNumber(s string) *BillingInvoiceCreate { + bic.mutation.SetNumber(s) return bic } -// SetNillableSeries sets the "series" field if the given value is not nil. -func (bic *BillingInvoiceCreate) SetNillableSeries(s *string) *BillingInvoiceCreate { +// SetNillableNumber sets the "number" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableNumber(s *string) *BillingInvoiceCreate { if s != nil { - bic.SetSeries(*s) + bic.SetNumber(*s) } return bic } -// SetCode sets the "code" field. -func (bic *BillingInvoiceCreate) SetCode(s string) *BillingInvoiceCreate { - bic.mutation.SetCode(s) +// SetType sets the "type" field. +func (bic *BillingInvoiceCreate) SetType(bt billingentity.InvoiceType) *BillingInvoiceCreate { + bic.mutation.SetType(bt) + return bic +} + +// SetDescription sets the "description" field. +func (bic *BillingInvoiceCreate) SetDescription(s string) *BillingInvoiceCreate { + bic.mutation.SetDescription(s) return bic } -// SetNillableCode sets the "code" field if the given value is not nil. -func (bic *BillingInvoiceCreate) SetNillableCode(s *string) *BillingInvoiceCreate { +// SetNillableDescription sets the "description" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableDescription(s *string) *BillingInvoiceCreate { if s != nil { - bic.SetCode(*s) + bic.SetDescription(*s) } return bic } @@ -115,9 +362,9 @@ func (bic *BillingInvoiceCreate) SetCustomerID(s string) *BillingInvoiceCreate { return bic } -// SetBillingProfileID sets the "billing_profile_id" field. -func (bic *BillingInvoiceCreate) SetBillingProfileID(s string) *BillingInvoiceCreate { - bic.mutation.SetBillingProfileID(s) +// SetSourceBillingProfileID sets the "source_billing_profile_id" field. +func (bic *BillingInvoiceCreate) SetSourceBillingProfileID(s string) *BillingInvoiceCreate { + bic.mutation.SetSourceBillingProfileID(s) return bic } @@ -135,15 +382,37 @@ func (bic *BillingInvoiceCreate) SetNillableVoidedAt(t *time.Time) *BillingInvoi return bic } +// SetIssuedAt sets the "issued_at" field. +func (bic *BillingInvoiceCreate) SetIssuedAt(t time.Time) *BillingInvoiceCreate { + bic.mutation.SetIssuedAt(t) + return bic +} + +// SetNillableIssuedAt sets the "issued_at" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableIssuedAt(t *time.Time) *BillingInvoiceCreate { + if t != nil { + bic.SetIssuedAt(*t) + } + return bic +} + // SetCurrency sets the "currency" field. -func (bic *BillingInvoiceCreate) SetCurrency(s string) *BillingInvoiceCreate { - bic.mutation.SetCurrency(s) +func (bic *BillingInvoiceCreate) SetCurrency(c currencyx.Code) *BillingInvoiceCreate { + bic.mutation.SetCurrency(c) + return bic +} + +// SetDueAt sets the "due_at" field. +func (bic *BillingInvoiceCreate) SetDueAt(t time.Time) *BillingInvoiceCreate { + bic.mutation.SetDueAt(t) return bic } -// SetDueDate sets the "due_date" field. -func (bic *BillingInvoiceCreate) SetDueDate(t time.Time) *BillingInvoiceCreate { - bic.mutation.SetDueDate(t) +// SetNillableDueAt sets the "due_at" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillableDueAt(t *time.Time) *BillingInvoiceCreate { + if t != nil { + bic.SetDueAt(*t) + } return bic } @@ -159,18 +428,52 @@ func (bic *BillingInvoiceCreate) SetWorkflowConfigID(s string) *BillingInvoiceCr return bic } +// SetTaxAppID sets the "tax_app_id" field. +func (bic *BillingInvoiceCreate) SetTaxAppID(s string) *BillingInvoiceCreate { + bic.mutation.SetTaxAppID(s) + return bic +} + +// SetInvoicingAppID sets the "invoicing_app_id" field. +func (bic *BillingInvoiceCreate) SetInvoicingAppID(s string) *BillingInvoiceCreate { + bic.mutation.SetInvoicingAppID(s) + return bic +} + +// SetPaymentAppID sets the "payment_app_id" field. +func (bic *BillingInvoiceCreate) SetPaymentAppID(s string) *BillingInvoiceCreate { + bic.mutation.SetPaymentAppID(s) + return bic +} + // SetPeriodStart sets the "period_start" field. func (bic *BillingInvoiceCreate) SetPeriodStart(t time.Time) *BillingInvoiceCreate { bic.mutation.SetPeriodStart(t) return bic } +// SetNillablePeriodStart sets the "period_start" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillablePeriodStart(t *time.Time) *BillingInvoiceCreate { + if t != nil { + bic.SetPeriodStart(*t) + } + return bic +} + // SetPeriodEnd sets the "period_end" field. func (bic *BillingInvoiceCreate) SetPeriodEnd(t time.Time) *BillingInvoiceCreate { bic.mutation.SetPeriodEnd(t) return bic } +// SetNillablePeriodEnd sets the "period_end" field if the given value is not nil. +func (bic *BillingInvoiceCreate) SetNillablePeriodEnd(t *time.Time) *BillingInvoiceCreate { + if t != nil { + bic.SetPeriodEnd(*t) + } + return bic +} + // SetID sets the "id" field. func (bic *BillingInvoiceCreate) SetID(s string) *BillingInvoiceCreate { bic.mutation.SetID(s) @@ -185,9 +488,9 @@ func (bic *BillingInvoiceCreate) SetNillableID(s *string) *BillingInvoiceCreate return bic } -// SetBillingProfile sets the "billing_profile" edge to the BillingProfile entity. -func (bic *BillingInvoiceCreate) SetBillingProfile(b *BillingProfile) *BillingInvoiceCreate { - return bic.SetBillingProfileID(b.ID) +// SetSourceBillingProfile sets the "source_billing_profile" edge to the BillingProfile entity. +func (bic *BillingInvoiceCreate) SetSourceBillingProfile(b *BillingProfile) *BillingInvoiceCreate { + return bic.SetSourceBillingProfileID(b.ID) } // SetBillingWorkflowConfigID sets the "billing_workflow_config" edge to the BillingWorkflowConfig entity by ID. @@ -201,19 +504,45 @@ func (bic *BillingInvoiceCreate) SetBillingWorkflowConfig(b *BillingWorkflowConf return bic.SetBillingWorkflowConfigID(b.ID) } -// AddBillingInvoiceItemIDs adds the "billing_invoice_items" edge to the BillingInvoiceItem entity by IDs. -func (bic *BillingInvoiceCreate) AddBillingInvoiceItemIDs(ids ...string) *BillingInvoiceCreate { - bic.mutation.AddBillingInvoiceItemIDs(ids...) +// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs. +func (bic *BillingInvoiceCreate) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceCreate { + bic.mutation.AddBillingInvoiceLineIDs(ids...) return bic } -// AddBillingInvoiceItems adds the "billing_invoice_items" edges to the BillingInvoiceItem entity. -func (bic *BillingInvoiceCreate) AddBillingInvoiceItems(b ...*BillingInvoiceItem) *BillingInvoiceCreate { +// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity. +func (bic *BillingInvoiceCreate) AddBillingInvoiceLines(b ...*BillingInvoiceLine) *BillingInvoiceCreate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return bic.AddBillingInvoiceItemIDs(ids...) + return bic.AddBillingInvoiceLineIDs(ids...) +} + +// SetBillingInvoiceCustomerID sets the "billing_invoice_customer" edge to the Customer entity by ID. +func (bic *BillingInvoiceCreate) SetBillingInvoiceCustomerID(id string) *BillingInvoiceCreate { + bic.mutation.SetBillingInvoiceCustomerID(id) + return bic +} + +// SetBillingInvoiceCustomer sets the "billing_invoice_customer" edge to the Customer entity. +func (bic *BillingInvoiceCreate) SetBillingInvoiceCustomer(c *Customer) *BillingInvoiceCreate { + return bic.SetBillingInvoiceCustomerID(c.ID) +} + +// SetTaxApp sets the "tax_app" edge to the App entity. +func (bic *BillingInvoiceCreate) SetTaxApp(a *App) *BillingInvoiceCreate { + return bic.SetTaxAppID(a.ID) +} + +// SetInvoicingApp sets the "invoicing_app" edge to the App entity. +func (bic *BillingInvoiceCreate) SetInvoicingApp(a *App) *BillingInvoiceCreate { + return bic.SetInvoicingAppID(a.ID) +} + +// SetPaymentApp sets the "payment_app" edge to the App entity. +func (bic *BillingInvoiceCreate) SetPaymentApp(a *App) *BillingInvoiceCreate { + return bic.SetPaymentAppID(a.ID) } // Mutation returns the BillingInvoiceMutation object of the builder. @@ -281,6 +610,45 @@ func (bic *BillingInvoiceCreate) check() error { if _, ok := bic.mutation.UpdatedAt(); !ok { return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoice.updated_at"`)} } + if v, ok := bic.mutation.SupplierAddressCountry(); ok { + if err := billinginvoice.SupplierAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "supplier_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_address_country": %w`, err)} + } + } + if v, ok := bic.mutation.CustomerAddressCountry(); ok { + if err := billinginvoice.CustomerAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "customer_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_address_country": %w`, err)} + } + } + if _, ok := bic.mutation.SupplierName(); !ok { + return &ValidationError{Name: "supplier_name", err: errors.New(`db: missing required field "BillingInvoice.supplier_name"`)} + } + if v, ok := bic.mutation.SupplierName(); ok { + if err := billinginvoice.SupplierNameValidator(v); err != nil { + return &ValidationError{Name: "supplier_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_name": %w`, err)} + } + } + if _, ok := bic.mutation.CustomerName(); !ok { + return &ValidationError{Name: "customer_name", err: errors.New(`db: missing required field "BillingInvoice.customer_name"`)} + } + if v, ok := bic.mutation.CustomerName(); ok { + if err := billinginvoice.CustomerNameValidator(v); err != nil { + return &ValidationError{Name: "customer_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_name": %w`, err)} + } + } + if v, ok := bic.mutation.CustomerTimezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "customer_timezone", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_timezone": %w`, err)} + } + } + if _, ok := bic.mutation.GetType(); !ok { + return &ValidationError{Name: "type", err: errors.New(`db: missing required field "BillingInvoice.type"`)} + } + if v, ok := bic.mutation.GetType(); ok { + if err := billinginvoice.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.type": %w`, err)} + } + } if _, ok := bic.mutation.CustomerID(); !ok { return &ValidationError{Name: "customer_id", err: errors.New(`db: missing required field "BillingInvoice.customer_id"`)} } @@ -289,25 +657,22 @@ func (bic *BillingInvoiceCreate) check() error { return &ValidationError{Name: "customer_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_id": %w`, err)} } } - if _, ok := bic.mutation.BillingProfileID(); !ok { - return &ValidationError{Name: "billing_profile_id", err: errors.New(`db: missing required field "BillingInvoice.billing_profile_id"`)} + if _, ok := bic.mutation.SourceBillingProfileID(); !ok { + return &ValidationError{Name: "source_billing_profile_id", err: errors.New(`db: missing required field "BillingInvoice.source_billing_profile_id"`)} } - if v, ok := bic.mutation.BillingProfileID(); ok { - if err := billinginvoice.BillingProfileIDValidator(v); err != nil { - return &ValidationError{Name: "billing_profile_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.billing_profile_id": %w`, err)} + if v, ok := bic.mutation.SourceBillingProfileID(); ok { + if err := billinginvoice.SourceBillingProfileIDValidator(v); err != nil { + return &ValidationError{Name: "source_billing_profile_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.source_billing_profile_id": %w`, err)} } } if _, ok := bic.mutation.Currency(); !ok { return &ValidationError{Name: "currency", err: errors.New(`db: missing required field "BillingInvoice.currency"`)} } if v, ok := bic.mutation.Currency(); ok { - if err := billinginvoice.CurrencyValidator(v); err != nil { + if err := billinginvoice.CurrencyValidator(string(v)); err != nil { return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.currency": %w`, err)} } } - if _, ok := bic.mutation.DueDate(); !ok { - return &ValidationError{Name: "due_date", err: errors.New(`db: missing required field "BillingInvoice.due_date"`)} - } if _, ok := bic.mutation.Status(); !ok { return &ValidationError{Name: "status", err: errors.New(`db: missing required field "BillingInvoice.status"`)} } @@ -319,18 +684,33 @@ func (bic *BillingInvoiceCreate) check() error { if _, ok := bic.mutation.WorkflowConfigID(); !ok { return &ValidationError{Name: "workflow_config_id", err: errors.New(`db: missing required field "BillingInvoice.workflow_config_id"`)} } - if _, ok := bic.mutation.PeriodStart(); !ok { - return &ValidationError{Name: "period_start", err: errors.New(`db: missing required field "BillingInvoice.period_start"`)} + if _, ok := bic.mutation.TaxAppID(); !ok { + return &ValidationError{Name: "tax_app_id", err: errors.New(`db: missing required field "BillingInvoice.tax_app_id"`)} } - if _, ok := bic.mutation.PeriodEnd(); !ok { - return &ValidationError{Name: "period_end", err: errors.New(`db: missing required field "BillingInvoice.period_end"`)} + if _, ok := bic.mutation.InvoicingAppID(); !ok { + return &ValidationError{Name: "invoicing_app_id", err: errors.New(`db: missing required field "BillingInvoice.invoicing_app_id"`)} } - if len(bic.mutation.BillingProfileIDs()) == 0 { - return &ValidationError{Name: "billing_profile", err: errors.New(`db: missing required edge "BillingInvoice.billing_profile"`)} + if _, ok := bic.mutation.PaymentAppID(); !ok { + return &ValidationError{Name: "payment_app_id", err: errors.New(`db: missing required field "BillingInvoice.payment_app_id"`)} + } + if len(bic.mutation.SourceBillingProfileIDs()) == 0 { + return &ValidationError{Name: "source_billing_profile", err: errors.New(`db: missing required edge "BillingInvoice.source_billing_profile"`)} } if len(bic.mutation.BillingWorkflowConfigIDs()) == 0 { return &ValidationError{Name: "billing_workflow_config", err: errors.New(`db: missing required edge "BillingInvoice.billing_workflow_config"`)} } + if len(bic.mutation.BillingInvoiceCustomerIDs()) == 0 { + return &ValidationError{Name: "billing_invoice_customer", err: errors.New(`db: missing required edge "BillingInvoice.billing_invoice_customer"`)} + } + if len(bic.mutation.TaxAppIDs()) == 0 { + return &ValidationError{Name: "tax_app", err: errors.New(`db: missing required edge "BillingInvoice.tax_app"`)} + } + if len(bic.mutation.InvoicingAppIDs()) == 0 { + return &ValidationError{Name: "invoicing_app", err: errors.New(`db: missing required edge "BillingInvoice.invoicing_app"`)} + } + if len(bic.mutation.PaymentAppIDs()) == 0 { + return &ValidationError{Name: "payment_app", err: errors.New(`db: missing required edge "BillingInvoice.payment_app"`)} + } return nil } @@ -371,6 +751,10 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create _spec.SetField(billinginvoice.FieldNamespace, field.TypeString, value) _node.Namespace = value } + if value, ok := bic.mutation.Metadata(); ok { + _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) + _node.Metadata = value + } if value, ok := bic.mutation.CreatedAt(); ok { _spec.SetField(billinginvoice.FieldCreatedAt, field.TypeTime, value) _node.CreatedAt = value @@ -383,33 +767,105 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create _spec.SetField(billinginvoice.FieldDeletedAt, field.TypeTime, value) _node.DeletedAt = &value } - if value, ok := bic.mutation.Metadata(); ok { - _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) - _node.Metadata = value + if value, ok := bic.mutation.SupplierAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCountry, field.TypeString, value) + _node.SupplierAddressCountry = &value + } + if value, ok := bic.mutation.SupplierAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPostalCode, field.TypeString, value) + _node.SupplierAddressPostalCode = &value + } + if value, ok := bic.mutation.SupplierAddressState(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressState, field.TypeString, value) + _node.SupplierAddressState = &value + } + if value, ok := bic.mutation.SupplierAddressCity(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCity, field.TypeString, value) + _node.SupplierAddressCity = &value + } + if value, ok := bic.mutation.SupplierAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine1, field.TypeString, value) + _node.SupplierAddressLine1 = &value + } + if value, ok := bic.mutation.SupplierAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine2, field.TypeString, value) + _node.SupplierAddressLine2 = &value + } + if value, ok := bic.mutation.SupplierAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPhoneNumber, field.TypeString, value) + _node.SupplierAddressPhoneNumber = &value + } + if value, ok := bic.mutation.CustomerAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCountry, field.TypeString, value) + _node.CustomerAddressCountry = &value + } + if value, ok := bic.mutation.CustomerAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPostalCode, field.TypeString, value) + _node.CustomerAddressPostalCode = &value + } + if value, ok := bic.mutation.CustomerAddressState(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressState, field.TypeString, value) + _node.CustomerAddressState = &value + } + if value, ok := bic.mutation.CustomerAddressCity(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCity, field.TypeString, value) + _node.CustomerAddressCity = &value + } + if value, ok := bic.mutation.CustomerAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine1, field.TypeString, value) + _node.CustomerAddressLine1 = &value + } + if value, ok := bic.mutation.CustomerAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine2, field.TypeString, value) + _node.CustomerAddressLine2 = &value } - if value, ok := bic.mutation.Series(); ok { - _spec.SetField(billinginvoice.FieldSeries, field.TypeString, value) - _node.Series = &value + if value, ok := bic.mutation.CustomerAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPhoneNumber, field.TypeString, value) + _node.CustomerAddressPhoneNumber = &value } - if value, ok := bic.mutation.Code(); ok { - _spec.SetField(billinginvoice.FieldCode, field.TypeString, value) - _node.Code = &value + if value, ok := bic.mutation.SupplierName(); ok { + _spec.SetField(billinginvoice.FieldSupplierName, field.TypeString, value) + _node.SupplierName = value } - if value, ok := bic.mutation.CustomerID(); ok { - _spec.SetField(billinginvoice.FieldCustomerID, field.TypeString, value) - _node.CustomerID = value + if value, ok := bic.mutation.SupplierTaxCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierTaxCode, field.TypeString, value) + _node.SupplierTaxCode = &value + } + if value, ok := bic.mutation.CustomerName(); ok { + _spec.SetField(billinginvoice.FieldCustomerName, field.TypeString, value) + _node.CustomerName = value + } + if value, ok := bic.mutation.CustomerTimezone(); ok { + _spec.SetField(billinginvoice.FieldCustomerTimezone, field.TypeString, value) + _node.CustomerTimezone = &value + } + if value, ok := bic.mutation.Number(); ok { + _spec.SetField(billinginvoice.FieldNumber, field.TypeString, value) + _node.Number = &value + } + if value, ok := bic.mutation.GetType(); ok { + _spec.SetField(billinginvoice.FieldType, field.TypeEnum, value) + _node.Type = value + } + if value, ok := bic.mutation.Description(); ok { + _spec.SetField(billinginvoice.FieldDescription, field.TypeString, value) + _node.Description = &value } if value, ok := bic.mutation.VoidedAt(); ok { _spec.SetField(billinginvoice.FieldVoidedAt, field.TypeTime, value) - _node.VoidedAt = value + _node.VoidedAt = &value + } + if value, ok := bic.mutation.IssuedAt(); ok { + _spec.SetField(billinginvoice.FieldIssuedAt, field.TypeTime, value) + _node.IssuedAt = &value } if value, ok := bic.mutation.Currency(); ok { _spec.SetField(billinginvoice.FieldCurrency, field.TypeString, value) _node.Currency = value } - if value, ok := bic.mutation.DueDate(); ok { - _spec.SetField(billinginvoice.FieldDueDate, field.TypeTime, value) - _node.DueDate = value + if value, ok := bic.mutation.DueAt(); ok { + _spec.SetField(billinginvoice.FieldDueAt, field.TypeTime, value) + _node.DueAt = &value } if value, ok := bic.mutation.Status(); ok { _spec.SetField(billinginvoice.FieldStatus, field.TypeEnum, value) @@ -417,18 +873,18 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create } if value, ok := bic.mutation.PeriodStart(); ok { _spec.SetField(billinginvoice.FieldPeriodStart, field.TypeTime, value) - _node.PeriodStart = value + _node.PeriodStart = &value } if value, ok := bic.mutation.PeriodEnd(); ok { _spec.SetField(billinginvoice.FieldPeriodEnd, field.TypeTime, value) - _node.PeriodEnd = value + _node.PeriodEnd = &value } - if nodes := bic.mutation.BillingProfileIDs(); len(nodes) > 0 { + if nodes := bic.mutation.SourceBillingProfileIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.M2O, Inverse: true, - Table: billinginvoice.BillingProfileTable, - Columns: []string{billinginvoice.BillingProfileColumn}, + Table: billinginvoice.SourceBillingProfileTable, + Columns: []string{billinginvoice.SourceBillingProfileColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ IDSpec: sqlgraph.NewFieldSpec(billingprofile.FieldID, field.TypeString), @@ -437,7 +893,7 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create for _, k := range nodes { edge.Target.Nodes = append(edge.Target.Nodes, k) } - _node.BillingProfileID = nodes[0] + _node.SourceBillingProfileID = nodes[0] _spec.Edges = append(_spec.Edges, edge) } if nodes := bic.mutation.BillingWorkflowConfigIDs(); len(nodes) > 0 { @@ -457,15 +913,15 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create _node.WorkflowConfigID = nodes[0] _spec.Edges = append(_spec.Edges, edge) } - if nodes := bic.mutation.BillingInvoiceItemsIDs(); len(nodes) > 0 { + if nodes := bic.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { @@ -473,32 +929,100 @@ func (bic *BillingInvoiceCreate) createSpec() (*BillingInvoice, *sqlgraph.Create } _spec.Edges = append(_spec.Edges, edge) } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.BillingInvoice.Create(). -// SetNamespace(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.BillingInvoiceUpsert) { -// SetNamespace(v+v). -// }). -// Exec(ctx) -func (bic *BillingInvoiceCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUpsertOne { - bic.conflict = opts - return &BillingInvoiceUpsertOne{ - create: bic, - } -} - + if nodes := bic.mutation.BillingInvoiceCustomerIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoice.BillingInvoiceCustomerTable, + Columns: []string{billinginvoice.BillingInvoiceCustomerColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(customer.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.CustomerID = nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := bic.mutation.TaxAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoice.TaxAppTable, + Columns: []string{billinginvoice.TaxAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.TaxAppID = nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := bic.mutation.InvoicingAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoice.InvoicingAppTable, + Columns: []string{billinginvoice.InvoicingAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.InvoicingAppID = nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := bic.mutation.PaymentAppIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoice.PaymentAppTable, + Columns: []string{billinginvoice.PaymentAppColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(app.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.PaymentAppID = nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoice.Create(). +// SetNamespace(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bic *BillingInvoiceCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUpsertOne { + bic.conflict = opts + return &BillingInvoiceUpsertOne{ + create: bic, + } +} + // OnConflictColumns calls `OnConflict` and configures the columns // as conflict target. Using this option is equivalent to using: // @@ -525,6 +1049,24 @@ type ( } ) +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceUpsert) SetMetadata(v map[string]string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldMetadata, v) + return u +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateMetadata() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldMetadata) + return u +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceUpsert) ClearMetadata() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldMetadata) + return u +} + // SetUpdatedAt sets the "updated_at" field. func (u *BillingInvoiceUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceUpsert { u.Set(billinginvoice.FieldUpdatedAt, v) @@ -555,57 +1097,363 @@ func (u *BillingInvoiceUpsert) ClearDeletedAt() *BillingInvoiceUpsert { return u } -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceUpsert) SetMetadata(v map[string]string) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldMetadata, v) +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressCountry(v models.CountryCode) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressCountry, v) return u } -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdateMetadata() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldMetadata) +// UpdateSupplierAddressCountry sets the "supplier_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressCountry() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressCountry) return u } -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceUpsert) ClearMetadata() *BillingInvoiceUpsert { - u.SetNull(billinginvoice.FieldMetadata) +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressCountry() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressCountry) + return u +} + +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressPostalCode(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressPostalCode, v) + return u +} + +// UpdateSupplierAddressPostalCode sets the "supplier_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressPostalCode() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressPostalCode) + return u +} + +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressPostalCode() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressPostalCode) + return u +} + +// SetSupplierAddressState sets the "supplier_address_state" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressState(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressState, v) + return u +} + +// UpdateSupplierAddressState sets the "supplier_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressState() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressState) + return u +} + +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressState() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressState) + return u +} + +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressCity(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressCity, v) + return u +} + +// UpdateSupplierAddressCity sets the "supplier_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressCity() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressCity) + return u +} + +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressCity() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressCity) return u } -// SetSeries sets the "series" field. -func (u *BillingInvoiceUpsert) SetSeries(v string) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldSeries, v) +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressLine1(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressLine1, v) return u } -// UpdateSeries sets the "series" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdateSeries() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldSeries) +// UpdateSupplierAddressLine1 sets the "supplier_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressLine1() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressLine1) return u } -// ClearSeries clears the value of the "series" field. -func (u *BillingInvoiceUpsert) ClearSeries() *BillingInvoiceUpsert { - u.SetNull(billinginvoice.FieldSeries) +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressLine1() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressLine1) return u } -// SetCode sets the "code" field. -func (u *BillingInvoiceUpsert) SetCode(v string) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldCode, v) +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressLine2(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressLine2, v) return u } -// UpdateCode sets the "code" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdateCode() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldCode) +// UpdateSupplierAddressLine2 sets the "supplier_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressLine2() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressLine2) return u } -// ClearCode clears the value of the "code" field. -func (u *BillingInvoiceUpsert) ClearCode() *BillingInvoiceUpsert { - u.SetNull(billinginvoice.FieldCode) +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressLine2() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressLine2) + return u +} + +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsert) SetSupplierAddressPhoneNumber(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierAddressPhoneNumber, v) + return u +} + +// UpdateSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierAddressPhoneNumber() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierAddressPhoneNumber) + return u +} + +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsert) ClearSupplierAddressPhoneNumber() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierAddressPhoneNumber) + return u +} + +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressCountry(v models.CountryCode) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressCountry, v) + return u +} + +// UpdateCustomerAddressCountry sets the "customer_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressCountry() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressCountry) + return u +} + +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressCountry() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressCountry) + return u +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressPostalCode(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressPostalCode, v) + return u +} + +// UpdateCustomerAddressPostalCode sets the "customer_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressPostalCode() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressPostalCode) + return u +} + +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressPostalCode() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressPostalCode) + return u +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressState(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressState, v) + return u +} + +// UpdateCustomerAddressState sets the "customer_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressState() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressState) + return u +} + +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressState() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressState) + return u +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressCity(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressCity, v) + return u +} + +// UpdateCustomerAddressCity sets the "customer_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressCity() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressCity) + return u +} + +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressCity() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressCity) + return u +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressLine1(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressLine1, v) + return u +} + +// UpdateCustomerAddressLine1 sets the "customer_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressLine1() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressLine1) + return u +} + +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressLine1() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressLine1) + return u +} + +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressLine2(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressLine2, v) + return u +} + +// UpdateCustomerAddressLine2 sets the "customer_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressLine2() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressLine2) + return u +} + +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressLine2() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressLine2) + return u +} + +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsert) SetCustomerAddressPhoneNumber(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerAddressPhoneNumber, v) + return u +} + +// UpdateCustomerAddressPhoneNumber sets the "customer_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerAddressPhoneNumber() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerAddressPhoneNumber) + return u +} + +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsert) ClearCustomerAddressPhoneNumber() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerAddressPhoneNumber) + return u +} + +// SetSupplierName sets the "supplier_name" field. +func (u *BillingInvoiceUpsert) SetSupplierName(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierName, v) + return u +} + +// UpdateSupplierName sets the "supplier_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierName() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierName) + return u +} + +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (u *BillingInvoiceUpsert) SetSupplierTaxCode(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldSupplierTaxCode, v) + return u +} + +// UpdateSupplierTaxCode sets the "supplier_tax_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateSupplierTaxCode() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldSupplierTaxCode) + return u +} + +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (u *BillingInvoiceUpsert) ClearSupplierTaxCode() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldSupplierTaxCode) + return u +} + +// SetCustomerName sets the "customer_name" field. +func (u *BillingInvoiceUpsert) SetCustomerName(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerName, v) + return u +} + +// UpdateCustomerName sets the "customer_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerName() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerName) + return u +} + +// SetCustomerTimezone sets the "customer_timezone" field. +func (u *BillingInvoiceUpsert) SetCustomerTimezone(v timezone.Timezone) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldCustomerTimezone, v) + return u +} + +// UpdateCustomerTimezone sets the "customer_timezone" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateCustomerTimezone() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldCustomerTimezone) + return u +} + +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (u *BillingInvoiceUpsert) ClearCustomerTimezone() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldCustomerTimezone) + return u +} + +// SetNumber sets the "number" field. +func (u *BillingInvoiceUpsert) SetNumber(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldNumber, v) + return u +} + +// UpdateNumber sets the "number" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateNumber() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldNumber) + return u +} + +// ClearNumber clears the value of the "number" field. +func (u *BillingInvoiceUpsert) ClearNumber() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldNumber) + return u +} + +// SetType sets the "type" field. +func (u *BillingInvoiceUpsert) SetType(v billingentity.InvoiceType) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldType, v) + return u +} + +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateType() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldType) + return u +} + +// SetDescription sets the "description" field. +func (u *BillingInvoiceUpsert) SetDescription(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldDescription, v) + return u +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateDescription() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldDescription) + return u +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceUpsert) ClearDescription() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldDescription) return u } @@ -627,20 +1475,44 @@ func (u *BillingInvoiceUpsert) ClearVoidedAt() *BillingInvoiceUpsert { return u } -// SetDueDate sets the "due_date" field. -func (u *BillingInvoiceUpsert) SetDueDate(v time.Time) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldDueDate, v) +// SetIssuedAt sets the "issued_at" field. +func (u *BillingInvoiceUpsert) SetIssuedAt(v time.Time) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldIssuedAt, v) return u } -// UpdateDueDate sets the "due_date" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdateDueDate() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldDueDate) +// UpdateIssuedAt sets the "issued_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateIssuedAt() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldIssuedAt) return u } -// SetStatus sets the "status" field. -func (u *BillingInvoiceUpsert) SetStatus(v billingentity.InvoiceStatus) *BillingInvoiceUpsert { +// ClearIssuedAt clears the value of the "issued_at" field. +func (u *BillingInvoiceUpsert) ClearIssuedAt() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldIssuedAt) + return u +} + +// SetDueAt sets the "due_at" field. +func (u *BillingInvoiceUpsert) SetDueAt(v time.Time) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldDueAt, v) + return u +} + +// UpdateDueAt sets the "due_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateDueAt() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldDueAt) + return u +} + +// ClearDueAt clears the value of the "due_at" field. +func (u *BillingInvoiceUpsert) ClearDueAt() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldDueAt) + return u +} + +// SetStatus sets the "status" field. +func (u *BillingInvoiceUpsert) SetStatus(v billingentity.InvoiceStatus) *BillingInvoiceUpsert { u.Set(billinginvoice.FieldStatus, v) return u } @@ -651,44 +1523,902 @@ func (u *BillingInvoiceUpsert) UpdateStatus() *BillingInvoiceUpsert { return u } -// SetWorkflowConfigID sets the "workflow_config_id" field. -func (u *BillingInvoiceUpsert) SetWorkflowConfigID(v string) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldWorkflowConfigID, v) - return u +// SetWorkflowConfigID sets the "workflow_config_id" field. +func (u *BillingInvoiceUpsert) SetWorkflowConfigID(v string) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldWorkflowConfigID, v) + return u +} + +// UpdateWorkflowConfigID sets the "workflow_config_id" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdateWorkflowConfigID() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldWorkflowConfigID) + return u +} + +// SetPeriodStart sets the "period_start" field. +func (u *BillingInvoiceUpsert) SetPeriodStart(v time.Time) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldPeriodStart, v) + return u +} + +// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdatePeriodStart() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldPeriodStart) + return u +} + +// ClearPeriodStart clears the value of the "period_start" field. +func (u *BillingInvoiceUpsert) ClearPeriodStart() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldPeriodStart) + return u +} + +// SetPeriodEnd sets the "period_end" field. +func (u *BillingInvoiceUpsert) SetPeriodEnd(v time.Time) *BillingInvoiceUpsert { + u.Set(billinginvoice.FieldPeriodEnd, v) + return u +} + +// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. +func (u *BillingInvoiceUpsert) UpdatePeriodEnd() *BillingInvoiceUpsert { + u.SetExcluded(billinginvoice.FieldPeriodEnd) + return u +} + +// ClearPeriodEnd clears the value of the "period_end" field. +func (u *BillingInvoiceUpsert) ClearPeriodEnd() *BillingInvoiceUpsert { + u.SetNull(billinginvoice.FieldPeriodEnd) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. +// Using this option is equivalent to using: +// +// client.BillingInvoice.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// sql.ResolveWith(func(u *sql.UpdateSet) { +// u.SetIgnore(billinginvoice.FieldID) +// }), +// ). +// Exec(ctx) +func (u *BillingInvoiceUpsertOne) UpdateNewValues() *BillingInvoiceUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.ID(); exists { + s.SetIgnore(billinginvoice.FieldID) + } + if _, exists := u.create.mutation.Namespace(); exists { + s.SetIgnore(billinginvoice.FieldNamespace) + } + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(billinginvoice.FieldCreatedAt) + } + if _, exists := u.create.mutation.CustomerID(); exists { + s.SetIgnore(billinginvoice.FieldCustomerID) + } + if _, exists := u.create.mutation.SourceBillingProfileID(); exists { + s.SetIgnore(billinginvoice.FieldSourceBillingProfileID) + } + if _, exists := u.create.mutation.Currency(); exists { + s.SetIgnore(billinginvoice.FieldCurrency) + } + if _, exists := u.create.mutation.TaxAppID(); exists { + s.SetIgnore(billinginvoice.FieldTaxAppID) + } + if _, exists := u.create.mutation.InvoicingAppID(); exists { + s.SetIgnore(billinginvoice.FieldInvoicingAppID) + } + if _, exists := u.create.mutation.PaymentAppID(); exists { + s.SetIgnore(billinginvoice.FieldPaymentAppID) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BillingInvoice.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceUpsertOne) Ignore() *BillingInvoiceUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BillingInvoiceUpsertOne) DoNothing() *BillingInvoiceUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceCreate.OnConflict +// documentation for more info. +func (u *BillingInvoiceUpsertOne) Update(set func(*BillingInvoiceUpsert)) *BillingInvoiceUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BillingInvoiceUpsert{UpdateSet: update}) + })) + return u +} + +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceUpsertOne) SetMetadata(v map[string]string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetMetadata(v) + }) +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateMetadata() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateMetadata() + }) +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceUpsertOne) ClearMetadata() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearMetadata() + }) +} + +// SetUpdatedAt sets the "updated_at" field. +func (u *BillingInvoiceUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateUpdatedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateUpdatedAt() + }) +} + +// SetDeletedAt sets the "deleted_at" field. +func (u *BillingInvoiceUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetDeletedAt(v) + }) +} + +// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateDeletedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateDeletedAt() + }) +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (u *BillingInvoiceUpsertOne) ClearDeletedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearDeletedAt() + }) +} + +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressCountry(v models.CountryCode) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressCountry(v) + }) +} + +// UpdateSupplierAddressCountry sets the "supplier_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressCountry() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressCountry() + }) +} + +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressCountry() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressCountry() + }) +} + +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressPostalCode(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressPostalCode(v) + }) +} + +// UpdateSupplierAddressPostalCode sets the "supplier_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressPostalCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressPostalCode() + }) +} + +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressPostalCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressPostalCode() + }) +} + +// SetSupplierAddressState sets the "supplier_address_state" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressState(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressState(v) + }) +} + +// UpdateSupplierAddressState sets the "supplier_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressState() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressState() + }) +} + +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressState() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressState() + }) +} + +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressCity(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressCity(v) + }) +} + +// UpdateSupplierAddressCity sets the "supplier_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressCity() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressCity() + }) +} + +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressCity() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressCity() + }) +} + +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressLine1(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressLine1(v) + }) +} + +// UpdateSupplierAddressLine1 sets the "supplier_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressLine1() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressLine1() + }) +} + +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressLine1() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressLine1() + }) +} + +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressLine2(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressLine2(v) + }) +} + +// UpdateSupplierAddressLine2 sets the "supplier_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressLine2() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressLine2() + }) +} + +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressLine2() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressLine2() + }) +} + +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsertOne) SetSupplierAddressPhoneNumber(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierAddressPhoneNumber(v) + }) +} + +// UpdateSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierAddressPhoneNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierAddressPhoneNumber() + }) +} + +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierAddressPhoneNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierAddressPhoneNumber() + }) +} + +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressCountry(v models.CountryCode) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressCountry(v) + }) +} + +// UpdateCustomerAddressCountry sets the "customer_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressCountry() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressCountry() + }) +} + +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressCountry() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressCountry() + }) +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressPostalCode(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressPostalCode(v) + }) +} + +// UpdateCustomerAddressPostalCode sets the "customer_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressPostalCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressPostalCode() + }) +} + +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressPostalCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressPostalCode() + }) +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressState(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressState(v) + }) +} + +// UpdateCustomerAddressState sets the "customer_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressState() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressState() + }) +} + +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressState() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressState() + }) +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressCity(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressCity(v) + }) +} + +// UpdateCustomerAddressCity sets the "customer_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressCity() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressCity() + }) +} + +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressCity() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressCity() + }) +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressLine1(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressLine1(v) + }) +} + +// UpdateCustomerAddressLine1 sets the "customer_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressLine1() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressLine1() + }) +} + +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressLine1() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressLine1() + }) +} + +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressLine2(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressLine2(v) + }) +} + +// UpdateCustomerAddressLine2 sets the "customer_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressLine2() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressLine2() + }) +} + +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressLine2() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressLine2() + }) +} + +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsertOne) SetCustomerAddressPhoneNumber(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressPhoneNumber(v) + }) +} + +// UpdateCustomerAddressPhoneNumber sets the "customer_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerAddressPhoneNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressPhoneNumber() + }) +} + +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerAddressPhoneNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressPhoneNumber() + }) +} + +// SetSupplierName sets the "supplier_name" field. +func (u *BillingInvoiceUpsertOne) SetSupplierName(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierName(v) + }) +} + +// UpdateSupplierName sets the "supplier_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierName() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierName() + }) +} + +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (u *BillingInvoiceUpsertOne) SetSupplierTaxCode(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierTaxCode(v) + }) +} + +// UpdateSupplierTaxCode sets the "supplier_tax_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateSupplierTaxCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierTaxCode() + }) +} + +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (u *BillingInvoiceUpsertOne) ClearSupplierTaxCode() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearSupplierTaxCode() + }) +} + +// SetCustomerName sets the "customer_name" field. +func (u *BillingInvoiceUpsertOne) SetCustomerName(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerName(v) + }) +} + +// UpdateCustomerName sets the "customer_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerName() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerName() + }) +} + +// SetCustomerTimezone sets the "customer_timezone" field. +func (u *BillingInvoiceUpsertOne) SetCustomerTimezone(v timezone.Timezone) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerTimezone(v) + }) +} + +// UpdateCustomerTimezone sets the "customer_timezone" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateCustomerTimezone() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerTimezone() + }) +} + +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (u *BillingInvoiceUpsertOne) ClearCustomerTimezone() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerTimezone() + }) +} + +// SetNumber sets the "number" field. +func (u *BillingInvoiceUpsertOne) SetNumber(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetNumber(v) + }) +} + +// UpdateNumber sets the "number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateNumber() + }) +} + +// ClearNumber clears the value of the "number" field. +func (u *BillingInvoiceUpsertOne) ClearNumber() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearNumber() + }) +} + +// SetType sets the "type" field. +func (u *BillingInvoiceUpsertOne) SetType(v billingentity.InvoiceType) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetType(v) + }) +} + +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateType() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateType() + }) +} + +// SetDescription sets the "description" field. +func (u *BillingInvoiceUpsertOne) SetDescription(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateDescription() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceUpsertOne) ClearDescription() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearDescription() + }) +} + +// SetVoidedAt sets the "voided_at" field. +func (u *BillingInvoiceUpsertOne) SetVoidedAt(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetVoidedAt(v) + }) +} + +// UpdateVoidedAt sets the "voided_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateVoidedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateVoidedAt() + }) +} + +// ClearVoidedAt clears the value of the "voided_at" field. +func (u *BillingInvoiceUpsertOne) ClearVoidedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearVoidedAt() + }) +} + +// SetIssuedAt sets the "issued_at" field. +func (u *BillingInvoiceUpsertOne) SetIssuedAt(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetIssuedAt(v) + }) +} + +// UpdateIssuedAt sets the "issued_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateIssuedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateIssuedAt() + }) +} + +// ClearIssuedAt clears the value of the "issued_at" field. +func (u *BillingInvoiceUpsertOne) ClearIssuedAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearIssuedAt() + }) +} + +// SetDueAt sets the "due_at" field. +func (u *BillingInvoiceUpsertOne) SetDueAt(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetDueAt(v) + }) +} + +// UpdateDueAt sets the "due_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateDueAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateDueAt() + }) +} + +// ClearDueAt clears the value of the "due_at" field. +func (u *BillingInvoiceUpsertOne) ClearDueAt() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearDueAt() + }) +} + +// SetStatus sets the "status" field. +func (u *BillingInvoiceUpsertOne) SetStatus(v billingentity.InvoiceStatus) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetStatus(v) + }) +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateStatus() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateStatus() + }) +} + +// SetWorkflowConfigID sets the "workflow_config_id" field. +func (u *BillingInvoiceUpsertOne) SetWorkflowConfigID(v string) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetWorkflowConfigID(v) + }) +} + +// UpdateWorkflowConfigID sets the "workflow_config_id" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdateWorkflowConfigID() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateWorkflowConfigID() + }) +} + +// SetPeriodStart sets the "period_start" field. +func (u *BillingInvoiceUpsertOne) SetPeriodStart(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetPeriodStart(v) + }) +} + +// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdatePeriodStart() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdatePeriodStart() + }) +} + +// ClearPeriodStart clears the value of the "period_start" field. +func (u *BillingInvoiceUpsertOne) ClearPeriodStart() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearPeriodStart() + }) +} + +// SetPeriodEnd sets the "period_end" field. +func (u *BillingInvoiceUpsertOne) SetPeriodEnd(v time.Time) *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetPeriodEnd(v) + }) +} + +// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. +func (u *BillingInvoiceUpsertOne) UpdatePeriodEnd() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdatePeriodEnd() + }) +} + +// ClearPeriodEnd clears the value of the "period_end" field. +func (u *BillingInvoiceUpsertOne) ClearPeriodEnd() *BillingInvoiceUpsertOne { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearPeriodEnd() + }) +} + +// Exec executes the query. +func (u *BillingInvoiceUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("db: missing options for BillingInvoiceCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BillingInvoiceUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *BillingInvoiceUpsertOne) ID(ctx context.Context) (id string, err error) { + if u.create.driver.Dialect() == dialect.MySQL { + // In case of "ON CONFLICT", there is no way to get back non-numeric ID + // fields from the database since MySQL does not support the RETURNING clause. + return id, errors.New("db: BillingInvoiceUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceUpsertOne.Exec instead") + } + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *BillingInvoiceUpsertOne) IDX(ctx context.Context) string { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// BillingInvoiceCreateBulk is the builder for creating many BillingInvoice entities in bulk. +type BillingInvoiceCreateBulk struct { + config + err error + builders []*BillingInvoiceCreate + conflict []sql.ConflictOption +} + +// Save creates the BillingInvoice entities in the database. +func (bicb *BillingInvoiceCreateBulk) Save(ctx context.Context) ([]*BillingInvoice, error) { + if bicb.err != nil { + return nil, bicb.err + } + specs := make([]*sqlgraph.CreateSpec, len(bicb.builders)) + nodes := make([]*BillingInvoice, len(bicb.builders)) + mutators := make([]Mutator, len(bicb.builders)) + for i := range bicb.builders { + func(i int, root context.Context) { + builder := bicb.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*BillingInvoiceMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, bicb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = bicb.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, bicb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, bicb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (bicb *BillingInvoiceCreateBulk) SaveX(ctx context.Context) []*BillingInvoice { + v, err := bicb.Save(ctx) + if err != nil { + panic(err) + } + return v } -// UpdateWorkflowConfigID sets the "workflow_config_id" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdateWorkflowConfigID() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldWorkflowConfigID) - return u +// Exec executes the query. +func (bicb *BillingInvoiceCreateBulk) Exec(ctx context.Context) error { + _, err := bicb.Save(ctx) + return err } -// SetPeriodStart sets the "period_start" field. -func (u *BillingInvoiceUpsert) SetPeriodStart(v time.Time) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldPeriodStart, v) - return u +// ExecX is like Exec, but panics if an error occurs. +func (bicb *BillingInvoiceCreateBulk) ExecX(ctx context.Context) { + if err := bicb.Exec(ctx); err != nil { + panic(err) + } } -// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdatePeriodStart() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldPeriodStart) - return u +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoice.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bicb *BillingInvoiceCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUpsertBulk { + bicb.conflict = opts + return &BillingInvoiceUpsertBulk{ + create: bicb, + } } -// SetPeriodEnd sets the "period_end" field. -func (u *BillingInvoiceUpsert) SetPeriodEnd(v time.Time) *BillingInvoiceUpsert { - u.Set(billinginvoice.FieldPeriodEnd, v) - return u +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BillingInvoice.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (bicb *BillingInvoiceCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceUpsertBulk { + bicb.conflict = append(bicb.conflict, sql.ConflictColumns(columns...)) + return &BillingInvoiceUpsertBulk{ + create: bicb, + } } -// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. -func (u *BillingInvoiceUpsert) UpdatePeriodEnd() *BillingInvoiceUpsert { - u.SetExcluded(billinginvoice.FieldPeriodEnd) - return u +// BillingInvoiceUpsertBulk is the builder for "upsert"-ing +// a bulk of BillingInvoice nodes. +type BillingInvoiceUpsertBulk struct { + create *BillingInvoiceCreateBulk } -// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: // // client.BillingInvoice.Create(). // OnConflict( @@ -698,26 +2428,37 @@ func (u *BillingInvoiceUpsert) UpdatePeriodEnd() *BillingInvoiceUpsert { // }), // ). // Exec(ctx) -func (u *BillingInvoiceUpsertOne) UpdateNewValues() *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) UpdateNewValues() *BillingInvoiceUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(billinginvoice.FieldID) - } - if _, exists := u.create.mutation.Namespace(); exists { - s.SetIgnore(billinginvoice.FieldNamespace) - } - if _, exists := u.create.mutation.CreatedAt(); exists { - s.SetIgnore(billinginvoice.FieldCreatedAt) - } - if _, exists := u.create.mutation.CustomerID(); exists { - s.SetIgnore(billinginvoice.FieldCustomerID) - } - if _, exists := u.create.mutation.BillingProfileID(); exists { - s.SetIgnore(billinginvoice.FieldBillingProfileID) - } - if _, exists := u.create.mutation.Currency(); exists { - s.SetIgnore(billinginvoice.FieldCurrency) + for _, b := range u.create.builders { + if _, exists := b.mutation.ID(); exists { + s.SetIgnore(billinginvoice.FieldID) + } + if _, exists := b.mutation.Namespace(); exists { + s.SetIgnore(billinginvoice.FieldNamespace) + } + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(billinginvoice.FieldCreatedAt) + } + if _, exists := b.mutation.CustomerID(); exists { + s.SetIgnore(billinginvoice.FieldCustomerID) + } + if _, exists := b.mutation.SourceBillingProfileID(); exists { + s.SetIgnore(billinginvoice.FieldSourceBillingProfileID) + } + if _, exists := b.mutation.Currency(); exists { + s.SetIgnore(billinginvoice.FieldCurrency) + } + if _, exists := b.mutation.TaxAppID(); exists { + s.SetIgnore(billinginvoice.FieldTaxAppID) + } + if _, exists := b.mutation.InvoicingAppID(); exists { + s.SetIgnore(billinginvoice.FieldInvoicingAppID) + } + if _, exists := b.mutation.PaymentAppID(); exists { + s.SetIgnore(billinginvoice.FieldPaymentAppID) + } } })) return u @@ -727,543 +2468,502 @@ func (u *BillingInvoiceUpsertOne) UpdateNewValues() *BillingInvoiceUpsertOne { // Using this option is equivalent to using: // // client.BillingInvoice.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -func (u *BillingInvoiceUpsertOne) Ignore() *BillingInvoiceUpsertOne { +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceUpsertBulk) Ignore() *BillingInvoiceUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) return u } // DoNothing configures the conflict_action to `DO NOTHING`. // Supported only by SQLite and PostgreSQL. -func (u *BillingInvoiceUpsertOne) DoNothing() *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) DoNothing() *BillingInvoiceUpsertBulk { u.create.conflict = append(u.create.conflict, sql.DoNothing()) return u } -// Update allows overriding fields `UPDATE` values. See the BillingInvoiceCreate.OnConflict +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceCreateBulk.OnConflict // documentation for more info. -func (u *BillingInvoiceUpsertOne) Update(set func(*BillingInvoiceUpsert)) *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) Update(set func(*BillingInvoiceUpsert)) *BillingInvoiceUpsertBulk { u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { set(&BillingInvoiceUpsert{UpdateSet: update}) })) return u } +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceUpsertBulk) SetMetadata(v map[string]string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetMetadata(v) + }) +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateMetadata() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateMetadata() + }) +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceUpsertBulk) ClearMetadata() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearMetadata() + }) +} + // SetUpdatedAt sets the "updated_at" field. -func (u *BillingInvoiceUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { s.SetUpdatedAt(v) }) } // UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateUpdatedAt() *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) UpdateUpdatedAt() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { s.UpdateUpdatedAt() }) } // SetDeletedAt sets the "deleted_at" field. -func (u *BillingInvoiceUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { s.SetDeletedAt(v) }) } // UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateDeletedAt() *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) UpdateDeletedAt() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { s.UpdateDeletedAt() }) } // ClearDeletedAt clears the value of the "deleted_at" field. -func (u *BillingInvoiceUpsertOne) ClearDeletedAt() *BillingInvoiceUpsertOne { +func (u *BillingInvoiceUpsertBulk) ClearDeletedAt() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { s.ClearDeletedAt() }) } -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceUpsertOne) SetMetadata(v map[string]string) *BillingInvoiceUpsertOne { +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressCountry(v models.CountryCode) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetMetadata(v) + s.SetSupplierAddressCountry(v) }) } -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateMetadata() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressCountry sets the "supplier_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressCountry() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateMetadata() + s.UpdateSupplierAddressCountry() }) } -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceUpsertOne) ClearMetadata() *BillingInvoiceUpsertOne { +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressCountry() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearMetadata() + s.ClearSupplierAddressCountry() }) } -// SetSeries sets the "series" field. -func (u *BillingInvoiceUpsertOne) SetSeries(v string) *BillingInvoiceUpsertOne { +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressPostalCode(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetSeries(v) + s.SetSupplierAddressPostalCode(v) }) } -// UpdateSeries sets the "series" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateSeries() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressPostalCode sets the "supplier_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressPostalCode() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateSeries() + s.UpdateSupplierAddressPostalCode() }) } -// ClearSeries clears the value of the "series" field. -func (u *BillingInvoiceUpsertOne) ClearSeries() *BillingInvoiceUpsertOne { +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressPostalCode() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearSeries() + s.ClearSupplierAddressPostalCode() }) } -// SetCode sets the "code" field. -func (u *BillingInvoiceUpsertOne) SetCode(v string) *BillingInvoiceUpsertOne { +// SetSupplierAddressState sets the "supplier_address_state" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressState(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetCode(v) + s.SetSupplierAddressState(v) }) } -// UpdateCode sets the "code" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateCode() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressState sets the "supplier_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressState() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateCode() + s.UpdateSupplierAddressState() }) } -// ClearCode clears the value of the "code" field. -func (u *BillingInvoiceUpsertOne) ClearCode() *BillingInvoiceUpsertOne { +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressState() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearCode() + s.ClearSupplierAddressState() }) } -// SetVoidedAt sets the "voided_at" field. -func (u *BillingInvoiceUpsertOne) SetVoidedAt(v time.Time) *BillingInvoiceUpsertOne { +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressCity(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetVoidedAt(v) + s.SetSupplierAddressCity(v) }) } -// UpdateVoidedAt sets the "voided_at" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateVoidedAt() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressCity sets the "supplier_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressCity() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateVoidedAt() + s.UpdateSupplierAddressCity() }) } -// ClearVoidedAt clears the value of the "voided_at" field. -func (u *BillingInvoiceUpsertOne) ClearVoidedAt() *BillingInvoiceUpsertOne { +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressCity() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearVoidedAt() + s.ClearSupplierAddressCity() }) } -// SetDueDate sets the "due_date" field. -func (u *BillingInvoiceUpsertOne) SetDueDate(v time.Time) *BillingInvoiceUpsertOne { +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressLine1(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetDueDate(v) + s.SetSupplierAddressLine1(v) }) } -// UpdateDueDate sets the "due_date" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateDueDate() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressLine1 sets the "supplier_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressLine1() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateDueDate() + s.UpdateSupplierAddressLine1() }) } -// SetStatus sets the "status" field. -func (u *BillingInvoiceUpsertOne) SetStatus(v billingentity.InvoiceStatus) *BillingInvoiceUpsertOne { +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressLine1() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetStatus(v) + s.ClearSupplierAddressLine1() }) } -// UpdateStatus sets the "status" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateStatus() *BillingInvoiceUpsertOne { +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressLine2(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateStatus() + s.SetSupplierAddressLine2(v) }) } -// SetWorkflowConfigID sets the "workflow_config_id" field. -func (u *BillingInvoiceUpsertOne) SetWorkflowConfigID(v string) *BillingInvoiceUpsertOne { +// UpdateSupplierAddressLine2 sets the "supplier_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressLine2() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetWorkflowConfigID(v) + s.UpdateSupplierAddressLine2() }) } -// UpdateWorkflowConfigID sets the "workflow_config_id" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdateWorkflowConfigID() *BillingInvoiceUpsertOne { +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressLine2() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateWorkflowConfigID() + s.ClearSupplierAddressLine2() }) } -// SetPeriodStart sets the "period_start" field. -func (u *BillingInvoiceUpsertOne) SetPeriodStart(v time.Time) *BillingInvoiceUpsertOne { +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierAddressPhoneNumber(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetPeriodStart(v) + s.SetSupplierAddressPhoneNumber(v) }) } -// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdatePeriodStart() *BillingInvoiceUpsertOne { +// UpdateSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierAddressPhoneNumber() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdatePeriodStart() + s.UpdateSupplierAddressPhoneNumber() }) } -// SetPeriodEnd sets the "period_end" field. -func (u *BillingInvoiceUpsertOne) SetPeriodEnd(v time.Time) *BillingInvoiceUpsertOne { +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierAddressPhoneNumber() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetPeriodEnd(v) + s.ClearSupplierAddressPhoneNumber() }) } -// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. -func (u *BillingInvoiceUpsertOne) UpdatePeriodEnd() *BillingInvoiceUpsertOne { +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressCountry(v models.CountryCode) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdatePeriodEnd() + s.SetCustomerAddressCountry(v) }) } -// Exec executes the query. -func (u *BillingInvoiceUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("db: missing options for BillingInvoiceCreate.OnConflict") - } - return u.create.Exec(ctx) +// UpdateCustomerAddressCountry sets the "customer_address_country" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressCountry() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressCountry() + }) } -// ExecX is like Exec, but panics if an error occurs. -func (u *BillingInvoiceUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressCountry() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressCountry() + }) } -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *BillingInvoiceUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("db: BillingInvoiceUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressPostalCode(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressPostalCode(v) + }) +} + +// UpdateCustomerAddressPostalCode sets the "customer_address_postal_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressPostalCode() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressPostalCode() + }) +} + +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressPostalCode() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressPostalCode() + }) +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressState(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressState(v) + }) +} + +// UpdateCustomerAddressState sets the "customer_address_state" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressState() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressState() + }) +} + +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressState() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressState() + }) +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressCity(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressCity(v) + }) } -// IDX is like ID, but panics if an error occurs. -func (u *BillingInvoiceUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id +// UpdateCustomerAddressCity sets the "customer_address_city" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressCity() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressCity() + }) } -// BillingInvoiceCreateBulk is the builder for creating many BillingInvoice entities in bulk. -type BillingInvoiceCreateBulk struct { - config - err error - builders []*BillingInvoiceCreate - conflict []sql.ConflictOption +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressCity() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressCity() + }) } -// Save creates the BillingInvoice entities in the database. -func (bicb *BillingInvoiceCreateBulk) Save(ctx context.Context) ([]*BillingInvoice, error) { - if bicb.err != nil { - return nil, bicb.err - } - specs := make([]*sqlgraph.CreateSpec, len(bicb.builders)) - nodes := make([]*BillingInvoice, len(bicb.builders)) - mutators := make([]Mutator, len(bicb.builders)) - for i := range bicb.builders { - func(i int, root context.Context) { - builder := bicb.builders[i] - builder.defaults() - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*BillingInvoiceMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - var err error - nodes[i], specs[i] = builder.createSpec() - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, bicb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = bicb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, bicb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, bicb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressLine1(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressLine1(v) + }) } -// SaveX is like Save, but panics if an error occurs. -func (bicb *BillingInvoiceCreateBulk) SaveX(ctx context.Context) []*BillingInvoice { - v, err := bicb.Save(ctx) - if err != nil { - panic(err) - } - return v +// UpdateCustomerAddressLine1 sets the "customer_address_line1" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressLine1() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressLine1() + }) } -// Exec executes the query. -func (bicb *BillingInvoiceCreateBulk) Exec(ctx context.Context) error { - _, err := bicb.Save(ctx) - return err +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressLine1() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressLine1() + }) } -// ExecX is like Exec, but panics if an error occurs. -func (bicb *BillingInvoiceCreateBulk) ExecX(ctx context.Context) { - if err := bicb.Exec(ctx); err != nil { - panic(err) - } +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressLine2(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressLine2(v) + }) } -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.BillingInvoice.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.BillingInvoiceUpsert) { -// SetNamespace(v+v). -// }). -// Exec(ctx) -func (bicb *BillingInvoiceCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceUpsertBulk { - bicb.conflict = opts - return &BillingInvoiceUpsertBulk{ - create: bicb, - } +// UpdateCustomerAddressLine2 sets the "customer_address_line2" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressLine2() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressLine2() + }) } -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.BillingInvoice.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -func (bicb *BillingInvoiceCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceUpsertBulk { - bicb.conflict = append(bicb.conflict, sql.ConflictColumns(columns...)) - return &BillingInvoiceUpsertBulk{ - create: bicb, - } +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressLine2() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressLine2() + }) } -// BillingInvoiceUpsertBulk is the builder for "upsert"-ing -// a bulk of BillingInvoice nodes. -type BillingInvoiceUpsertBulk struct { - create *BillingInvoiceCreateBulk +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerAddressPhoneNumber(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetCustomerAddressPhoneNumber(v) + }) } -// UpdateNewValues updates the mutable fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.BillingInvoice.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(billinginvoice.FieldID) -// }), -// ). -// Exec(ctx) -func (u *BillingInvoiceUpsertBulk) UpdateNewValues() *BillingInvoiceUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(billinginvoice.FieldID) - } - if _, exists := b.mutation.Namespace(); exists { - s.SetIgnore(billinginvoice.FieldNamespace) - } - if _, exists := b.mutation.CreatedAt(); exists { - s.SetIgnore(billinginvoice.FieldCreatedAt) - } - if _, exists := b.mutation.CustomerID(); exists { - s.SetIgnore(billinginvoice.FieldCustomerID) - } - if _, exists := b.mutation.BillingProfileID(); exists { - s.SetIgnore(billinginvoice.FieldBillingProfileID) - } - if _, exists := b.mutation.Currency(); exists { - s.SetIgnore(billinginvoice.FieldCurrency) - } - } - })) - return u +// UpdateCustomerAddressPhoneNumber sets the "customer_address_phone_number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerAddressPhoneNumber() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateCustomerAddressPhoneNumber() + }) } -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.BillingInvoice.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -func (u *BillingInvoiceUpsertBulk) Ignore() *BillingInvoiceUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerAddressPhoneNumber() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearCustomerAddressPhoneNumber() + }) } -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *BillingInvoiceUpsertBulk) DoNothing() *BillingInvoiceUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u +// SetSupplierName sets the "supplier_name" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierName(v string) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetSupplierName(v) + }) } -// Update allows overriding fields `UPDATE` values. See the BillingInvoiceCreateBulk.OnConflict -// documentation for more info. -func (u *BillingInvoiceUpsertBulk) Update(set func(*BillingInvoiceUpsert)) *BillingInvoiceUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&BillingInvoiceUpsert{UpdateSet: update}) - })) - return u +// UpdateSupplierName sets the "supplier_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierName() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateSupplierName() + }) } -// SetUpdatedAt sets the "updated_at" field. -func (u *BillingInvoiceUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceUpsertBulk { +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (u *BillingInvoiceUpsertBulk) SetSupplierTaxCode(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetUpdatedAt(v) + s.SetSupplierTaxCode(v) }) } -// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateUpdatedAt() *BillingInvoiceUpsertBulk { +// UpdateSupplierTaxCode sets the "supplier_tax_code" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateSupplierTaxCode() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateUpdatedAt() + s.UpdateSupplierTaxCode() }) } -// SetDeletedAt sets the "deleted_at" field. -func (u *BillingInvoiceUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceUpsertBulk { +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (u *BillingInvoiceUpsertBulk) ClearSupplierTaxCode() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetDeletedAt(v) + s.ClearSupplierTaxCode() }) } -// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateDeletedAt() *BillingInvoiceUpsertBulk { +// SetCustomerName sets the "customer_name" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerName(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateDeletedAt() + s.SetCustomerName(v) }) } -// ClearDeletedAt clears the value of the "deleted_at" field. -func (u *BillingInvoiceUpsertBulk) ClearDeletedAt() *BillingInvoiceUpsertBulk { +// UpdateCustomerName sets the "customer_name" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerName() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearDeletedAt() + s.UpdateCustomerName() }) } -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceUpsertBulk) SetMetadata(v map[string]string) *BillingInvoiceUpsertBulk { +// SetCustomerTimezone sets the "customer_timezone" field. +func (u *BillingInvoiceUpsertBulk) SetCustomerTimezone(v timezone.Timezone) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetMetadata(v) + s.SetCustomerTimezone(v) }) } -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateMetadata() *BillingInvoiceUpsertBulk { +// UpdateCustomerTimezone sets the "customer_timezone" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateCustomerTimezone() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateMetadata() + s.UpdateCustomerTimezone() }) } -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceUpsertBulk) ClearMetadata() *BillingInvoiceUpsertBulk { +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (u *BillingInvoiceUpsertBulk) ClearCustomerTimezone() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearMetadata() + s.ClearCustomerTimezone() }) } -// SetSeries sets the "series" field. -func (u *BillingInvoiceUpsertBulk) SetSeries(v string) *BillingInvoiceUpsertBulk { +// SetNumber sets the "number" field. +func (u *BillingInvoiceUpsertBulk) SetNumber(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetSeries(v) + s.SetNumber(v) }) } -// UpdateSeries sets the "series" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateSeries() *BillingInvoiceUpsertBulk { +// UpdateNumber sets the "number" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateNumber() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateSeries() + s.UpdateNumber() }) } -// ClearSeries clears the value of the "series" field. -func (u *BillingInvoiceUpsertBulk) ClearSeries() *BillingInvoiceUpsertBulk { +// ClearNumber clears the value of the "number" field. +func (u *BillingInvoiceUpsertBulk) ClearNumber() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearSeries() + s.ClearNumber() }) } -// SetCode sets the "code" field. -func (u *BillingInvoiceUpsertBulk) SetCode(v string) *BillingInvoiceUpsertBulk { +// SetType sets the "type" field. +func (u *BillingInvoiceUpsertBulk) SetType(v billingentity.InvoiceType) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetCode(v) + s.SetType(v) }) } -// UpdateCode sets the "code" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateCode() *BillingInvoiceUpsertBulk { +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateType() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateCode() + s.UpdateType() }) } -// ClearCode clears the value of the "code" field. -func (u *BillingInvoiceUpsertBulk) ClearCode() *BillingInvoiceUpsertBulk { +// SetDescription sets the "description" field. +func (u *BillingInvoiceUpsertBulk) SetDescription(v string) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.ClearCode() + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateDescription() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceUpsertBulk) ClearDescription() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearDescription() }) } @@ -1288,17 +2988,45 @@ func (u *BillingInvoiceUpsertBulk) ClearVoidedAt() *BillingInvoiceUpsertBulk { }) } -// SetDueDate sets the "due_date" field. -func (u *BillingInvoiceUpsertBulk) SetDueDate(v time.Time) *BillingInvoiceUpsertBulk { +// SetIssuedAt sets the "issued_at" field. +func (u *BillingInvoiceUpsertBulk) SetIssuedAt(v time.Time) *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.SetIssuedAt(v) + }) +} + +// UpdateIssuedAt sets the "issued_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateIssuedAt() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateIssuedAt() + }) +} + +// ClearIssuedAt clears the value of the "issued_at" field. +func (u *BillingInvoiceUpsertBulk) ClearIssuedAt() *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.SetDueDate(v) + s.ClearIssuedAt() }) } -// UpdateDueDate sets the "due_date" field to the value that was provided on create. -func (u *BillingInvoiceUpsertBulk) UpdateDueDate() *BillingInvoiceUpsertBulk { +// SetDueAt sets the "due_at" field. +func (u *BillingInvoiceUpsertBulk) SetDueAt(v time.Time) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { - s.UpdateDueDate() + s.SetDueAt(v) + }) +} + +// UpdateDueAt sets the "due_at" field to the value that was provided on create. +func (u *BillingInvoiceUpsertBulk) UpdateDueAt() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.UpdateDueAt() + }) +} + +// ClearDueAt clears the value of the "due_at" field. +func (u *BillingInvoiceUpsertBulk) ClearDueAt() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearDueAt() }) } @@ -1344,6 +3072,13 @@ func (u *BillingInvoiceUpsertBulk) UpdatePeriodStart() *BillingInvoiceUpsertBulk }) } +// ClearPeriodStart clears the value of the "period_start" field. +func (u *BillingInvoiceUpsertBulk) ClearPeriodStart() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearPeriodStart() + }) +} + // SetPeriodEnd sets the "period_end" field. func (u *BillingInvoiceUpsertBulk) SetPeriodEnd(v time.Time) *BillingInvoiceUpsertBulk { return u.Update(func(s *BillingInvoiceUpsert) { @@ -1358,6 +3093,13 @@ func (u *BillingInvoiceUpsertBulk) UpdatePeriodEnd() *BillingInvoiceUpsertBulk { }) } +// ClearPeriodEnd clears the value of the "period_end" field. +func (u *BillingInvoiceUpsertBulk) ClearPeriodEnd() *BillingInvoiceUpsertBulk { + return u.Update(func(s *BillingInvoiceUpsert) { + s.ClearPeriodEnd() + }) +} + // Exec executes the query. func (u *BillingInvoiceUpsertBulk) Exec(ctx context.Context) error { if u.create.err != nil { diff --git a/openmeter/ent/db/billinginvoice_query.go b/openmeter/ent/db/billinginvoice_query.go index 9fa10c271..55d982809 100644 --- a/openmeter/ent/db/billinginvoice_query.go +++ b/openmeter/ent/db/billinginvoice_query.go @@ -13,24 +13,30 @@ import ( "entgo.io/ent/dialect/sql" "entgo.io/ent/dialect/sql/sqlgraph" "entgo.io/ent/schema/field" + "github.com/openmeterio/openmeter/openmeter/ent/db/app" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/customer" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" ) // BillingInvoiceQuery is the builder for querying BillingInvoice entities. type BillingInvoiceQuery struct { config - ctx *QueryContext - order []billinginvoice.OrderOption - inters []Interceptor - predicates []predicate.BillingInvoice - withBillingProfile *BillingProfileQuery - withBillingWorkflowConfig *BillingWorkflowConfigQuery - withBillingInvoiceItems *BillingInvoiceItemQuery - modifiers []func(*sql.Selector) + ctx *QueryContext + order []billinginvoice.OrderOption + inters []Interceptor + predicates []predicate.BillingInvoice + withSourceBillingProfile *BillingProfileQuery + withBillingWorkflowConfig *BillingWorkflowConfigQuery + withBillingInvoiceLines *BillingInvoiceLineQuery + withBillingInvoiceCustomer *CustomerQuery + withTaxApp *AppQuery + withInvoicingApp *AppQuery + withPaymentApp *AppQuery + modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector path func(context.Context) (*sql.Selector, error) @@ -67,8 +73,8 @@ func (biq *BillingInvoiceQuery) Order(o ...billinginvoice.OrderOption) *BillingI return biq } -// QueryBillingProfile chains the current query on the "billing_profile" edge. -func (biq *BillingInvoiceQuery) QueryBillingProfile() *BillingProfileQuery { +// QuerySourceBillingProfile chains the current query on the "source_billing_profile" edge. +func (biq *BillingInvoiceQuery) QuerySourceBillingProfile() *BillingProfileQuery { query := (&BillingProfileClient{config: biq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := biq.prepareQuery(ctx); err != nil { @@ -81,7 +87,7 @@ func (biq *BillingInvoiceQuery) QueryBillingProfile() *BillingProfileQuery { step := sqlgraph.NewStep( sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.BillingProfileTable, billinginvoice.BillingProfileColumn), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.SourceBillingProfileTable, billinginvoice.SourceBillingProfileColumn), ) fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) return fromU, nil @@ -111,9 +117,9 @@ func (biq *BillingInvoiceQuery) QueryBillingWorkflowConfig() *BillingWorkflowCon return query } -// QueryBillingInvoiceItems chains the current query on the "billing_invoice_items" edge. -func (biq *BillingInvoiceQuery) QueryBillingInvoiceItems() *BillingInvoiceItemQuery { - query := (&BillingInvoiceItemClient{config: biq.config}).Query() +// QueryBillingInvoiceLines chains the current query on the "billing_invoice_lines" edge. +func (biq *BillingInvoiceQuery) QueryBillingInvoiceLines() *BillingInvoiceLineQuery { + query := (&BillingInvoiceLineClient{config: biq.config}).Query() query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { if err := biq.prepareQuery(ctx); err != nil { return nil, err @@ -124,8 +130,96 @@ func (biq *BillingInvoiceQuery) QueryBillingInvoiceItems() *BillingInvoiceItemQu } step := sqlgraph.NewStep( sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), - sqlgraph.To(billinginvoiceitem.Table, billinginvoiceitem.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, billinginvoice.BillingInvoiceItemsTable, billinginvoice.BillingInvoiceItemsColumn), + sqlgraph.To(billinginvoiceline.Table, billinginvoiceline.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, billinginvoice.BillingInvoiceLinesTable, billinginvoice.BillingInvoiceLinesColumn), + ) + fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryBillingInvoiceCustomer chains the current query on the "billing_invoice_customer" edge. +func (biq *BillingInvoiceQuery) QueryBillingInvoiceCustomer() *CustomerQuery { + query := (&CustomerClient{config: biq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := biq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := biq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), + sqlgraph.To(customer.Table, customer.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.BillingInvoiceCustomerTable, billinginvoice.BillingInvoiceCustomerColumn), + ) + fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryTaxApp chains the current query on the "tax_app" edge. +func (biq *BillingInvoiceQuery) QueryTaxApp() *AppQuery { + query := (&AppClient{config: biq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := biq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := biq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.TaxAppTable, billinginvoice.TaxAppColumn), + ) + fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryInvoicingApp chains the current query on the "invoicing_app" edge. +func (biq *BillingInvoiceQuery) QueryInvoicingApp() *AppQuery { + query := (&AppClient{config: biq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := biq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := biq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.InvoicingAppTable, billinginvoice.InvoicingAppColumn), + ) + fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryPaymentApp chains the current query on the "payment_app" edge. +func (biq *BillingInvoiceQuery) QueryPaymentApp() *AppQuery { + query := (&AppClient{config: biq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := biq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := biq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, selector), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.PaymentAppTable, billinginvoice.PaymentAppColumn), ) fromU = sqlgraph.SetNeighbors(biq.driver.Dialect(), step) return fromU, nil @@ -320,28 +414,32 @@ func (biq *BillingInvoiceQuery) Clone() *BillingInvoiceQuery { return nil } return &BillingInvoiceQuery{ - config: biq.config, - ctx: biq.ctx.Clone(), - order: append([]billinginvoice.OrderOption{}, biq.order...), - inters: append([]Interceptor{}, biq.inters...), - predicates: append([]predicate.BillingInvoice{}, biq.predicates...), - withBillingProfile: biq.withBillingProfile.Clone(), - withBillingWorkflowConfig: biq.withBillingWorkflowConfig.Clone(), - withBillingInvoiceItems: biq.withBillingInvoiceItems.Clone(), + config: biq.config, + ctx: biq.ctx.Clone(), + order: append([]billinginvoice.OrderOption{}, biq.order...), + inters: append([]Interceptor{}, biq.inters...), + predicates: append([]predicate.BillingInvoice{}, biq.predicates...), + withSourceBillingProfile: biq.withSourceBillingProfile.Clone(), + withBillingWorkflowConfig: biq.withBillingWorkflowConfig.Clone(), + withBillingInvoiceLines: biq.withBillingInvoiceLines.Clone(), + withBillingInvoiceCustomer: biq.withBillingInvoiceCustomer.Clone(), + withTaxApp: biq.withTaxApp.Clone(), + withInvoicingApp: biq.withInvoicingApp.Clone(), + withPaymentApp: biq.withPaymentApp.Clone(), // clone intermediate query. sql: biq.sql.Clone(), path: biq.path, } } -// WithBillingProfile tells the query-builder to eager-load the nodes that are connected to -// the "billing_profile" edge. The optional arguments are used to configure the query builder of the edge. -func (biq *BillingInvoiceQuery) WithBillingProfile(opts ...func(*BillingProfileQuery)) *BillingInvoiceQuery { +// WithSourceBillingProfile tells the query-builder to eager-load the nodes that are connected to +// the "source_billing_profile" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithSourceBillingProfile(opts ...func(*BillingProfileQuery)) *BillingInvoiceQuery { query := (&BillingProfileClient{config: biq.config}).Query() for _, opt := range opts { opt(query) } - biq.withBillingProfile = query + biq.withSourceBillingProfile = query return biq } @@ -356,14 +454,58 @@ func (biq *BillingInvoiceQuery) WithBillingWorkflowConfig(opts ...func(*BillingW return biq } -// WithBillingInvoiceItems tells the query-builder to eager-load the nodes that are connected to -// the "billing_invoice_items" edge. The optional arguments are used to configure the query builder of the edge. -func (biq *BillingInvoiceQuery) WithBillingInvoiceItems(opts ...func(*BillingInvoiceItemQuery)) *BillingInvoiceQuery { - query := (&BillingInvoiceItemClient{config: biq.config}).Query() +// WithBillingInvoiceLines tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_lines" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithBillingInvoiceLines(opts ...func(*BillingInvoiceLineQuery)) *BillingInvoiceQuery { + query := (&BillingInvoiceLineClient{config: biq.config}).Query() + for _, opt := range opts { + opt(query) + } + biq.withBillingInvoiceLines = query + return biq +} + +// WithBillingInvoiceCustomer tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_customer" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithBillingInvoiceCustomer(opts ...func(*CustomerQuery)) *BillingInvoiceQuery { + query := (&CustomerClient{config: biq.config}).Query() + for _, opt := range opts { + opt(query) + } + biq.withBillingInvoiceCustomer = query + return biq +} + +// WithTaxApp tells the query-builder to eager-load the nodes that are connected to +// the "tax_app" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithTaxApp(opts ...func(*AppQuery)) *BillingInvoiceQuery { + query := (&AppClient{config: biq.config}).Query() + for _, opt := range opts { + opt(query) + } + biq.withTaxApp = query + return biq +} + +// WithInvoicingApp tells the query-builder to eager-load the nodes that are connected to +// the "invoicing_app" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithInvoicingApp(opts ...func(*AppQuery)) *BillingInvoiceQuery { + query := (&AppClient{config: biq.config}).Query() + for _, opt := range opts { + opt(query) + } + biq.withInvoicingApp = query + return biq +} + +// WithPaymentApp tells the query-builder to eager-load the nodes that are connected to +// the "payment_app" edge. The optional arguments are used to configure the query builder of the edge. +func (biq *BillingInvoiceQuery) WithPaymentApp(opts ...func(*AppQuery)) *BillingInvoiceQuery { + query := (&AppClient{config: biq.config}).Query() for _, opt := range opts { opt(query) } - biq.withBillingInvoiceItems = query + biq.withPaymentApp = query return biq } @@ -445,10 +587,14 @@ func (biq *BillingInvoiceQuery) sqlAll(ctx context.Context, hooks ...queryHook) var ( nodes = []*BillingInvoice{} _spec = biq.querySpec() - loadedTypes = [3]bool{ - biq.withBillingProfile != nil, + loadedTypes = [7]bool{ + biq.withSourceBillingProfile != nil, biq.withBillingWorkflowConfig != nil, - biq.withBillingInvoiceItems != nil, + biq.withBillingInvoiceLines != nil, + biq.withBillingInvoiceCustomer != nil, + biq.withTaxApp != nil, + biq.withInvoicingApp != nil, + biq.withPaymentApp != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { @@ -472,9 +618,9 @@ func (biq *BillingInvoiceQuery) sqlAll(ctx context.Context, hooks ...queryHook) if len(nodes) == 0 { return nodes, nil } - if query := biq.withBillingProfile; query != nil { - if err := biq.loadBillingProfile(ctx, query, nodes, nil, - func(n *BillingInvoice, e *BillingProfile) { n.Edges.BillingProfile = e }); err != nil { + if query := biq.withSourceBillingProfile; query != nil { + if err := biq.loadSourceBillingProfile(ctx, query, nodes, nil, + func(n *BillingInvoice, e *BillingProfile) { n.Edges.SourceBillingProfile = e }); err != nil { return nil, err } } @@ -484,23 +630,47 @@ func (biq *BillingInvoiceQuery) sqlAll(ctx context.Context, hooks ...queryHook) return nil, err } } - if query := biq.withBillingInvoiceItems; query != nil { - if err := biq.loadBillingInvoiceItems(ctx, query, nodes, - func(n *BillingInvoice) { n.Edges.BillingInvoiceItems = []*BillingInvoiceItem{} }, - func(n *BillingInvoice, e *BillingInvoiceItem) { - n.Edges.BillingInvoiceItems = append(n.Edges.BillingInvoiceItems, e) + if query := biq.withBillingInvoiceLines; query != nil { + if err := biq.loadBillingInvoiceLines(ctx, query, nodes, + func(n *BillingInvoice) { n.Edges.BillingInvoiceLines = []*BillingInvoiceLine{} }, + func(n *BillingInvoice, e *BillingInvoiceLine) { + n.Edges.BillingInvoiceLines = append(n.Edges.BillingInvoiceLines, e) }); err != nil { return nil, err } } + if query := biq.withBillingInvoiceCustomer; query != nil { + if err := biq.loadBillingInvoiceCustomer(ctx, query, nodes, nil, + func(n *BillingInvoice, e *Customer) { n.Edges.BillingInvoiceCustomer = e }); err != nil { + return nil, err + } + } + if query := biq.withTaxApp; query != nil { + if err := biq.loadTaxApp(ctx, query, nodes, nil, + func(n *BillingInvoice, e *App) { n.Edges.TaxApp = e }); err != nil { + return nil, err + } + } + if query := biq.withInvoicingApp; query != nil { + if err := biq.loadInvoicingApp(ctx, query, nodes, nil, + func(n *BillingInvoice, e *App) { n.Edges.InvoicingApp = e }); err != nil { + return nil, err + } + } + if query := biq.withPaymentApp; query != nil { + if err := biq.loadPaymentApp(ctx, query, nodes, nil, + func(n *BillingInvoice, e *App) { n.Edges.PaymentApp = e }); err != nil { + return nil, err + } + } return nodes, nil } -func (biq *BillingInvoiceQuery) loadBillingProfile(ctx context.Context, query *BillingProfileQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *BillingProfile)) error { +func (biq *BillingInvoiceQuery) loadSourceBillingProfile(ctx context.Context, query *BillingProfileQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *BillingProfile)) error { ids := make([]string, 0, len(nodes)) nodeids := make(map[string][]*BillingInvoice) for i := range nodes { - fk := nodes[i].BillingProfileID + fk := nodes[i].SourceBillingProfileID if _, ok := nodeids[fk]; !ok { ids = append(ids, fk) } @@ -517,7 +687,7 @@ func (biq *BillingInvoiceQuery) loadBillingProfile(ctx context.Context, query *B for _, n := range neighbors { nodes, ok := nodeids[n.ID] if !ok { - return fmt.Errorf(`unexpected foreign-key "billing_profile_id" returned %v`, n.ID) + return fmt.Errorf(`unexpected foreign-key "source_billing_profile_id" returned %v`, n.ID) } for i := range nodes { assign(nodes[i], n) @@ -554,7 +724,7 @@ func (biq *BillingInvoiceQuery) loadBillingWorkflowConfig(ctx context.Context, q } return nil } -func (biq *BillingInvoiceQuery) loadBillingInvoiceItems(ctx context.Context, query *BillingInvoiceItemQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *BillingInvoiceItem)) error { +func (biq *BillingInvoiceQuery) loadBillingInvoiceLines(ctx context.Context, query *BillingInvoiceLineQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *BillingInvoiceLine)) error { fks := make([]driver.Value, 0, len(nodes)) nodeids := make(map[string]*BillingInvoice) for i := range nodes { @@ -564,11 +734,12 @@ func (biq *BillingInvoiceQuery) loadBillingInvoiceItems(ctx context.Context, que init(nodes[i]) } } + query.withFKs = true if len(query.ctx.Fields) > 0 { - query.ctx.AppendFieldOnce(billinginvoiceitem.FieldInvoiceID) + query.ctx.AppendFieldOnce(billinginvoiceline.FieldInvoiceID) } - query.Where(predicate.BillingInvoiceItem(func(s *sql.Selector) { - s.Where(sql.InValues(s.C(billinginvoice.BillingInvoiceItemsColumn), fks...)) + query.Where(predicate.BillingInvoiceLine(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(billinginvoice.BillingInvoiceLinesColumn), fks...)) })) neighbors, err := query.All(ctx) if err != nil { @@ -576,17 +747,130 @@ func (biq *BillingInvoiceQuery) loadBillingInvoiceItems(ctx context.Context, que } for _, n := range neighbors { fk := n.InvoiceID - if fk == nil { - return fmt.Errorf(`foreign-key "invoice_id" is nil for node %v`, n.ID) - } - node, ok := nodeids[*fk] + node, ok := nodeids[fk] if !ok { - return fmt.Errorf(`unexpected referenced foreign-key "invoice_id" returned %v for node %v`, *fk, n.ID) + return fmt.Errorf(`unexpected referenced foreign-key "invoice_id" returned %v for node %v`, fk, n.ID) } assign(node, n) } return nil } +func (biq *BillingInvoiceQuery) loadBillingInvoiceCustomer(ctx context.Context, query *CustomerQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *Customer)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoice) + for i := range nodes { + fk := nodes[i].CustomerID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(customer.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "customer_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (biq *BillingInvoiceQuery) loadTaxApp(ctx context.Context, query *AppQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *App)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoice) + for i := range nodes { + fk := nodes[i].TaxAppID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(app.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "tax_app_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (biq *BillingInvoiceQuery) loadInvoicingApp(ctx context.Context, query *AppQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *App)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoice) + for i := range nodes { + fk := nodes[i].InvoicingAppID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(app.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "invoicing_app_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (biq *BillingInvoiceQuery) loadPaymentApp(ctx context.Context, query *AppQuery, nodes []*BillingInvoice, init func(*BillingInvoice), assign func(*BillingInvoice, *App)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoice) + for i := range nodes { + fk := nodes[i].PaymentAppID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(app.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "payment_app_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} func (biq *BillingInvoiceQuery) sqlCount(ctx context.Context) (int, error) { _spec := biq.querySpec() @@ -616,12 +900,24 @@ func (biq *BillingInvoiceQuery) querySpec() *sqlgraph.QuerySpec { _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) } } - if biq.withBillingProfile != nil { - _spec.Node.AddColumnOnce(billinginvoice.FieldBillingProfileID) + if biq.withSourceBillingProfile != nil { + _spec.Node.AddColumnOnce(billinginvoice.FieldSourceBillingProfileID) } if biq.withBillingWorkflowConfig != nil { _spec.Node.AddColumnOnce(billinginvoice.FieldWorkflowConfigID) } + if biq.withBillingInvoiceCustomer != nil { + _spec.Node.AddColumnOnce(billinginvoice.FieldCustomerID) + } + if biq.withTaxApp != nil { + _spec.Node.AddColumnOnce(billinginvoice.FieldTaxAppID) + } + if biq.withInvoicingApp != nil { + _spec.Node.AddColumnOnce(billinginvoice.FieldInvoicingAppID) + } + if biq.withPaymentApp != nil { + _spec.Node.AddColumnOnce(billinginvoice.FieldPaymentAppID) + } } if ps := biq.predicates; len(ps) > 0 { _spec.Predicate = func(selector *sql.Selector) { diff --git a/openmeter/ent/db/billinginvoice_update.go b/openmeter/ent/db/billinginvoice_update.go index 3e5e52a2b..1c5e57d18 100644 --- a/openmeter/ent/db/billinginvoice_update.go +++ b/openmeter/ent/db/billinginvoice_update.go @@ -13,9 +13,11 @@ import ( "entgo.io/ent/schema/field" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" + "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/timezone" ) // BillingInvoiceUpdate is the builder for updating BillingInvoice entities. @@ -31,6 +33,18 @@ func (biu *BillingInvoiceUpdate) Where(ps ...predicate.BillingInvoice) *BillingI return biu } +// SetMetadata sets the "metadata" field. +func (biu *BillingInvoiceUpdate) SetMetadata(m map[string]string) *BillingInvoiceUpdate { + biu.mutation.SetMetadata(m) + return biu +} + +// ClearMetadata clears the value of the "metadata" field. +func (biu *BillingInvoiceUpdate) ClearMetadata() *BillingInvoiceUpdate { + biu.mutation.ClearMetadata() + return biu +} + // SetUpdatedAt sets the "updated_at" field. func (biu *BillingInvoiceUpdate) SetUpdatedAt(t time.Time) *BillingInvoiceUpdate { biu.mutation.SetUpdatedAt(t) @@ -57,55 +71,405 @@ func (biu *BillingInvoiceUpdate) ClearDeletedAt() *BillingInvoiceUpdate { return biu } -// SetMetadata sets the "metadata" field. -func (biu *BillingInvoiceUpdate) SetMetadata(m map[string]string) *BillingInvoiceUpdate { - biu.mutation.SetMetadata(m) +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressCountry(mc models.CountryCode) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressCountry(mc) return biu } -// ClearMetadata clears the value of the "metadata" field. -func (biu *BillingInvoiceUpdate) ClearMetadata() *BillingInvoiceUpdate { - biu.mutation.ClearMetadata() +// SetNillableSupplierAddressCountry sets the "supplier_address_country" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressCountry(mc *models.CountryCode) *BillingInvoiceUpdate { + if mc != nil { + biu.SetSupplierAddressCountry(*mc) + } + return biu +} + +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressCountry() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressCountry() + return biu +} + +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressPostalCode(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressPostalCode(s) + return biu +} + +// SetNillableSupplierAddressPostalCode sets the "supplier_address_postal_code" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressPostalCode(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressPostalCode(*s) + } + return biu +} + +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressPostalCode() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressPostalCode() + return biu +} + +// SetSupplierAddressState sets the "supplier_address_state" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressState(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressState(s) + return biu +} + +// SetNillableSupplierAddressState sets the "supplier_address_state" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressState(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressState(*s) + } + return biu +} + +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressState() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressState() + return biu +} + +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressCity(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressCity(s) + return biu +} + +// SetNillableSupplierAddressCity sets the "supplier_address_city" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressCity(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressCity(*s) + } + return biu +} + +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressCity() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressCity() + return biu +} + +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressLine1(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressLine1(s) + return biu +} + +// SetNillableSupplierAddressLine1 sets the "supplier_address_line1" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressLine1(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressLine1(*s) + } + return biu +} + +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressLine1() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressLine1() + return biu +} + +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressLine2(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressLine2(s) + return biu +} + +// SetNillableSupplierAddressLine2 sets the "supplier_address_line2" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressLine2(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressLine2(*s) + } + return biu +} + +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressLine2() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressLine2() + return biu +} + +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (biu *BillingInvoiceUpdate) SetSupplierAddressPhoneNumber(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierAddressPhoneNumber(s) + return biu +} + +// SetNillableSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierAddressPhoneNumber(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierAddressPhoneNumber(*s) + } + return biu +} + +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (biu *BillingInvoiceUpdate) ClearSupplierAddressPhoneNumber() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierAddressPhoneNumber() + return biu +} + +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressCountry(mc models.CountryCode) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressCountry(mc) + return biu +} + +// SetNillableCustomerAddressCountry sets the "customer_address_country" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressCountry(mc *models.CountryCode) *BillingInvoiceUpdate { + if mc != nil { + biu.SetCustomerAddressCountry(*mc) + } + return biu +} + +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressCountry() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressCountry() + return biu +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressPostalCode(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressPostalCode(s) + return biu +} + +// SetNillableCustomerAddressPostalCode sets the "customer_address_postal_code" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressPostalCode(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerAddressPostalCode(*s) + } + return biu +} + +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressPostalCode() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressPostalCode() + return biu +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressState(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressState(s) + return biu +} + +// SetNillableCustomerAddressState sets the "customer_address_state" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressState(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerAddressState(*s) + } + return biu +} + +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressState() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressState() + return biu +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressCity(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressCity(s) + return biu +} + +// SetNillableCustomerAddressCity sets the "customer_address_city" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressCity(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerAddressCity(*s) + } + return biu +} + +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressCity() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressCity() + return biu +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressLine1(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressLine1(s) + return biu +} + +// SetNillableCustomerAddressLine1 sets the "customer_address_line1" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressLine1(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerAddressLine1(*s) + } + return biu +} + +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressLine1() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressLine1() + return biu +} + +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressLine2(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressLine2(s) + return biu +} + +// SetNillableCustomerAddressLine2 sets the "customer_address_line2" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressLine2(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerAddressLine2(*s) + } + return biu +} + +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressLine2() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressLine2() return biu } -// SetSeries sets the "series" field. -func (biu *BillingInvoiceUpdate) SetSeries(s string) *BillingInvoiceUpdate { - biu.mutation.SetSeries(s) +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (biu *BillingInvoiceUpdate) SetCustomerAddressPhoneNumber(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerAddressPhoneNumber(s) return biu } -// SetNillableSeries sets the "series" field if the given value is not nil. -func (biu *BillingInvoiceUpdate) SetNillableSeries(s *string) *BillingInvoiceUpdate { +// SetNillableCustomerAddressPhoneNumber sets the "customer_address_phone_number" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerAddressPhoneNumber(s *string) *BillingInvoiceUpdate { if s != nil { - biu.SetSeries(*s) + biu.SetCustomerAddressPhoneNumber(*s) } return biu } -// ClearSeries clears the value of the "series" field. -func (biu *BillingInvoiceUpdate) ClearSeries() *BillingInvoiceUpdate { - biu.mutation.ClearSeries() +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (biu *BillingInvoiceUpdate) ClearCustomerAddressPhoneNumber() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerAddressPhoneNumber() return biu } -// SetCode sets the "code" field. -func (biu *BillingInvoiceUpdate) SetCode(s string) *BillingInvoiceUpdate { - biu.mutation.SetCode(s) +// SetSupplierName sets the "supplier_name" field. +func (biu *BillingInvoiceUpdate) SetSupplierName(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierName(s) return biu } -// SetNillableCode sets the "code" field if the given value is not nil. -func (biu *BillingInvoiceUpdate) SetNillableCode(s *string) *BillingInvoiceUpdate { +// SetNillableSupplierName sets the "supplier_name" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierName(s *string) *BillingInvoiceUpdate { if s != nil { - biu.SetCode(*s) + biu.SetSupplierName(*s) } return biu } -// ClearCode clears the value of the "code" field. -func (biu *BillingInvoiceUpdate) ClearCode() *BillingInvoiceUpdate { - biu.mutation.ClearCode() +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (biu *BillingInvoiceUpdate) SetSupplierTaxCode(s string) *BillingInvoiceUpdate { + biu.mutation.SetSupplierTaxCode(s) + return biu +} + +// SetNillableSupplierTaxCode sets the "supplier_tax_code" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableSupplierTaxCode(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetSupplierTaxCode(*s) + } + return biu +} + +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (biu *BillingInvoiceUpdate) ClearSupplierTaxCode() *BillingInvoiceUpdate { + biu.mutation.ClearSupplierTaxCode() + return biu +} + +// SetCustomerName sets the "customer_name" field. +func (biu *BillingInvoiceUpdate) SetCustomerName(s string) *BillingInvoiceUpdate { + biu.mutation.SetCustomerName(s) + return biu +} + +// SetNillableCustomerName sets the "customer_name" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerName(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetCustomerName(*s) + } + return biu +} + +// SetCustomerTimezone sets the "customer_timezone" field. +func (biu *BillingInvoiceUpdate) SetCustomerTimezone(t timezone.Timezone) *BillingInvoiceUpdate { + biu.mutation.SetCustomerTimezone(t) + return biu +} + +// SetNillableCustomerTimezone sets the "customer_timezone" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableCustomerTimezone(t *timezone.Timezone) *BillingInvoiceUpdate { + if t != nil { + biu.SetCustomerTimezone(*t) + } + return biu +} + +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (biu *BillingInvoiceUpdate) ClearCustomerTimezone() *BillingInvoiceUpdate { + biu.mutation.ClearCustomerTimezone() + return biu +} + +// SetNumber sets the "number" field. +func (biu *BillingInvoiceUpdate) SetNumber(s string) *BillingInvoiceUpdate { + biu.mutation.SetNumber(s) + return biu +} + +// SetNillableNumber sets the "number" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableNumber(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetNumber(*s) + } + return biu +} + +// ClearNumber clears the value of the "number" field. +func (biu *BillingInvoiceUpdate) ClearNumber() *BillingInvoiceUpdate { + biu.mutation.ClearNumber() + return biu +} + +// SetType sets the "type" field. +func (biu *BillingInvoiceUpdate) SetType(bt billingentity.InvoiceType) *BillingInvoiceUpdate { + biu.mutation.SetType(bt) + return biu +} + +// SetNillableType sets the "type" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableType(bt *billingentity.InvoiceType) *BillingInvoiceUpdate { + if bt != nil { + biu.SetType(*bt) + } + return biu +} + +// SetDescription sets the "description" field. +func (biu *BillingInvoiceUpdate) SetDescription(s string) *BillingInvoiceUpdate { + biu.mutation.SetDescription(s) + return biu +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableDescription(s *string) *BillingInvoiceUpdate { + if s != nil { + biu.SetDescription(*s) + } + return biu +} + +// ClearDescription clears the value of the "description" field. +func (biu *BillingInvoiceUpdate) ClearDescription() *BillingInvoiceUpdate { + biu.mutation.ClearDescription() return biu } @@ -129,20 +493,46 @@ func (biu *BillingInvoiceUpdate) ClearVoidedAt() *BillingInvoiceUpdate { return biu } -// SetDueDate sets the "due_date" field. -func (biu *BillingInvoiceUpdate) SetDueDate(t time.Time) *BillingInvoiceUpdate { - biu.mutation.SetDueDate(t) +// SetIssuedAt sets the "issued_at" field. +func (biu *BillingInvoiceUpdate) SetIssuedAt(t time.Time) *BillingInvoiceUpdate { + biu.mutation.SetIssuedAt(t) + return biu +} + +// SetNillableIssuedAt sets the "issued_at" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableIssuedAt(t *time.Time) *BillingInvoiceUpdate { + if t != nil { + biu.SetIssuedAt(*t) + } + return biu +} + +// ClearIssuedAt clears the value of the "issued_at" field. +func (biu *BillingInvoiceUpdate) ClearIssuedAt() *BillingInvoiceUpdate { + biu.mutation.ClearIssuedAt() + return biu +} + +// SetDueAt sets the "due_at" field. +func (biu *BillingInvoiceUpdate) SetDueAt(t time.Time) *BillingInvoiceUpdate { + biu.mutation.SetDueAt(t) return biu } -// SetNillableDueDate sets the "due_date" field if the given value is not nil. -func (biu *BillingInvoiceUpdate) SetNillableDueDate(t *time.Time) *BillingInvoiceUpdate { +// SetNillableDueAt sets the "due_at" field if the given value is not nil. +func (biu *BillingInvoiceUpdate) SetNillableDueAt(t *time.Time) *BillingInvoiceUpdate { if t != nil { - biu.SetDueDate(*t) + biu.SetDueAt(*t) } return biu } +// ClearDueAt clears the value of the "due_at" field. +func (biu *BillingInvoiceUpdate) ClearDueAt() *BillingInvoiceUpdate { + biu.mutation.ClearDueAt() + return biu +} + // SetStatus sets the "status" field. func (biu *BillingInvoiceUpdate) SetStatus(bs billingentity.InvoiceStatus) *BillingInvoiceUpdate { biu.mutation.SetStatus(bs) @@ -185,6 +575,12 @@ func (biu *BillingInvoiceUpdate) SetNillablePeriodStart(t *time.Time) *BillingIn return biu } +// ClearPeriodStart clears the value of the "period_start" field. +func (biu *BillingInvoiceUpdate) ClearPeriodStart() *BillingInvoiceUpdate { + biu.mutation.ClearPeriodStart() + return biu +} + // SetPeriodEnd sets the "period_end" field. func (biu *BillingInvoiceUpdate) SetPeriodEnd(t time.Time) *BillingInvoiceUpdate { biu.mutation.SetPeriodEnd(t) @@ -199,6 +595,12 @@ func (biu *BillingInvoiceUpdate) SetNillablePeriodEnd(t *time.Time) *BillingInvo return biu } +// ClearPeriodEnd clears the value of the "period_end" field. +func (biu *BillingInvoiceUpdate) ClearPeriodEnd() *BillingInvoiceUpdate { + biu.mutation.ClearPeriodEnd() + return biu +} + // SetBillingWorkflowConfigID sets the "billing_workflow_config" edge to the BillingWorkflowConfig entity by ID. func (biu *BillingInvoiceUpdate) SetBillingWorkflowConfigID(id string) *BillingInvoiceUpdate { biu.mutation.SetBillingWorkflowConfigID(id) @@ -210,19 +612,19 @@ func (biu *BillingInvoiceUpdate) SetBillingWorkflowConfig(b *BillingWorkflowConf return biu.SetBillingWorkflowConfigID(b.ID) } -// AddBillingInvoiceItemIDs adds the "billing_invoice_items" edge to the BillingInvoiceItem entity by IDs. -func (biu *BillingInvoiceUpdate) AddBillingInvoiceItemIDs(ids ...string) *BillingInvoiceUpdate { - biu.mutation.AddBillingInvoiceItemIDs(ids...) +// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs. +func (biu *BillingInvoiceUpdate) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceUpdate { + biu.mutation.AddBillingInvoiceLineIDs(ids...) return biu } -// AddBillingInvoiceItems adds the "billing_invoice_items" edges to the BillingInvoiceItem entity. -func (biu *BillingInvoiceUpdate) AddBillingInvoiceItems(b ...*BillingInvoiceItem) *BillingInvoiceUpdate { +// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity. +func (biu *BillingInvoiceUpdate) AddBillingInvoiceLines(b ...*BillingInvoiceLine) *BillingInvoiceUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return biu.AddBillingInvoiceItemIDs(ids...) + return biu.AddBillingInvoiceLineIDs(ids...) } // Mutation returns the BillingInvoiceMutation object of the builder. @@ -236,25 +638,25 @@ func (biu *BillingInvoiceUpdate) ClearBillingWorkflowConfig() *BillingInvoiceUpd return biu } -// ClearBillingInvoiceItems clears all "billing_invoice_items" edges to the BillingInvoiceItem entity. -func (biu *BillingInvoiceUpdate) ClearBillingInvoiceItems() *BillingInvoiceUpdate { - biu.mutation.ClearBillingInvoiceItems() +// ClearBillingInvoiceLines clears all "billing_invoice_lines" edges to the BillingInvoiceLine entity. +func (biu *BillingInvoiceUpdate) ClearBillingInvoiceLines() *BillingInvoiceUpdate { + biu.mutation.ClearBillingInvoiceLines() return biu } -// RemoveBillingInvoiceItemIDs removes the "billing_invoice_items" edge to BillingInvoiceItem entities by IDs. -func (biu *BillingInvoiceUpdate) RemoveBillingInvoiceItemIDs(ids ...string) *BillingInvoiceUpdate { - biu.mutation.RemoveBillingInvoiceItemIDs(ids...) +// RemoveBillingInvoiceLineIDs removes the "billing_invoice_lines" edge to BillingInvoiceLine entities by IDs. +func (biu *BillingInvoiceUpdate) RemoveBillingInvoiceLineIDs(ids ...string) *BillingInvoiceUpdate { + biu.mutation.RemoveBillingInvoiceLineIDs(ids...) return biu } -// RemoveBillingInvoiceItems removes "billing_invoice_items" edges to BillingInvoiceItem entities. -func (biu *BillingInvoiceUpdate) RemoveBillingInvoiceItems(b ...*BillingInvoiceItem) *BillingInvoiceUpdate { +// RemoveBillingInvoiceLines removes "billing_invoice_lines" edges to BillingInvoiceLine entities. +func (biu *BillingInvoiceUpdate) RemoveBillingInvoiceLines(b ...*BillingInvoiceLine) *BillingInvoiceUpdate { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return biu.RemoveBillingInvoiceItemIDs(ids...) + return biu.RemoveBillingInvoiceLineIDs(ids...) } // Save executes the query and returns the number of nodes affected by the update operation. @@ -295,17 +697,59 @@ func (biu *BillingInvoiceUpdate) defaults() { // check runs all checks and user-defined validators on the builder. func (biu *BillingInvoiceUpdate) check() error { + if v, ok := biu.mutation.SupplierAddressCountry(); ok { + if err := billinginvoice.SupplierAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "supplier_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_address_country": %w`, err)} + } + } + if v, ok := biu.mutation.CustomerAddressCountry(); ok { + if err := billinginvoice.CustomerAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "customer_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_address_country": %w`, err)} + } + } + if v, ok := biu.mutation.SupplierName(); ok { + if err := billinginvoice.SupplierNameValidator(v); err != nil { + return &ValidationError{Name: "supplier_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_name": %w`, err)} + } + } + if v, ok := biu.mutation.CustomerName(); ok { + if err := billinginvoice.CustomerNameValidator(v); err != nil { + return &ValidationError{Name: "customer_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_name": %w`, err)} + } + } + if v, ok := biu.mutation.CustomerTimezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "customer_timezone", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_timezone": %w`, err)} + } + } + if v, ok := biu.mutation.GetType(); ok { + if err := billinginvoice.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.type": %w`, err)} + } + } if v, ok := biu.mutation.Status(); ok { if err := billinginvoice.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.status": %w`, err)} } } - if biu.mutation.BillingProfileCleared() && len(biu.mutation.BillingProfileIDs()) > 0 { - return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_profile"`) + if biu.mutation.SourceBillingProfileCleared() && len(biu.mutation.SourceBillingProfileIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.source_billing_profile"`) } if biu.mutation.BillingWorkflowConfigCleared() && len(biu.mutation.BillingWorkflowConfigIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_workflow_config"`) } + if biu.mutation.BillingInvoiceCustomerCleared() && len(biu.mutation.BillingInvoiceCustomerIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_invoice_customer"`) + } + if biu.mutation.TaxAppCleared() && len(biu.mutation.TaxAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.tax_app"`) + } + if biu.mutation.InvoicingAppCleared() && len(biu.mutation.InvoicingAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.invoicing_app"`) + } + if biu.mutation.PaymentAppCleared() && len(biu.mutation.PaymentAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.payment_app"`) + } return nil } @@ -321,6 +765,12 @@ func (biu *BillingInvoiceUpdate) sqlSave(ctx context.Context) (n int, err error) } } } + if value, ok := biu.mutation.Metadata(); ok { + _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) + } + if biu.mutation.MetadataCleared() { + _spec.ClearField(billinginvoice.FieldMetadata, field.TypeJSON) + } if value, ok := biu.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoice.FieldUpdatedAt, field.TypeTime, value) } @@ -330,23 +780,122 @@ func (biu *BillingInvoiceUpdate) sqlSave(ctx context.Context) (n int, err error) if biu.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoice.FieldDeletedAt, field.TypeTime) } - if value, ok := biu.mutation.Metadata(); ok { - _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) + if value, ok := biu.mutation.SupplierAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCountry, field.TypeString, value) } - if biu.mutation.MetadataCleared() { - _spec.ClearField(billinginvoice.FieldMetadata, field.TypeJSON) + if biu.mutation.SupplierAddressCountryCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressCountry, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPostalCode, field.TypeString, value) + } + if biu.mutation.SupplierAddressPostalCodeCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressPostalCode, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressState(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressState, field.TypeString, value) + } + if biu.mutation.SupplierAddressStateCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressState, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressCity(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCity, field.TypeString, value) + } + if biu.mutation.SupplierAddressCityCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressCity, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine1, field.TypeString, value) + } + if biu.mutation.SupplierAddressLine1Cleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressLine1, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine2, field.TypeString, value) + } + if biu.mutation.SupplierAddressLine2Cleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressLine2, field.TypeString) + } + if value, ok := biu.mutation.SupplierAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPhoneNumber, field.TypeString, value) + } + if biu.mutation.SupplierAddressPhoneNumberCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressPhoneNumber, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCountry, field.TypeString, value) + } + if biu.mutation.CustomerAddressCountryCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressCountry, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPostalCode, field.TypeString, value) + } + if biu.mutation.CustomerAddressPostalCodeCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressPostalCode, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressState(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressState, field.TypeString, value) + } + if biu.mutation.CustomerAddressStateCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressState, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressCity(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCity, field.TypeString, value) + } + if biu.mutation.CustomerAddressCityCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressCity, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine1, field.TypeString, value) + } + if biu.mutation.CustomerAddressLine1Cleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressLine1, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine2, field.TypeString, value) + } + if biu.mutation.CustomerAddressLine2Cleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressLine2, field.TypeString) + } + if value, ok := biu.mutation.CustomerAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPhoneNumber, field.TypeString, value) + } + if biu.mutation.CustomerAddressPhoneNumberCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressPhoneNumber, field.TypeString) + } + if value, ok := biu.mutation.SupplierName(); ok { + _spec.SetField(billinginvoice.FieldSupplierName, field.TypeString, value) } - if value, ok := biu.mutation.Series(); ok { - _spec.SetField(billinginvoice.FieldSeries, field.TypeString, value) + if value, ok := biu.mutation.SupplierTaxCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierTaxCode, field.TypeString, value) } - if biu.mutation.SeriesCleared() { - _spec.ClearField(billinginvoice.FieldSeries, field.TypeString) + if biu.mutation.SupplierTaxCodeCleared() { + _spec.ClearField(billinginvoice.FieldSupplierTaxCode, field.TypeString) } - if value, ok := biu.mutation.Code(); ok { - _spec.SetField(billinginvoice.FieldCode, field.TypeString, value) + if value, ok := biu.mutation.CustomerName(); ok { + _spec.SetField(billinginvoice.FieldCustomerName, field.TypeString, value) } - if biu.mutation.CodeCleared() { - _spec.ClearField(billinginvoice.FieldCode, field.TypeString) + if value, ok := biu.mutation.CustomerTimezone(); ok { + _spec.SetField(billinginvoice.FieldCustomerTimezone, field.TypeString, value) + } + if biu.mutation.CustomerTimezoneCleared() { + _spec.ClearField(billinginvoice.FieldCustomerTimezone, field.TypeString) + } + if value, ok := biu.mutation.Number(); ok { + _spec.SetField(billinginvoice.FieldNumber, field.TypeString, value) + } + if biu.mutation.NumberCleared() { + _spec.ClearField(billinginvoice.FieldNumber, field.TypeString) + } + if value, ok := biu.mutation.GetType(); ok { + _spec.SetField(billinginvoice.FieldType, field.TypeEnum, value) + } + if value, ok := biu.mutation.Description(); ok { + _spec.SetField(billinginvoice.FieldDescription, field.TypeString, value) + } + if biu.mutation.DescriptionCleared() { + _spec.ClearField(billinginvoice.FieldDescription, field.TypeString) } if value, ok := biu.mutation.VoidedAt(); ok { _spec.SetField(billinginvoice.FieldVoidedAt, field.TypeTime, value) @@ -354,8 +903,17 @@ func (biu *BillingInvoiceUpdate) sqlSave(ctx context.Context) (n int, err error) if biu.mutation.VoidedAtCleared() { _spec.ClearField(billinginvoice.FieldVoidedAt, field.TypeTime) } - if value, ok := biu.mutation.DueDate(); ok { - _spec.SetField(billinginvoice.FieldDueDate, field.TypeTime, value) + if value, ok := biu.mutation.IssuedAt(); ok { + _spec.SetField(billinginvoice.FieldIssuedAt, field.TypeTime, value) + } + if biu.mutation.IssuedAtCleared() { + _spec.ClearField(billinginvoice.FieldIssuedAt, field.TypeTime) + } + if value, ok := biu.mutation.DueAt(); ok { + _spec.SetField(billinginvoice.FieldDueAt, field.TypeTime, value) + } + if biu.mutation.DueAtCleared() { + _spec.ClearField(billinginvoice.FieldDueAt, field.TypeTime) } if value, ok := biu.mutation.Status(); ok { _spec.SetField(billinginvoice.FieldStatus, field.TypeEnum, value) @@ -363,178 +921,546 @@ func (biu *BillingInvoiceUpdate) sqlSave(ctx context.Context) (n int, err error) if value, ok := biu.mutation.PeriodStart(); ok { _spec.SetField(billinginvoice.FieldPeriodStart, field.TypeTime, value) } + if biu.mutation.PeriodStartCleared() { + _spec.ClearField(billinginvoice.FieldPeriodStart, field.TypeTime) + } if value, ok := biu.mutation.PeriodEnd(); ok { _spec.SetField(billinginvoice.FieldPeriodEnd, field.TypeTime, value) } - if biu.mutation.BillingWorkflowConfigCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2O, - Inverse: true, - Table: billinginvoice.BillingWorkflowConfigTable, - Columns: []string{billinginvoice.BillingWorkflowConfigColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billingworkflowconfig.FieldID, field.TypeString), - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + if biu.mutation.PeriodEndCleared() { + _spec.ClearField(billinginvoice.FieldPeriodEnd, field.TypeTime) + } + if biu.mutation.BillingWorkflowConfigCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: billinginvoice.BillingWorkflowConfigTable, + Columns: []string{billinginvoice.BillingWorkflowConfigColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billingworkflowconfig.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := biu.mutation.BillingWorkflowConfigIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2O, + Inverse: true, + Table: billinginvoice.BillingWorkflowConfigTable, + Columns: []string{billinginvoice.BillingWorkflowConfigColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billingworkflowconfig.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if biu.mutation.BillingInvoiceLinesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := biu.mutation.RemovedBillingInvoiceLinesIDs(); len(nodes) > 0 && !biu.mutation.BillingInvoiceLinesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := biu.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if n, err = sqlgraph.UpdateNodes(ctx, biu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{billinginvoice.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + biu.mutation.done = true + return n, nil +} + +// BillingInvoiceUpdateOne is the builder for updating a single BillingInvoice entity. +type BillingInvoiceUpdateOne struct { + config + fields []string + hooks []Hook + mutation *BillingInvoiceMutation +} + +// SetMetadata sets the "metadata" field. +func (biuo *BillingInvoiceUpdateOne) SetMetadata(m map[string]string) *BillingInvoiceUpdateOne { + biuo.mutation.SetMetadata(m) + return biuo +} + +// ClearMetadata clears the value of the "metadata" field. +func (biuo *BillingInvoiceUpdateOne) ClearMetadata() *BillingInvoiceUpdateOne { + biuo.mutation.ClearMetadata() + return biuo +} + +// SetUpdatedAt sets the "updated_at" field. +func (biuo *BillingInvoiceUpdateOne) SetUpdatedAt(t time.Time) *BillingInvoiceUpdateOne { + biuo.mutation.SetUpdatedAt(t) + return biuo +} + +// SetDeletedAt sets the "deleted_at" field. +func (biuo *BillingInvoiceUpdateOne) SetDeletedAt(t time.Time) *BillingInvoiceUpdateOne { + biuo.mutation.SetDeletedAt(t) + return biuo +} + +// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableDeletedAt(t *time.Time) *BillingInvoiceUpdateOne { + if t != nil { + biuo.SetDeletedAt(*t) + } + return biuo +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (biuo *BillingInvoiceUpdateOne) ClearDeletedAt() *BillingInvoiceUpdateOne { + biuo.mutation.ClearDeletedAt() + return biuo +} + +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressCountry(mc models.CountryCode) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressCountry(mc) + return biuo +} + +// SetNillableSupplierAddressCountry sets the "supplier_address_country" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressCountry(mc *models.CountryCode) *BillingInvoiceUpdateOne { + if mc != nil { + biuo.SetSupplierAddressCountry(*mc) + } + return biuo +} + +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressCountry() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressCountry() + return biuo +} + +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressPostalCode(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressPostalCode(s) + return biuo +} + +// SetNillableSupplierAddressPostalCode sets the "supplier_address_postal_code" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressPostalCode(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressPostalCode(*s) + } + return biuo +} + +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressPostalCode() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressPostalCode() + return biuo +} + +// SetSupplierAddressState sets the "supplier_address_state" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressState(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressState(s) + return biuo +} + +// SetNillableSupplierAddressState sets the "supplier_address_state" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressState(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressState(*s) + } + return biuo +} + +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressState() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressState() + return biuo +} + +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressCity(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressCity(s) + return biuo +} + +// SetNillableSupplierAddressCity sets the "supplier_address_city" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressCity(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressCity(*s) + } + return biuo +} + +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressCity() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressCity() + return biuo +} + +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressLine1(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressLine1(s) + return biuo +} + +// SetNillableSupplierAddressLine1 sets the "supplier_address_line1" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressLine1(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressLine1(*s) + } + return biuo +} + +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressLine1() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressLine1() + return biuo +} + +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressLine2(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressLine2(s) + return biuo +} + +// SetNillableSupplierAddressLine2 sets the "supplier_address_line2" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressLine2(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressLine2(*s) + } + return biuo +} + +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressLine2() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressLine2() + return biuo +} + +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierAddressPhoneNumber(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierAddressPhoneNumber(s) + return biuo +} + +// SetNillableSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierAddressPhoneNumber(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierAddressPhoneNumber(*s) + } + return biuo +} + +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierAddressPhoneNumber() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierAddressPhoneNumber() + return biuo +} + +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressCountry(mc models.CountryCode) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressCountry(mc) + return biuo +} + +// SetNillableCustomerAddressCountry sets the "customer_address_country" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressCountry(mc *models.CountryCode) *BillingInvoiceUpdateOne { + if mc != nil { + biuo.SetCustomerAddressCountry(*mc) + } + return biuo +} + +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressCountry() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressCountry() + return biuo +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressPostalCode(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressPostalCode(s) + return biuo +} + +// SetNillableCustomerAddressPostalCode sets the "customer_address_postal_code" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressPostalCode(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressPostalCode(*s) + } + return biuo +} + +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressPostalCode() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressPostalCode() + return biuo +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressState(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressState(s) + return biuo +} + +// SetNillableCustomerAddressState sets the "customer_address_state" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressState(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressState(*s) } - if nodes := biu.mutation.BillingWorkflowConfigIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2O, - Inverse: true, - Table: billinginvoice.BillingWorkflowConfigTable, - Columns: []string{billinginvoice.BillingWorkflowConfigColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billingworkflowconfig.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) + return biuo +} + +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressState() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressState() + return biuo +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressCity(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressCity(s) + return biuo +} + +// SetNillableCustomerAddressCity sets the "customer_address_city" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressCity(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressCity(*s) } - if biu.mutation.BillingInvoiceItemsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + return biuo +} + +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressCity() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressCity() + return biuo +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressLine1(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressLine1(s) + return biuo +} + +// SetNillableCustomerAddressLine1 sets the "customer_address_line1" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressLine1(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressLine1(*s) } - if nodes := biu.mutation.RemovedBillingInvoiceItemsIDs(); len(nodes) > 0 && !biu.mutation.BillingInvoiceItemsCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + return biuo +} + +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressLine1() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressLine1() + return biuo +} + +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressLine2(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressLine2(s) + return biuo +} + +// SetNillableCustomerAddressLine2 sets the "customer_address_line2" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressLine2(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressLine2(*s) } - if nodes := biu.mutation.BillingInvoiceItemsIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.O2M, - Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) + return biuo +} + +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressLine2() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressLine2() + return biuo +} + +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerAddressPhoneNumber(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerAddressPhoneNumber(s) + return biuo +} + +// SetNillableCustomerAddressPhoneNumber sets the "customer_address_phone_number" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerAddressPhoneNumber(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerAddressPhoneNumber(*s) } - if n, err = sqlgraph.UpdateNodes(ctx, biu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{billinginvoice.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return 0, err + return biuo +} + +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerAddressPhoneNumber() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerAddressPhoneNumber() + return biuo +} + +// SetSupplierName sets the "supplier_name" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierName(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierName(s) + return biuo +} + +// SetNillableSupplierName sets the "supplier_name" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierName(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierName(*s) } - biu.mutation.done = true - return n, nil + return biuo } -// BillingInvoiceUpdateOne is the builder for updating a single BillingInvoice entity. -type BillingInvoiceUpdateOne struct { - config - fields []string - hooks []Hook - mutation *BillingInvoiceMutation +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (biuo *BillingInvoiceUpdateOne) SetSupplierTaxCode(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetSupplierTaxCode(s) + return biuo } -// SetUpdatedAt sets the "updated_at" field. -func (biuo *BillingInvoiceUpdateOne) SetUpdatedAt(t time.Time) *BillingInvoiceUpdateOne { - biuo.mutation.SetUpdatedAt(t) +// SetNillableSupplierTaxCode sets the "supplier_tax_code" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableSupplierTaxCode(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetSupplierTaxCode(*s) + } return biuo } -// SetDeletedAt sets the "deleted_at" field. -func (biuo *BillingInvoiceUpdateOne) SetDeletedAt(t time.Time) *BillingInvoiceUpdateOne { - biuo.mutation.SetDeletedAt(t) +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (biuo *BillingInvoiceUpdateOne) ClearSupplierTaxCode() *BillingInvoiceUpdateOne { + biuo.mutation.ClearSupplierTaxCode() return biuo } -// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. -func (biuo *BillingInvoiceUpdateOne) SetNillableDeletedAt(t *time.Time) *BillingInvoiceUpdateOne { - if t != nil { - biuo.SetDeletedAt(*t) +// SetCustomerName sets the "customer_name" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerName(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerName(s) + return biuo +} + +// SetNillableCustomerName sets the "customer_name" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerName(s *string) *BillingInvoiceUpdateOne { + if s != nil { + biuo.SetCustomerName(*s) } return biuo } -// ClearDeletedAt clears the value of the "deleted_at" field. -func (biuo *BillingInvoiceUpdateOne) ClearDeletedAt() *BillingInvoiceUpdateOne { - biuo.mutation.ClearDeletedAt() +// SetCustomerTimezone sets the "customer_timezone" field. +func (biuo *BillingInvoiceUpdateOne) SetCustomerTimezone(t timezone.Timezone) *BillingInvoiceUpdateOne { + biuo.mutation.SetCustomerTimezone(t) return biuo } -// SetMetadata sets the "metadata" field. -func (biuo *BillingInvoiceUpdateOne) SetMetadata(m map[string]string) *BillingInvoiceUpdateOne { - biuo.mutation.SetMetadata(m) +// SetNillableCustomerTimezone sets the "customer_timezone" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableCustomerTimezone(t *timezone.Timezone) *BillingInvoiceUpdateOne { + if t != nil { + biuo.SetCustomerTimezone(*t) + } return biuo } -// ClearMetadata clears the value of the "metadata" field. -func (biuo *BillingInvoiceUpdateOne) ClearMetadata() *BillingInvoiceUpdateOne { - biuo.mutation.ClearMetadata() +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (biuo *BillingInvoiceUpdateOne) ClearCustomerTimezone() *BillingInvoiceUpdateOne { + biuo.mutation.ClearCustomerTimezone() return biuo } -// SetSeries sets the "series" field. -func (biuo *BillingInvoiceUpdateOne) SetSeries(s string) *BillingInvoiceUpdateOne { - biuo.mutation.SetSeries(s) +// SetNumber sets the "number" field. +func (biuo *BillingInvoiceUpdateOne) SetNumber(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetNumber(s) return biuo } -// SetNillableSeries sets the "series" field if the given value is not nil. -func (biuo *BillingInvoiceUpdateOne) SetNillableSeries(s *string) *BillingInvoiceUpdateOne { +// SetNillableNumber sets the "number" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableNumber(s *string) *BillingInvoiceUpdateOne { if s != nil { - biuo.SetSeries(*s) + biuo.SetNumber(*s) } return biuo } -// ClearSeries clears the value of the "series" field. -func (biuo *BillingInvoiceUpdateOne) ClearSeries() *BillingInvoiceUpdateOne { - biuo.mutation.ClearSeries() +// ClearNumber clears the value of the "number" field. +func (biuo *BillingInvoiceUpdateOne) ClearNumber() *BillingInvoiceUpdateOne { + biuo.mutation.ClearNumber() + return biuo +} + +// SetType sets the "type" field. +func (biuo *BillingInvoiceUpdateOne) SetType(bt billingentity.InvoiceType) *BillingInvoiceUpdateOne { + biuo.mutation.SetType(bt) return biuo } -// SetCode sets the "code" field. -func (biuo *BillingInvoiceUpdateOne) SetCode(s string) *BillingInvoiceUpdateOne { - biuo.mutation.SetCode(s) +// SetNillableType sets the "type" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableType(bt *billingentity.InvoiceType) *BillingInvoiceUpdateOne { + if bt != nil { + biuo.SetType(*bt) + } + return biuo +} + +// SetDescription sets the "description" field. +func (biuo *BillingInvoiceUpdateOne) SetDescription(s string) *BillingInvoiceUpdateOne { + biuo.mutation.SetDescription(s) return biuo } -// SetNillableCode sets the "code" field if the given value is not nil. -func (biuo *BillingInvoiceUpdateOne) SetNillableCode(s *string) *BillingInvoiceUpdateOne { +// SetNillableDescription sets the "description" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableDescription(s *string) *BillingInvoiceUpdateOne { if s != nil { - biuo.SetCode(*s) + biuo.SetDescription(*s) } return biuo } -// ClearCode clears the value of the "code" field. -func (biuo *BillingInvoiceUpdateOne) ClearCode() *BillingInvoiceUpdateOne { - biuo.mutation.ClearCode() +// ClearDescription clears the value of the "description" field. +func (biuo *BillingInvoiceUpdateOne) ClearDescription() *BillingInvoiceUpdateOne { + biuo.mutation.ClearDescription() return biuo } @@ -558,20 +1484,46 @@ func (biuo *BillingInvoiceUpdateOne) ClearVoidedAt() *BillingInvoiceUpdateOne { return biuo } -// SetDueDate sets the "due_date" field. -func (biuo *BillingInvoiceUpdateOne) SetDueDate(t time.Time) *BillingInvoiceUpdateOne { - biuo.mutation.SetDueDate(t) +// SetIssuedAt sets the "issued_at" field. +func (biuo *BillingInvoiceUpdateOne) SetIssuedAt(t time.Time) *BillingInvoiceUpdateOne { + biuo.mutation.SetIssuedAt(t) + return biuo +} + +// SetNillableIssuedAt sets the "issued_at" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableIssuedAt(t *time.Time) *BillingInvoiceUpdateOne { + if t != nil { + biuo.SetIssuedAt(*t) + } + return biuo +} + +// ClearIssuedAt clears the value of the "issued_at" field. +func (biuo *BillingInvoiceUpdateOne) ClearIssuedAt() *BillingInvoiceUpdateOne { + biuo.mutation.ClearIssuedAt() return biuo } -// SetNillableDueDate sets the "due_date" field if the given value is not nil. -func (biuo *BillingInvoiceUpdateOne) SetNillableDueDate(t *time.Time) *BillingInvoiceUpdateOne { +// SetDueAt sets the "due_at" field. +func (biuo *BillingInvoiceUpdateOne) SetDueAt(t time.Time) *BillingInvoiceUpdateOne { + biuo.mutation.SetDueAt(t) + return biuo +} + +// SetNillableDueAt sets the "due_at" field if the given value is not nil. +func (biuo *BillingInvoiceUpdateOne) SetNillableDueAt(t *time.Time) *BillingInvoiceUpdateOne { if t != nil { - biuo.SetDueDate(*t) + biuo.SetDueAt(*t) } return biuo } +// ClearDueAt clears the value of the "due_at" field. +func (biuo *BillingInvoiceUpdateOne) ClearDueAt() *BillingInvoiceUpdateOne { + biuo.mutation.ClearDueAt() + return biuo +} + // SetStatus sets the "status" field. func (biuo *BillingInvoiceUpdateOne) SetStatus(bs billingentity.InvoiceStatus) *BillingInvoiceUpdateOne { biuo.mutation.SetStatus(bs) @@ -614,6 +1566,12 @@ func (biuo *BillingInvoiceUpdateOne) SetNillablePeriodStart(t *time.Time) *Billi return biuo } +// ClearPeriodStart clears the value of the "period_start" field. +func (biuo *BillingInvoiceUpdateOne) ClearPeriodStart() *BillingInvoiceUpdateOne { + biuo.mutation.ClearPeriodStart() + return biuo +} + // SetPeriodEnd sets the "period_end" field. func (biuo *BillingInvoiceUpdateOne) SetPeriodEnd(t time.Time) *BillingInvoiceUpdateOne { biuo.mutation.SetPeriodEnd(t) @@ -628,6 +1586,12 @@ func (biuo *BillingInvoiceUpdateOne) SetNillablePeriodEnd(t *time.Time) *Billing return biuo } +// ClearPeriodEnd clears the value of the "period_end" field. +func (biuo *BillingInvoiceUpdateOne) ClearPeriodEnd() *BillingInvoiceUpdateOne { + biuo.mutation.ClearPeriodEnd() + return biuo +} + // SetBillingWorkflowConfigID sets the "billing_workflow_config" edge to the BillingWorkflowConfig entity by ID. func (biuo *BillingInvoiceUpdateOne) SetBillingWorkflowConfigID(id string) *BillingInvoiceUpdateOne { biuo.mutation.SetBillingWorkflowConfigID(id) @@ -639,19 +1603,19 @@ func (biuo *BillingInvoiceUpdateOne) SetBillingWorkflowConfig(b *BillingWorkflow return biuo.SetBillingWorkflowConfigID(b.ID) } -// AddBillingInvoiceItemIDs adds the "billing_invoice_items" edge to the BillingInvoiceItem entity by IDs. -func (biuo *BillingInvoiceUpdateOne) AddBillingInvoiceItemIDs(ids ...string) *BillingInvoiceUpdateOne { - biuo.mutation.AddBillingInvoiceItemIDs(ids...) +// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs. +func (biuo *BillingInvoiceUpdateOne) AddBillingInvoiceLineIDs(ids ...string) *BillingInvoiceUpdateOne { + biuo.mutation.AddBillingInvoiceLineIDs(ids...) return biuo } -// AddBillingInvoiceItems adds the "billing_invoice_items" edges to the BillingInvoiceItem entity. -func (biuo *BillingInvoiceUpdateOne) AddBillingInvoiceItems(b ...*BillingInvoiceItem) *BillingInvoiceUpdateOne { +// AddBillingInvoiceLines adds the "billing_invoice_lines" edges to the BillingInvoiceLine entity. +func (biuo *BillingInvoiceUpdateOne) AddBillingInvoiceLines(b ...*BillingInvoiceLine) *BillingInvoiceUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return biuo.AddBillingInvoiceItemIDs(ids...) + return biuo.AddBillingInvoiceLineIDs(ids...) } // Mutation returns the BillingInvoiceMutation object of the builder. @@ -665,25 +1629,25 @@ func (biuo *BillingInvoiceUpdateOne) ClearBillingWorkflowConfig() *BillingInvoic return biuo } -// ClearBillingInvoiceItems clears all "billing_invoice_items" edges to the BillingInvoiceItem entity. -func (biuo *BillingInvoiceUpdateOne) ClearBillingInvoiceItems() *BillingInvoiceUpdateOne { - biuo.mutation.ClearBillingInvoiceItems() +// ClearBillingInvoiceLines clears all "billing_invoice_lines" edges to the BillingInvoiceLine entity. +func (biuo *BillingInvoiceUpdateOne) ClearBillingInvoiceLines() *BillingInvoiceUpdateOne { + biuo.mutation.ClearBillingInvoiceLines() return biuo } -// RemoveBillingInvoiceItemIDs removes the "billing_invoice_items" edge to BillingInvoiceItem entities by IDs. -func (biuo *BillingInvoiceUpdateOne) RemoveBillingInvoiceItemIDs(ids ...string) *BillingInvoiceUpdateOne { - biuo.mutation.RemoveBillingInvoiceItemIDs(ids...) +// RemoveBillingInvoiceLineIDs removes the "billing_invoice_lines" edge to BillingInvoiceLine entities by IDs. +func (biuo *BillingInvoiceUpdateOne) RemoveBillingInvoiceLineIDs(ids ...string) *BillingInvoiceUpdateOne { + biuo.mutation.RemoveBillingInvoiceLineIDs(ids...) return biuo } -// RemoveBillingInvoiceItems removes "billing_invoice_items" edges to BillingInvoiceItem entities. -func (biuo *BillingInvoiceUpdateOne) RemoveBillingInvoiceItems(b ...*BillingInvoiceItem) *BillingInvoiceUpdateOne { +// RemoveBillingInvoiceLines removes "billing_invoice_lines" edges to BillingInvoiceLine entities. +func (biuo *BillingInvoiceUpdateOne) RemoveBillingInvoiceLines(b ...*BillingInvoiceLine) *BillingInvoiceUpdateOne { ids := make([]string, len(b)) for i := range b { ids[i] = b[i].ID } - return biuo.RemoveBillingInvoiceItemIDs(ids...) + return biuo.RemoveBillingInvoiceLineIDs(ids...) } // Where appends a list predicates to the BillingInvoiceUpdate builder. @@ -737,17 +1701,59 @@ func (biuo *BillingInvoiceUpdateOne) defaults() { // check runs all checks and user-defined validators on the builder. func (biuo *BillingInvoiceUpdateOne) check() error { + if v, ok := biuo.mutation.SupplierAddressCountry(); ok { + if err := billinginvoice.SupplierAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "supplier_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_address_country": %w`, err)} + } + } + if v, ok := biuo.mutation.CustomerAddressCountry(); ok { + if err := billinginvoice.CustomerAddressCountryValidator(string(v)); err != nil { + return &ValidationError{Name: "customer_address_country", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_address_country": %w`, err)} + } + } + if v, ok := biuo.mutation.SupplierName(); ok { + if err := billinginvoice.SupplierNameValidator(v); err != nil { + return &ValidationError{Name: "supplier_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.supplier_name": %w`, err)} + } + } + if v, ok := biuo.mutation.CustomerName(); ok { + if err := billinginvoice.CustomerNameValidator(v); err != nil { + return &ValidationError{Name: "customer_name", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_name": %w`, err)} + } + } + if v, ok := biuo.mutation.CustomerTimezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "customer_timezone", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.customer_timezone": %w`, err)} + } + } + if v, ok := biuo.mutation.GetType(); ok { + if err := billinginvoice.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.type": %w`, err)} + } + } if v, ok := biuo.mutation.Status(); ok { if err := billinginvoice.StatusValidator(v); err != nil { return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "BillingInvoice.status": %w`, err)} } } - if biuo.mutation.BillingProfileCleared() && len(biuo.mutation.BillingProfileIDs()) > 0 { - return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_profile"`) + if biuo.mutation.SourceBillingProfileCleared() && len(biuo.mutation.SourceBillingProfileIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.source_billing_profile"`) } if biuo.mutation.BillingWorkflowConfigCleared() && len(biuo.mutation.BillingWorkflowConfigIDs()) > 0 { return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_workflow_config"`) } + if biuo.mutation.BillingInvoiceCustomerCleared() && len(biuo.mutation.BillingInvoiceCustomerIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.billing_invoice_customer"`) + } + if biuo.mutation.TaxAppCleared() && len(biuo.mutation.TaxAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.tax_app"`) + } + if biuo.mutation.InvoicingAppCleared() && len(biuo.mutation.InvoicingAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.invoicing_app"`) + } + if biuo.mutation.PaymentAppCleared() && len(biuo.mutation.PaymentAppIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoice.payment_app"`) + } return nil } @@ -780,6 +1786,12 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin } } } + if value, ok := biuo.mutation.Metadata(); ok { + _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) + } + if biuo.mutation.MetadataCleared() { + _spec.ClearField(billinginvoice.FieldMetadata, field.TypeJSON) + } if value, ok := biuo.mutation.UpdatedAt(); ok { _spec.SetField(billinginvoice.FieldUpdatedAt, field.TypeTime, value) } @@ -789,23 +1801,122 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin if biuo.mutation.DeletedAtCleared() { _spec.ClearField(billinginvoice.FieldDeletedAt, field.TypeTime) } - if value, ok := biuo.mutation.Metadata(); ok { - _spec.SetField(billinginvoice.FieldMetadata, field.TypeJSON, value) + if value, ok := biuo.mutation.SupplierAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCountry, field.TypeString, value) } - if biuo.mutation.MetadataCleared() { - _spec.ClearField(billinginvoice.FieldMetadata, field.TypeJSON) + if biuo.mutation.SupplierAddressCountryCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressCountry, field.TypeString) + } + if value, ok := biuo.mutation.SupplierAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPostalCode, field.TypeString, value) + } + if biuo.mutation.SupplierAddressPostalCodeCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressPostalCode, field.TypeString) + } + if value, ok := biuo.mutation.SupplierAddressState(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressState, field.TypeString, value) + } + if biuo.mutation.SupplierAddressStateCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressState, field.TypeString) + } + if value, ok := biuo.mutation.SupplierAddressCity(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressCity, field.TypeString, value) + } + if biuo.mutation.SupplierAddressCityCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressCity, field.TypeString) } - if value, ok := biuo.mutation.Series(); ok { - _spec.SetField(billinginvoice.FieldSeries, field.TypeString, value) + if value, ok := biuo.mutation.SupplierAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine1, field.TypeString, value) } - if biuo.mutation.SeriesCleared() { - _spec.ClearField(billinginvoice.FieldSeries, field.TypeString) + if biuo.mutation.SupplierAddressLine1Cleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressLine1, field.TypeString) } - if value, ok := biuo.mutation.Code(); ok { - _spec.SetField(billinginvoice.FieldCode, field.TypeString, value) + if value, ok := biuo.mutation.SupplierAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressLine2, field.TypeString, value) } - if biuo.mutation.CodeCleared() { - _spec.ClearField(billinginvoice.FieldCode, field.TypeString) + if biuo.mutation.SupplierAddressLine2Cleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressLine2, field.TypeString) + } + if value, ok := biuo.mutation.SupplierAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldSupplierAddressPhoneNumber, field.TypeString, value) + } + if biuo.mutation.SupplierAddressPhoneNumberCleared() { + _spec.ClearField(billinginvoice.FieldSupplierAddressPhoneNumber, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressCountry(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCountry, field.TypeString, value) + } + if biuo.mutation.CustomerAddressCountryCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressCountry, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressPostalCode(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPostalCode, field.TypeString, value) + } + if biuo.mutation.CustomerAddressPostalCodeCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressPostalCode, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressState(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressState, field.TypeString, value) + } + if biuo.mutation.CustomerAddressStateCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressState, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressCity(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressCity, field.TypeString, value) + } + if biuo.mutation.CustomerAddressCityCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressCity, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressLine1(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine1, field.TypeString, value) + } + if biuo.mutation.CustomerAddressLine1Cleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressLine1, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressLine2(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressLine2, field.TypeString, value) + } + if biuo.mutation.CustomerAddressLine2Cleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressLine2, field.TypeString) + } + if value, ok := biuo.mutation.CustomerAddressPhoneNumber(); ok { + _spec.SetField(billinginvoice.FieldCustomerAddressPhoneNumber, field.TypeString, value) + } + if biuo.mutation.CustomerAddressPhoneNumberCleared() { + _spec.ClearField(billinginvoice.FieldCustomerAddressPhoneNumber, field.TypeString) + } + if value, ok := biuo.mutation.SupplierName(); ok { + _spec.SetField(billinginvoice.FieldSupplierName, field.TypeString, value) + } + if value, ok := biuo.mutation.SupplierTaxCode(); ok { + _spec.SetField(billinginvoice.FieldSupplierTaxCode, field.TypeString, value) + } + if biuo.mutation.SupplierTaxCodeCleared() { + _spec.ClearField(billinginvoice.FieldSupplierTaxCode, field.TypeString) + } + if value, ok := biuo.mutation.CustomerName(); ok { + _spec.SetField(billinginvoice.FieldCustomerName, field.TypeString, value) + } + if value, ok := biuo.mutation.CustomerTimezone(); ok { + _spec.SetField(billinginvoice.FieldCustomerTimezone, field.TypeString, value) + } + if biuo.mutation.CustomerTimezoneCleared() { + _spec.ClearField(billinginvoice.FieldCustomerTimezone, field.TypeString) + } + if value, ok := biuo.mutation.Number(); ok { + _spec.SetField(billinginvoice.FieldNumber, field.TypeString, value) + } + if biuo.mutation.NumberCleared() { + _spec.ClearField(billinginvoice.FieldNumber, field.TypeString) + } + if value, ok := biuo.mutation.GetType(); ok { + _spec.SetField(billinginvoice.FieldType, field.TypeEnum, value) + } + if value, ok := biuo.mutation.Description(); ok { + _spec.SetField(billinginvoice.FieldDescription, field.TypeString, value) + } + if biuo.mutation.DescriptionCleared() { + _spec.ClearField(billinginvoice.FieldDescription, field.TypeString) } if value, ok := biuo.mutation.VoidedAt(); ok { _spec.SetField(billinginvoice.FieldVoidedAt, field.TypeTime, value) @@ -813,8 +1924,17 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin if biuo.mutation.VoidedAtCleared() { _spec.ClearField(billinginvoice.FieldVoidedAt, field.TypeTime) } - if value, ok := biuo.mutation.DueDate(); ok { - _spec.SetField(billinginvoice.FieldDueDate, field.TypeTime, value) + if value, ok := biuo.mutation.IssuedAt(); ok { + _spec.SetField(billinginvoice.FieldIssuedAt, field.TypeTime, value) + } + if biuo.mutation.IssuedAtCleared() { + _spec.ClearField(billinginvoice.FieldIssuedAt, field.TypeTime) + } + if value, ok := biuo.mutation.DueAt(); ok { + _spec.SetField(billinginvoice.FieldDueAt, field.TypeTime, value) + } + if biuo.mutation.DueAtCleared() { + _spec.ClearField(billinginvoice.FieldDueAt, field.TypeTime) } if value, ok := biuo.mutation.Status(); ok { _spec.SetField(billinginvoice.FieldStatus, field.TypeEnum, value) @@ -822,9 +1942,15 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin if value, ok := biuo.mutation.PeriodStart(); ok { _spec.SetField(billinginvoice.FieldPeriodStart, field.TypeTime, value) } + if biuo.mutation.PeriodStartCleared() { + _spec.ClearField(billinginvoice.FieldPeriodStart, field.TypeTime) + } if value, ok := biuo.mutation.PeriodEnd(); ok { _spec.SetField(billinginvoice.FieldPeriodEnd, field.TypeTime, value) } + if biuo.mutation.PeriodEndCleared() { + _spec.ClearField(billinginvoice.FieldPeriodEnd, field.TypeTime) + } if biuo.mutation.BillingWorkflowConfigCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2O, @@ -854,28 +1980,28 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin } _spec.Edges.Add = append(_spec.Edges.Add, edge) } - if biuo.mutation.BillingInvoiceItemsCleared() { + if biuo.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := biuo.mutation.RemovedBillingInvoiceItemsIDs(); len(nodes) > 0 && !biuo.mutation.BillingInvoiceItemsCleared() { + if nodes := biuo.mutation.RemovedBillingInvoiceLinesIDs(); len(nodes) > 0 && !biuo.mutation.BillingInvoiceLinesCleared() { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { @@ -883,15 +2009,15 @@ func (biuo *BillingInvoiceUpdateOne) sqlSave(ctx context.Context) (_node *Billin } _spec.Edges.Clear = append(_spec.Edges.Clear, edge) } - if nodes := biuo.mutation.BillingInvoiceItemsIDs(); len(nodes) > 0 { + if nodes := biuo.mutation.BillingInvoiceLinesIDs(); len(nodes) > 0 { edge := &sqlgraph.EdgeSpec{ Rel: sqlgraph.O2M, Inverse: false, - Table: billinginvoice.BillingInvoiceItemsTable, - Columns: []string{billinginvoice.BillingInvoiceItemsColumn}, + Table: billinginvoice.BillingInvoiceLinesTable, + Columns: []string{billinginvoice.BillingInvoiceLinesColumn}, Bidi: false, Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString), + IDSpec: sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString), }, } for _, k := range nodes { diff --git a/openmeter/ent/db/billinginvoiceitem/where.go b/openmeter/ent/db/billinginvoiceitem/where.go deleted file mode 100644 index ad29d92bb..000000000 --- a/openmeter/ent/db/billinginvoiceitem/where.go +++ /dev/null @@ -1,907 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package billinginvoiceitem - -import ( - "time" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "github.com/alpacahq/alpacadecimal" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" - "github.com/openmeterio/openmeter/pkg/currencyx" -) - -// ID filters vertices based on their ID field. -func ID(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldID, id)) -} - -// IDEQ applies the EQ predicate on the ID field. -func IDEQ(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldID, id)) -} - -// IDNEQ applies the NEQ predicate on the ID field. -func IDNEQ(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldID, id)) -} - -// IDIn applies the In predicate on the ID field. -func IDIn(ids ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldID, ids...)) -} - -// IDNotIn applies the NotIn predicate on the ID field. -func IDNotIn(ids ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldID, ids...)) -} - -// IDGT applies the GT predicate on the ID field. -func IDGT(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldID, id)) -} - -// IDGTE applies the GTE predicate on the ID field. -func IDGTE(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldID, id)) -} - -// IDLT applies the LT predicate on the ID field. -func IDLT(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldID, id)) -} - -// IDLTE applies the LTE predicate on the ID field. -func IDLTE(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldID, id)) -} - -// IDEqualFold applies the EqualFold predicate on the ID field. -func IDEqualFold(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldID, id)) -} - -// IDContainsFold applies the ContainsFold predicate on the ID field. -func IDContainsFold(id string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldID, id)) -} - -// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. -func Namespace(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldNamespace, v)) -} - -// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. -func CreatedAt(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCreatedAt, v)) -} - -// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ. -func UpdatedAt(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldUpdatedAt, v)) -} - -// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ. -func DeletedAt(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldDeletedAt, v)) -} - -// InvoiceID applies equality check predicate on the "invoice_id" field. It's identical to InvoiceIDEQ. -func InvoiceID(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldInvoiceID, v)) -} - -// CustomerID applies equality check predicate on the "customer_id" field. It's identical to CustomerIDEQ. -func CustomerID(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCustomerID, v)) -} - -// PeriodStart applies equality check predicate on the "period_start" field. It's identical to PeriodStartEQ. -func PeriodStart(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldPeriodStart, v)) -} - -// PeriodEnd applies equality check predicate on the "period_end" field. It's identical to PeriodEndEQ. -func PeriodEnd(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldPeriodEnd, v)) -} - -// InvoiceAt applies equality check predicate on the "invoice_at" field. It's identical to InvoiceAtEQ. -func InvoiceAt(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldInvoiceAt, v)) -} - -// Name applies equality check predicate on the "name" field. It's identical to NameEQ. -func Name(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldName, v)) -} - -// Quantity applies equality check predicate on the "quantity" field. It's identical to QuantityEQ. -func Quantity(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldQuantity, v)) -} - -// UnitPrice applies equality check predicate on the "unit_price" field. It's identical to UnitPriceEQ. -func UnitPrice(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldUnitPrice, v)) -} - -// Currency applies equality check predicate on the "currency" field. It's identical to CurrencyEQ. -func Currency(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCurrency, vc)) -} - -// NamespaceEQ applies the EQ predicate on the "namespace" field. -func NamespaceEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldNamespace, v)) -} - -// NamespaceNEQ applies the NEQ predicate on the "namespace" field. -func NamespaceNEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldNamespace, v)) -} - -// NamespaceIn applies the In predicate on the "namespace" field. -func NamespaceIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldNamespace, vs...)) -} - -// NamespaceNotIn applies the NotIn predicate on the "namespace" field. -func NamespaceNotIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldNamespace, vs...)) -} - -// NamespaceGT applies the GT predicate on the "namespace" field. -func NamespaceGT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldNamespace, v)) -} - -// NamespaceGTE applies the GTE predicate on the "namespace" field. -func NamespaceGTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldNamespace, v)) -} - -// NamespaceLT applies the LT predicate on the "namespace" field. -func NamespaceLT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldNamespace, v)) -} - -// NamespaceLTE applies the LTE predicate on the "namespace" field. -func NamespaceLTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldNamespace, v)) -} - -// NamespaceContains applies the Contains predicate on the "namespace" field. -func NamespaceContains(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContains(FieldNamespace, v)) -} - -// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. -func NamespaceHasPrefix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasPrefix(FieldNamespace, v)) -} - -// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. -func NamespaceHasSuffix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasSuffix(FieldNamespace, v)) -} - -// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. -func NamespaceEqualFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldNamespace, v)) -} - -// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. -func NamespaceContainsFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldNamespace, v)) -} - -// CreatedAtEQ applies the EQ predicate on the "created_at" field. -func CreatedAtEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCreatedAt, v)) -} - -// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. -func CreatedAtNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldCreatedAt, v)) -} - -// CreatedAtIn applies the In predicate on the "created_at" field. -func CreatedAtIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldCreatedAt, vs...)) -} - -// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. -func CreatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldCreatedAt, vs...)) -} - -// CreatedAtGT applies the GT predicate on the "created_at" field. -func CreatedAtGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldCreatedAt, v)) -} - -// CreatedAtGTE applies the GTE predicate on the "created_at" field. -func CreatedAtGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldCreatedAt, v)) -} - -// CreatedAtLT applies the LT predicate on the "created_at" field. -func CreatedAtLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldCreatedAt, v)) -} - -// CreatedAtLTE applies the LTE predicate on the "created_at" field. -func CreatedAtLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldCreatedAt, v)) -} - -// UpdatedAtEQ applies the EQ predicate on the "updated_at" field. -func UpdatedAtEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldUpdatedAt, v)) -} - -// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field. -func UpdatedAtNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldUpdatedAt, v)) -} - -// UpdatedAtIn applies the In predicate on the "updated_at" field. -func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldUpdatedAt, vs...)) -} - -// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. -func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldUpdatedAt, vs...)) -} - -// UpdatedAtGT applies the GT predicate on the "updated_at" field. -func UpdatedAtGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldUpdatedAt, v)) -} - -// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. -func UpdatedAtGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldUpdatedAt, v)) -} - -// UpdatedAtLT applies the LT predicate on the "updated_at" field. -func UpdatedAtLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldUpdatedAt, v)) -} - -// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. -func UpdatedAtLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldUpdatedAt, v)) -} - -// DeletedAtEQ applies the EQ predicate on the "deleted_at" field. -func DeletedAtEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldDeletedAt, v)) -} - -// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field. -func DeletedAtNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldDeletedAt, v)) -} - -// DeletedAtIn applies the In predicate on the "deleted_at" field. -func DeletedAtIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldDeletedAt, vs...)) -} - -// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field. -func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldDeletedAt, vs...)) -} - -// DeletedAtGT applies the GT predicate on the "deleted_at" field. -func DeletedAtGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldDeletedAt, v)) -} - -// DeletedAtGTE applies the GTE predicate on the "deleted_at" field. -func DeletedAtGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldDeletedAt, v)) -} - -// DeletedAtLT applies the LT predicate on the "deleted_at" field. -func DeletedAtLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldDeletedAt, v)) -} - -// DeletedAtLTE applies the LTE predicate on the "deleted_at" field. -func DeletedAtLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldDeletedAt, v)) -} - -// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field. -func DeletedAtIsNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIsNull(FieldDeletedAt)) -} - -// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field. -func DeletedAtNotNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotNull(FieldDeletedAt)) -} - -// MetadataIsNil applies the IsNil predicate on the "metadata" field. -func MetadataIsNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIsNull(FieldMetadata)) -} - -// MetadataNotNil applies the NotNil predicate on the "metadata" field. -func MetadataNotNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotNull(FieldMetadata)) -} - -// InvoiceIDEQ applies the EQ predicate on the "invoice_id" field. -func InvoiceIDEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldInvoiceID, v)) -} - -// InvoiceIDNEQ applies the NEQ predicate on the "invoice_id" field. -func InvoiceIDNEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldInvoiceID, v)) -} - -// InvoiceIDIn applies the In predicate on the "invoice_id" field. -func InvoiceIDIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldInvoiceID, vs...)) -} - -// InvoiceIDNotIn applies the NotIn predicate on the "invoice_id" field. -func InvoiceIDNotIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldInvoiceID, vs...)) -} - -// InvoiceIDGT applies the GT predicate on the "invoice_id" field. -func InvoiceIDGT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldInvoiceID, v)) -} - -// InvoiceIDGTE applies the GTE predicate on the "invoice_id" field. -func InvoiceIDGTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldInvoiceID, v)) -} - -// InvoiceIDLT applies the LT predicate on the "invoice_id" field. -func InvoiceIDLT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldInvoiceID, v)) -} - -// InvoiceIDLTE applies the LTE predicate on the "invoice_id" field. -func InvoiceIDLTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldInvoiceID, v)) -} - -// InvoiceIDContains applies the Contains predicate on the "invoice_id" field. -func InvoiceIDContains(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContains(FieldInvoiceID, v)) -} - -// InvoiceIDHasPrefix applies the HasPrefix predicate on the "invoice_id" field. -func InvoiceIDHasPrefix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasPrefix(FieldInvoiceID, v)) -} - -// InvoiceIDHasSuffix applies the HasSuffix predicate on the "invoice_id" field. -func InvoiceIDHasSuffix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasSuffix(FieldInvoiceID, v)) -} - -// InvoiceIDIsNil applies the IsNil predicate on the "invoice_id" field. -func InvoiceIDIsNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIsNull(FieldInvoiceID)) -} - -// InvoiceIDNotNil applies the NotNil predicate on the "invoice_id" field. -func InvoiceIDNotNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotNull(FieldInvoiceID)) -} - -// InvoiceIDEqualFold applies the EqualFold predicate on the "invoice_id" field. -func InvoiceIDEqualFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldInvoiceID, v)) -} - -// InvoiceIDContainsFold applies the ContainsFold predicate on the "invoice_id" field. -func InvoiceIDContainsFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldInvoiceID, v)) -} - -// CustomerIDEQ applies the EQ predicate on the "customer_id" field. -func CustomerIDEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCustomerID, v)) -} - -// CustomerIDNEQ applies the NEQ predicate on the "customer_id" field. -func CustomerIDNEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldCustomerID, v)) -} - -// CustomerIDIn applies the In predicate on the "customer_id" field. -func CustomerIDIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldCustomerID, vs...)) -} - -// CustomerIDNotIn applies the NotIn predicate on the "customer_id" field. -func CustomerIDNotIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldCustomerID, vs...)) -} - -// CustomerIDGT applies the GT predicate on the "customer_id" field. -func CustomerIDGT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldCustomerID, v)) -} - -// CustomerIDGTE applies the GTE predicate on the "customer_id" field. -func CustomerIDGTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldCustomerID, v)) -} - -// CustomerIDLT applies the LT predicate on the "customer_id" field. -func CustomerIDLT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldCustomerID, v)) -} - -// CustomerIDLTE applies the LTE predicate on the "customer_id" field. -func CustomerIDLTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldCustomerID, v)) -} - -// CustomerIDContains applies the Contains predicate on the "customer_id" field. -func CustomerIDContains(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContains(FieldCustomerID, v)) -} - -// CustomerIDHasPrefix applies the HasPrefix predicate on the "customer_id" field. -func CustomerIDHasPrefix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasPrefix(FieldCustomerID, v)) -} - -// CustomerIDHasSuffix applies the HasSuffix predicate on the "customer_id" field. -func CustomerIDHasSuffix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasSuffix(FieldCustomerID, v)) -} - -// CustomerIDEqualFold applies the EqualFold predicate on the "customer_id" field. -func CustomerIDEqualFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldCustomerID, v)) -} - -// CustomerIDContainsFold applies the ContainsFold predicate on the "customer_id" field. -func CustomerIDContainsFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldCustomerID, v)) -} - -// PeriodStartEQ applies the EQ predicate on the "period_start" field. -func PeriodStartEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldPeriodStart, v)) -} - -// PeriodStartNEQ applies the NEQ predicate on the "period_start" field. -func PeriodStartNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldPeriodStart, v)) -} - -// PeriodStartIn applies the In predicate on the "period_start" field. -func PeriodStartIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldPeriodStart, vs...)) -} - -// PeriodStartNotIn applies the NotIn predicate on the "period_start" field. -func PeriodStartNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldPeriodStart, vs...)) -} - -// PeriodStartGT applies the GT predicate on the "period_start" field. -func PeriodStartGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldPeriodStart, v)) -} - -// PeriodStartGTE applies the GTE predicate on the "period_start" field. -func PeriodStartGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldPeriodStart, v)) -} - -// PeriodStartLT applies the LT predicate on the "period_start" field. -func PeriodStartLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldPeriodStart, v)) -} - -// PeriodStartLTE applies the LTE predicate on the "period_start" field. -func PeriodStartLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldPeriodStart, v)) -} - -// PeriodEndEQ applies the EQ predicate on the "period_end" field. -func PeriodEndEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldPeriodEnd, v)) -} - -// PeriodEndNEQ applies the NEQ predicate on the "period_end" field. -func PeriodEndNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldPeriodEnd, v)) -} - -// PeriodEndIn applies the In predicate on the "period_end" field. -func PeriodEndIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldPeriodEnd, vs...)) -} - -// PeriodEndNotIn applies the NotIn predicate on the "period_end" field. -func PeriodEndNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldPeriodEnd, vs...)) -} - -// PeriodEndGT applies the GT predicate on the "period_end" field. -func PeriodEndGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldPeriodEnd, v)) -} - -// PeriodEndGTE applies the GTE predicate on the "period_end" field. -func PeriodEndGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldPeriodEnd, v)) -} - -// PeriodEndLT applies the LT predicate on the "period_end" field. -func PeriodEndLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldPeriodEnd, v)) -} - -// PeriodEndLTE applies the LTE predicate on the "period_end" field. -func PeriodEndLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldPeriodEnd, v)) -} - -// InvoiceAtEQ applies the EQ predicate on the "invoice_at" field. -func InvoiceAtEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldInvoiceAt, v)) -} - -// InvoiceAtNEQ applies the NEQ predicate on the "invoice_at" field. -func InvoiceAtNEQ(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldInvoiceAt, v)) -} - -// InvoiceAtIn applies the In predicate on the "invoice_at" field. -func InvoiceAtIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldInvoiceAt, vs...)) -} - -// InvoiceAtNotIn applies the NotIn predicate on the "invoice_at" field. -func InvoiceAtNotIn(vs ...time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldInvoiceAt, vs...)) -} - -// InvoiceAtGT applies the GT predicate on the "invoice_at" field. -func InvoiceAtGT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldInvoiceAt, v)) -} - -// InvoiceAtGTE applies the GTE predicate on the "invoice_at" field. -func InvoiceAtGTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldInvoiceAt, v)) -} - -// InvoiceAtLT applies the LT predicate on the "invoice_at" field. -func InvoiceAtLT(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldInvoiceAt, v)) -} - -// InvoiceAtLTE applies the LTE predicate on the "invoice_at" field. -func InvoiceAtLTE(v time.Time) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldInvoiceAt, v)) -} - -// TypeEQ applies the EQ predicate on the "type" field. -func TypeEQ(v billingentity.InvoiceItemType) predicate.BillingInvoiceItem { - vc := v - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldType, vc)) -} - -// TypeNEQ applies the NEQ predicate on the "type" field. -func TypeNEQ(v billingentity.InvoiceItemType) predicate.BillingInvoiceItem { - vc := v - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldType, vc)) -} - -// TypeIn applies the In predicate on the "type" field. -func TypeIn(vs ...billingentity.InvoiceItemType) predicate.BillingInvoiceItem { - v := make([]any, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.BillingInvoiceItem(sql.FieldIn(FieldType, v...)) -} - -// TypeNotIn applies the NotIn predicate on the "type" field. -func TypeNotIn(vs ...billingentity.InvoiceItemType) predicate.BillingInvoiceItem { - v := make([]any, len(vs)) - for i := range v { - v[i] = vs[i] - } - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldType, v...)) -} - -// NameEQ applies the EQ predicate on the "name" field. -func NameEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldName, v)) -} - -// NameNEQ applies the NEQ predicate on the "name" field. -func NameNEQ(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldName, v)) -} - -// NameIn applies the In predicate on the "name" field. -func NameIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldName, vs...)) -} - -// NameNotIn applies the NotIn predicate on the "name" field. -func NameNotIn(vs ...string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldName, vs...)) -} - -// NameGT applies the GT predicate on the "name" field. -func NameGT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldName, v)) -} - -// NameGTE applies the GTE predicate on the "name" field. -func NameGTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldName, v)) -} - -// NameLT applies the LT predicate on the "name" field. -func NameLT(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldName, v)) -} - -// NameLTE applies the LTE predicate on the "name" field. -func NameLTE(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldName, v)) -} - -// NameContains applies the Contains predicate on the "name" field. -func NameContains(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContains(FieldName, v)) -} - -// NameHasPrefix applies the HasPrefix predicate on the "name" field. -func NameHasPrefix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasPrefix(FieldName, v)) -} - -// NameHasSuffix applies the HasSuffix predicate on the "name" field. -func NameHasSuffix(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldHasSuffix(FieldName, v)) -} - -// NameEqualFold applies the EqualFold predicate on the "name" field. -func NameEqualFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldName, v)) -} - -// NameContainsFold applies the ContainsFold predicate on the "name" field. -func NameContainsFold(v string) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldName, v)) -} - -// QuantityEQ applies the EQ predicate on the "quantity" field. -func QuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldQuantity, v)) -} - -// QuantityNEQ applies the NEQ predicate on the "quantity" field. -func QuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldQuantity, v)) -} - -// QuantityIn applies the In predicate on the "quantity" field. -func QuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldQuantity, vs...)) -} - -// QuantityNotIn applies the NotIn predicate on the "quantity" field. -func QuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldQuantity, vs...)) -} - -// QuantityGT applies the GT predicate on the "quantity" field. -func QuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldQuantity, v)) -} - -// QuantityGTE applies the GTE predicate on the "quantity" field. -func QuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldQuantity, v)) -} - -// QuantityLT applies the LT predicate on the "quantity" field. -func QuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldQuantity, v)) -} - -// QuantityLTE applies the LTE predicate on the "quantity" field. -func QuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldQuantity, v)) -} - -// QuantityIsNil applies the IsNil predicate on the "quantity" field. -func QuantityIsNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIsNull(FieldQuantity)) -} - -// QuantityNotNil applies the NotNil predicate on the "quantity" field. -func QuantityNotNil() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotNull(FieldQuantity)) -} - -// UnitPriceEQ applies the EQ predicate on the "unit_price" field. -func UnitPriceEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldUnitPrice, v)) -} - -// UnitPriceNEQ applies the NEQ predicate on the "unit_price" field. -func UnitPriceNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldUnitPrice, v)) -} - -// UnitPriceIn applies the In predicate on the "unit_price" field. -func UnitPriceIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldIn(FieldUnitPrice, vs...)) -} - -// UnitPriceNotIn applies the NotIn predicate on the "unit_price" field. -func UnitPriceNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldUnitPrice, vs...)) -} - -// UnitPriceGT applies the GT predicate on the "unit_price" field. -func UnitPriceGT(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGT(FieldUnitPrice, v)) -} - -// UnitPriceGTE applies the GTE predicate on the "unit_price" field. -func UnitPriceGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldUnitPrice, v)) -} - -// UnitPriceLT applies the LT predicate on the "unit_price" field. -func UnitPriceLT(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLT(FieldUnitPrice, v)) -} - -// UnitPriceLTE applies the LTE predicate on the "unit_price" field. -func UnitPriceLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldUnitPrice, v)) -} - -// CurrencyEQ applies the EQ predicate on the "currency" field. -func CurrencyEQ(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldEQ(FieldCurrency, vc)) -} - -// CurrencyNEQ applies the NEQ predicate on the "currency" field. -func CurrencyNEQ(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldNEQ(FieldCurrency, vc)) -} - -// CurrencyIn applies the In predicate on the "currency" field. -func CurrencyIn(vs ...currencyx.Code) predicate.BillingInvoiceItem { - v := make([]any, len(vs)) - for i := range v { - v[i] = string(vs[i]) - } - return predicate.BillingInvoiceItem(sql.FieldIn(FieldCurrency, v...)) -} - -// CurrencyNotIn applies the NotIn predicate on the "currency" field. -func CurrencyNotIn(vs ...currencyx.Code) predicate.BillingInvoiceItem { - v := make([]any, len(vs)) - for i := range v { - v[i] = string(vs[i]) - } - return predicate.BillingInvoiceItem(sql.FieldNotIn(FieldCurrency, v...)) -} - -// CurrencyGT applies the GT predicate on the "currency" field. -func CurrencyGT(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldGT(FieldCurrency, vc)) -} - -// CurrencyGTE applies the GTE predicate on the "currency" field. -func CurrencyGTE(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldGTE(FieldCurrency, vc)) -} - -// CurrencyLT applies the LT predicate on the "currency" field. -func CurrencyLT(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldLT(FieldCurrency, vc)) -} - -// CurrencyLTE applies the LTE predicate on the "currency" field. -func CurrencyLTE(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldLTE(FieldCurrency, vc)) -} - -// CurrencyContains applies the Contains predicate on the "currency" field. -func CurrencyContains(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldContains(FieldCurrency, vc)) -} - -// CurrencyHasPrefix applies the HasPrefix predicate on the "currency" field. -func CurrencyHasPrefix(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldHasPrefix(FieldCurrency, vc)) -} - -// CurrencyHasSuffix applies the HasSuffix predicate on the "currency" field. -func CurrencyHasSuffix(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldHasSuffix(FieldCurrency, vc)) -} - -// CurrencyEqualFold applies the EqualFold predicate on the "currency" field. -func CurrencyEqualFold(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldEqualFold(FieldCurrency, vc)) -} - -// CurrencyContainsFold applies the ContainsFold predicate on the "currency" field. -func CurrencyContainsFold(v currencyx.Code) predicate.BillingInvoiceItem { - vc := string(v) - return predicate.BillingInvoiceItem(sql.FieldContainsFold(FieldCurrency, vc)) -} - -// HasBillingInvoice applies the HasEdge predicate on the "billing_invoice" edge. -func HasBillingInvoice() predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(func(s *sql.Selector) { - step := sqlgraph.NewStep( - sqlgraph.From(Table, FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn), - ) - sqlgraph.HasNeighbors(s, step) - }) -} - -// HasBillingInvoiceWith applies the HasEdge predicate on the "billing_invoice" edge with a given conditions (other predicates). -func HasBillingInvoiceWith(preds ...predicate.BillingInvoice) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(func(s *sql.Selector) { - step := newBillingInvoiceStep() - sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { - for _, p := range preds { - p(s) - } - }) - }) -} - -// And groups predicates with the AND operator between them. -func And(predicates ...predicate.BillingInvoiceItem) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.AndPredicates(predicates...)) -} - -// Or groups predicates with the OR operator between them. -func Or(predicates ...predicate.BillingInvoiceItem) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.OrPredicates(predicates...)) -} - -// Not applies the not operator on the given predicate. -func Not(p predicate.BillingInvoiceItem) predicate.BillingInvoiceItem { - return predicate.BillingInvoiceItem(sql.NotPredicates(p)) -} diff --git a/openmeter/ent/db/billinginvoiceitem_create.go b/openmeter/ent/db/billinginvoiceitem_create.go deleted file mode 100644 index 75c853289..000000000 --- a/openmeter/ent/db/billinginvoiceitem_create.go +++ /dev/null @@ -1,1344 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package db - -import ( - "context" - "errors" - "fmt" - "time" - - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/alpacahq/alpacadecimal" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" - "github.com/openmeterio/openmeter/pkg/currencyx" -) - -// BillingInvoiceItemCreate is the builder for creating a BillingInvoiceItem entity. -type BillingInvoiceItemCreate struct { - config - mutation *BillingInvoiceItemMutation - hooks []Hook - conflict []sql.ConflictOption -} - -// SetNamespace sets the "namespace" field. -func (biic *BillingInvoiceItemCreate) SetNamespace(s string) *BillingInvoiceItemCreate { - biic.mutation.SetNamespace(s) - return biic -} - -// SetCreatedAt sets the "created_at" field. -func (biic *BillingInvoiceItemCreate) SetCreatedAt(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetCreatedAt(t) - return biic -} - -// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableCreatedAt(t *time.Time) *BillingInvoiceItemCreate { - if t != nil { - biic.SetCreatedAt(*t) - } - return biic -} - -// SetUpdatedAt sets the "updated_at" field. -func (biic *BillingInvoiceItemCreate) SetUpdatedAt(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetUpdatedAt(t) - return biic -} - -// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableUpdatedAt(t *time.Time) *BillingInvoiceItemCreate { - if t != nil { - biic.SetUpdatedAt(*t) - } - return biic -} - -// SetDeletedAt sets the "deleted_at" field. -func (biic *BillingInvoiceItemCreate) SetDeletedAt(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetDeletedAt(t) - return biic -} - -// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableDeletedAt(t *time.Time) *BillingInvoiceItemCreate { - if t != nil { - biic.SetDeletedAt(*t) - } - return biic -} - -// SetMetadata sets the "metadata" field. -func (biic *BillingInvoiceItemCreate) SetMetadata(m map[string]string) *BillingInvoiceItemCreate { - biic.mutation.SetMetadata(m) - return biic -} - -// SetInvoiceID sets the "invoice_id" field. -func (biic *BillingInvoiceItemCreate) SetInvoiceID(s string) *BillingInvoiceItemCreate { - biic.mutation.SetInvoiceID(s) - return biic -} - -// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableInvoiceID(s *string) *BillingInvoiceItemCreate { - if s != nil { - biic.SetInvoiceID(*s) - } - return biic -} - -// SetCustomerID sets the "customer_id" field. -func (biic *BillingInvoiceItemCreate) SetCustomerID(s string) *BillingInvoiceItemCreate { - biic.mutation.SetCustomerID(s) - return biic -} - -// SetPeriodStart sets the "period_start" field. -func (biic *BillingInvoiceItemCreate) SetPeriodStart(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetPeriodStart(t) - return biic -} - -// SetPeriodEnd sets the "period_end" field. -func (biic *BillingInvoiceItemCreate) SetPeriodEnd(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetPeriodEnd(t) - return biic -} - -// SetInvoiceAt sets the "invoice_at" field. -func (biic *BillingInvoiceItemCreate) SetInvoiceAt(t time.Time) *BillingInvoiceItemCreate { - biic.mutation.SetInvoiceAt(t) - return biic -} - -// SetType sets the "type" field. -func (biic *BillingInvoiceItemCreate) SetType(bit billingentity.InvoiceItemType) *BillingInvoiceItemCreate { - biic.mutation.SetType(bit) - return biic -} - -// SetName sets the "name" field. -func (biic *BillingInvoiceItemCreate) SetName(s string) *BillingInvoiceItemCreate { - biic.mutation.SetName(s) - return biic -} - -// SetQuantity sets the "quantity" field. -func (biic *BillingInvoiceItemCreate) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceItemCreate { - biic.mutation.SetQuantity(a) - return biic -} - -// SetNillableQuantity sets the "quantity" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceItemCreate { - if a != nil { - biic.SetQuantity(*a) - } - return biic -} - -// SetUnitPrice sets the "unit_price" field. -func (biic *BillingInvoiceItemCreate) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceItemCreate { - biic.mutation.SetUnitPrice(a) - return biic -} - -// SetCurrency sets the "currency" field. -func (biic *BillingInvoiceItemCreate) SetCurrency(c currencyx.Code) *BillingInvoiceItemCreate { - biic.mutation.SetCurrency(c) - return biic -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (biic *BillingInvoiceItemCreate) SetTaxCodeOverride(bo billingentity.TaxOverrides) *BillingInvoiceItemCreate { - biic.mutation.SetTaxCodeOverride(bo) - return biic -} - -// SetID sets the "id" field. -func (biic *BillingInvoiceItemCreate) SetID(s string) *BillingInvoiceItemCreate { - biic.mutation.SetID(s) - return biic -} - -// SetNillableID sets the "id" field if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableID(s *string) *BillingInvoiceItemCreate { - if s != nil { - biic.SetID(*s) - } - return biic -} - -// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. -func (biic *BillingInvoiceItemCreate) SetBillingInvoiceID(id string) *BillingInvoiceItemCreate { - biic.mutation.SetBillingInvoiceID(id) - return biic -} - -// SetNillableBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID if the given value is not nil. -func (biic *BillingInvoiceItemCreate) SetNillableBillingInvoiceID(id *string) *BillingInvoiceItemCreate { - if id != nil { - biic = biic.SetBillingInvoiceID(*id) - } - return biic -} - -// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. -func (biic *BillingInvoiceItemCreate) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceItemCreate { - return biic.SetBillingInvoiceID(b.ID) -} - -// Mutation returns the BillingInvoiceItemMutation object of the builder. -func (biic *BillingInvoiceItemCreate) Mutation() *BillingInvoiceItemMutation { - return biic.mutation -} - -// Save creates the BillingInvoiceItem in the database. -func (biic *BillingInvoiceItemCreate) Save(ctx context.Context) (*BillingInvoiceItem, error) { - biic.defaults() - return withHooks(ctx, biic.sqlSave, biic.mutation, biic.hooks) -} - -// SaveX calls Save and panics if Save returns an error. -func (biic *BillingInvoiceItemCreate) SaveX(ctx context.Context) *BillingInvoiceItem { - v, err := biic.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (biic *BillingInvoiceItemCreate) Exec(ctx context.Context) error { - _, err := biic.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (biic *BillingInvoiceItemCreate) ExecX(ctx context.Context) { - if err := biic.Exec(ctx); err != nil { - panic(err) - } -} - -// defaults sets the default values of the builder before save. -func (biic *BillingInvoiceItemCreate) defaults() { - if _, ok := biic.mutation.CreatedAt(); !ok { - v := billinginvoiceitem.DefaultCreatedAt() - biic.mutation.SetCreatedAt(v) - } - if _, ok := biic.mutation.UpdatedAt(); !ok { - v := billinginvoiceitem.DefaultUpdatedAt() - biic.mutation.SetUpdatedAt(v) - } - if _, ok := biic.mutation.ID(); !ok { - v := billinginvoiceitem.DefaultID() - biic.mutation.SetID(v) - } -} - -// check runs all checks and user-defined validators on the builder. -func (biic *BillingInvoiceItemCreate) check() error { - if _, ok := biic.mutation.Namespace(); !ok { - return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceItem.namespace"`)} - } - if v, ok := biic.mutation.Namespace(); ok { - if err := billinginvoiceitem.NamespaceValidator(v); err != nil { - return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.namespace": %w`, err)} - } - } - if _, ok := biic.mutation.CreatedAt(); !ok { - return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceItem.created_at"`)} - } - if _, ok := biic.mutation.UpdatedAt(); !ok { - return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceItem.updated_at"`)} - } - if _, ok := biic.mutation.CustomerID(); !ok { - return &ValidationError{Name: "customer_id", err: errors.New(`db: missing required field "BillingInvoiceItem.customer_id"`)} - } - if v, ok := biic.mutation.CustomerID(); ok { - if err := billinginvoiceitem.CustomerIDValidator(v); err != nil { - return &ValidationError{Name: "customer_id", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.customer_id": %w`, err)} - } - } - if _, ok := biic.mutation.PeriodStart(); !ok { - return &ValidationError{Name: "period_start", err: errors.New(`db: missing required field "BillingInvoiceItem.period_start"`)} - } - if _, ok := biic.mutation.PeriodEnd(); !ok { - return &ValidationError{Name: "period_end", err: errors.New(`db: missing required field "BillingInvoiceItem.period_end"`)} - } - if _, ok := biic.mutation.InvoiceAt(); !ok { - return &ValidationError{Name: "invoice_at", err: errors.New(`db: missing required field "BillingInvoiceItem.invoice_at"`)} - } - if _, ok := biic.mutation.GetType(); !ok { - return &ValidationError{Name: "type", err: errors.New(`db: missing required field "BillingInvoiceItem.type"`)} - } - if v, ok := biic.mutation.GetType(); ok { - if err := billinginvoiceitem.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.type": %w`, err)} - } - } - if _, ok := biic.mutation.Name(); !ok { - return &ValidationError{Name: "name", err: errors.New(`db: missing required field "BillingInvoiceItem.name"`)} - } - if v, ok := biic.mutation.Name(); ok { - if err := billinginvoiceitem.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.name": %w`, err)} - } - } - if _, ok := biic.mutation.UnitPrice(); !ok { - return &ValidationError{Name: "unit_price", err: errors.New(`db: missing required field "BillingInvoiceItem.unit_price"`)} - } - if _, ok := biic.mutation.Currency(); !ok { - return &ValidationError{Name: "currency", err: errors.New(`db: missing required field "BillingInvoiceItem.currency"`)} - } - if v, ok := biic.mutation.Currency(); ok { - if err := billinginvoiceitem.CurrencyValidator(string(v)); err != nil { - return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.currency": %w`, err)} - } - } - if _, ok := biic.mutation.TaxCodeOverride(); !ok { - return &ValidationError{Name: "tax_code_override", err: errors.New(`db: missing required field "BillingInvoiceItem.tax_code_override"`)} - } - return nil -} - -func (biic *BillingInvoiceItemCreate) sqlSave(ctx context.Context) (*BillingInvoiceItem, error) { - if err := biic.check(); err != nil { - return nil, err - } - _node, _spec := biic.createSpec() - if err := sqlgraph.CreateNode(ctx, biic.driver, _spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - if _spec.ID.Value != nil { - if id, ok := _spec.ID.Value.(string); ok { - _node.ID = id - } else { - return nil, fmt.Errorf("unexpected BillingInvoiceItem.ID type: %T", _spec.ID.Value) - } - } - biic.mutation.id = &_node.ID - biic.mutation.done = true - return _node, nil -} - -func (biic *BillingInvoiceItemCreate) createSpec() (*BillingInvoiceItem, *sqlgraph.CreateSpec) { - var ( - _node = &BillingInvoiceItem{config: biic.config} - _spec = sqlgraph.NewCreateSpec(billinginvoiceitem.Table, sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString)) - ) - _spec.OnConflict = biic.conflict - if id, ok := biic.mutation.ID(); ok { - _node.ID = id - _spec.ID.Value = id - } - if value, ok := biic.mutation.Namespace(); ok { - _spec.SetField(billinginvoiceitem.FieldNamespace, field.TypeString, value) - _node.Namespace = value - } - if value, ok := biic.mutation.CreatedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldCreatedAt, field.TypeTime, value) - _node.CreatedAt = value - } - if value, ok := biic.mutation.UpdatedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldUpdatedAt, field.TypeTime, value) - _node.UpdatedAt = value - } - if value, ok := biic.mutation.DeletedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldDeletedAt, field.TypeTime, value) - _node.DeletedAt = &value - } - if value, ok := biic.mutation.Metadata(); ok { - _spec.SetField(billinginvoiceitem.FieldMetadata, field.TypeJSON, value) - _node.Metadata = value - } - if value, ok := biic.mutation.CustomerID(); ok { - _spec.SetField(billinginvoiceitem.FieldCustomerID, field.TypeString, value) - _node.CustomerID = value - } - if value, ok := biic.mutation.PeriodStart(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodStart, field.TypeTime, value) - _node.PeriodStart = value - } - if value, ok := biic.mutation.PeriodEnd(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodEnd, field.TypeTime, value) - _node.PeriodEnd = value - } - if value, ok := biic.mutation.InvoiceAt(); ok { - _spec.SetField(billinginvoiceitem.FieldInvoiceAt, field.TypeTime, value) - _node.InvoiceAt = value - } - if value, ok := biic.mutation.GetType(); ok { - _spec.SetField(billinginvoiceitem.FieldType, field.TypeEnum, value) - _node.Type = value - } - if value, ok := biic.mutation.Name(); ok { - _spec.SetField(billinginvoiceitem.FieldName, field.TypeString, value) - _node.Name = value - } - if value, ok := biic.mutation.Quantity(); ok { - _spec.SetField(billinginvoiceitem.FieldQuantity, field.TypeOther, value) - _node.Quantity = &value - } - if value, ok := biic.mutation.UnitPrice(); ok { - _spec.SetField(billinginvoiceitem.FieldUnitPrice, field.TypeOther, value) - _node.UnitPrice = value - } - if value, ok := biic.mutation.Currency(); ok { - _spec.SetField(billinginvoiceitem.FieldCurrency, field.TypeString, value) - _node.Currency = value - } - if value, ok := biic.mutation.TaxCodeOverride(); ok { - _spec.SetField(billinginvoiceitem.FieldTaxCodeOverride, field.TypeJSON, value) - _node.TaxCodeOverride = value - } - if nodes := biic.mutation.BillingInvoiceIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: true, - Table: billinginvoiceitem.BillingInvoiceTable, - Columns: []string{billinginvoiceitem.BillingInvoiceColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _node.InvoiceID = &nodes[0] - _spec.Edges = append(_spec.Edges, edge) - } - return _node, _spec -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.BillingInvoiceItem.Create(). -// SetNamespace(v). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.BillingInvoiceItemUpsert) { -// SetNamespace(v+v). -// }). -// Exec(ctx) -func (biic *BillingInvoiceItemCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceItemUpsertOne { - biic.conflict = opts - return &BillingInvoiceItemUpsertOne{ - create: biic, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -func (biic *BillingInvoiceItemCreate) OnConflictColumns(columns ...string) *BillingInvoiceItemUpsertOne { - biic.conflict = append(biic.conflict, sql.ConflictColumns(columns...)) - return &BillingInvoiceItemUpsertOne{ - create: biic, - } -} - -type ( - // BillingInvoiceItemUpsertOne is the builder for "upsert"-ing - // one BillingInvoiceItem node. - BillingInvoiceItemUpsertOne struct { - create *BillingInvoiceItemCreate - } - - // BillingInvoiceItemUpsert is the "OnConflict" setter. - BillingInvoiceItemUpsert struct { - *sql.UpdateSet - } -) - -// SetUpdatedAt sets the "updated_at" field. -func (u *BillingInvoiceItemUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldUpdatedAt, v) - return u -} - -// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateUpdatedAt() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldUpdatedAt) - return u -} - -// SetDeletedAt sets the "deleted_at" field. -func (u *BillingInvoiceItemUpsert) SetDeletedAt(v time.Time) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldDeletedAt, v) - return u -} - -// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateDeletedAt() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldDeletedAt) - return u -} - -// ClearDeletedAt clears the value of the "deleted_at" field. -func (u *BillingInvoiceItemUpsert) ClearDeletedAt() *BillingInvoiceItemUpsert { - u.SetNull(billinginvoiceitem.FieldDeletedAt) - return u -} - -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceItemUpsert) SetMetadata(v map[string]string) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldMetadata, v) - return u -} - -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateMetadata() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldMetadata) - return u -} - -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceItemUpsert) ClearMetadata() *BillingInvoiceItemUpsert { - u.SetNull(billinginvoiceitem.FieldMetadata) - return u -} - -// SetInvoiceID sets the "invoice_id" field. -func (u *BillingInvoiceItemUpsert) SetInvoiceID(v string) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldInvoiceID, v) - return u -} - -// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateInvoiceID() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldInvoiceID) - return u -} - -// ClearInvoiceID clears the value of the "invoice_id" field. -func (u *BillingInvoiceItemUpsert) ClearInvoiceID() *BillingInvoiceItemUpsert { - u.SetNull(billinginvoiceitem.FieldInvoiceID) - return u -} - -// SetPeriodStart sets the "period_start" field. -func (u *BillingInvoiceItemUpsert) SetPeriodStart(v time.Time) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldPeriodStart, v) - return u -} - -// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdatePeriodStart() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldPeriodStart) - return u -} - -// SetPeriodEnd sets the "period_end" field. -func (u *BillingInvoiceItemUpsert) SetPeriodEnd(v time.Time) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldPeriodEnd, v) - return u -} - -// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdatePeriodEnd() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldPeriodEnd) - return u -} - -// SetInvoiceAt sets the "invoice_at" field. -func (u *BillingInvoiceItemUpsert) SetInvoiceAt(v time.Time) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldInvoiceAt, v) - return u -} - -// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateInvoiceAt() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldInvoiceAt) - return u -} - -// SetType sets the "type" field. -func (u *BillingInvoiceItemUpsert) SetType(v billingentity.InvoiceItemType) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldType, v) - return u -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateType() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldType) - return u -} - -// SetName sets the "name" field. -func (u *BillingInvoiceItemUpsert) SetName(v string) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldName, v) - return u -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateName() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldName) - return u -} - -// SetQuantity sets the "quantity" field. -func (u *BillingInvoiceItemUpsert) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldQuantity, v) - return u -} - -// UpdateQuantity sets the "quantity" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateQuantity() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldQuantity) - return u -} - -// ClearQuantity clears the value of the "quantity" field. -func (u *BillingInvoiceItemUpsert) ClearQuantity() *BillingInvoiceItemUpsert { - u.SetNull(billinginvoiceitem.FieldQuantity) - return u -} - -// SetUnitPrice sets the "unit_price" field. -func (u *BillingInvoiceItemUpsert) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldUnitPrice, v) - return u -} - -// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateUnitPrice() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldUnitPrice) - return u -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (u *BillingInvoiceItemUpsert) SetTaxCodeOverride(v billingentity.TaxOverrides) *BillingInvoiceItemUpsert { - u.Set(billinginvoiceitem.FieldTaxCodeOverride, v) - return u -} - -// UpdateTaxCodeOverride sets the "tax_code_override" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsert) UpdateTaxCodeOverride() *BillingInvoiceItemUpsert { - u.SetExcluded(billinginvoiceitem.FieldTaxCodeOverride) - return u -} - -// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. -// Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(billinginvoiceitem.FieldID) -// }), -// ). -// Exec(ctx) -func (u *BillingInvoiceItemUpsertOne) UpdateNewValues() *BillingInvoiceItemUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - if _, exists := u.create.mutation.ID(); exists { - s.SetIgnore(billinginvoiceitem.FieldID) - } - if _, exists := u.create.mutation.Namespace(); exists { - s.SetIgnore(billinginvoiceitem.FieldNamespace) - } - if _, exists := u.create.mutation.CreatedAt(); exists { - s.SetIgnore(billinginvoiceitem.FieldCreatedAt) - } - if _, exists := u.create.mutation.CustomerID(); exists { - s.SetIgnore(billinginvoiceitem.FieldCustomerID) - } - if _, exists := u.create.mutation.Currency(); exists { - s.SetIgnore(billinginvoiceitem.FieldCurrency) - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -func (u *BillingInvoiceItemUpsertOne) Ignore() *BillingInvoiceItemUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *BillingInvoiceItemUpsertOne) DoNothing() *BillingInvoiceItemUpsertOne { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the BillingInvoiceItemCreate.OnConflict -// documentation for more info. -func (u *BillingInvoiceItemUpsertOne) Update(set func(*BillingInvoiceItemUpsert)) *BillingInvoiceItemUpsertOne { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&BillingInvoiceItemUpsert{UpdateSet: update}) - })) - return u -} - -// SetUpdatedAt sets the "updated_at" field. -func (u *BillingInvoiceItemUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetUpdatedAt(v) - }) -} - -// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateUpdatedAt() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateUpdatedAt() - }) -} - -// SetDeletedAt sets the "deleted_at" field. -func (u *BillingInvoiceItemUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetDeletedAt(v) - }) -} - -// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateDeletedAt() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateDeletedAt() - }) -} - -// ClearDeletedAt clears the value of the "deleted_at" field. -func (u *BillingInvoiceItemUpsertOne) ClearDeletedAt() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearDeletedAt() - }) -} - -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceItemUpsertOne) SetMetadata(v map[string]string) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetMetadata(v) - }) -} - -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateMetadata() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateMetadata() - }) -} - -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceItemUpsertOne) ClearMetadata() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearMetadata() - }) -} - -// SetInvoiceID sets the "invoice_id" field. -func (u *BillingInvoiceItemUpsertOne) SetInvoiceID(v string) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetInvoiceID(v) - }) -} - -// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateInvoiceID() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateInvoiceID() - }) -} - -// ClearInvoiceID clears the value of the "invoice_id" field. -func (u *BillingInvoiceItemUpsertOne) ClearInvoiceID() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearInvoiceID() - }) -} - -// SetPeriodStart sets the "period_start" field. -func (u *BillingInvoiceItemUpsertOne) SetPeriodStart(v time.Time) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetPeriodStart(v) - }) -} - -// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdatePeriodStart() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdatePeriodStart() - }) -} - -// SetPeriodEnd sets the "period_end" field. -func (u *BillingInvoiceItemUpsertOne) SetPeriodEnd(v time.Time) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetPeriodEnd(v) - }) -} - -// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdatePeriodEnd() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdatePeriodEnd() - }) -} - -// SetInvoiceAt sets the "invoice_at" field. -func (u *BillingInvoiceItemUpsertOne) SetInvoiceAt(v time.Time) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetInvoiceAt(v) - }) -} - -// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateInvoiceAt() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateInvoiceAt() - }) -} - -// SetType sets the "type" field. -func (u *BillingInvoiceItemUpsertOne) SetType(v billingentity.InvoiceItemType) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetType(v) - }) -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateType() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateType() - }) -} - -// SetName sets the "name" field. -func (u *BillingInvoiceItemUpsertOne) SetName(v string) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateName() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateName() - }) -} - -// SetQuantity sets the "quantity" field. -func (u *BillingInvoiceItemUpsertOne) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetQuantity(v) - }) -} - -// UpdateQuantity sets the "quantity" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateQuantity() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateQuantity() - }) -} - -// ClearQuantity clears the value of the "quantity" field. -func (u *BillingInvoiceItemUpsertOne) ClearQuantity() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearQuantity() - }) -} - -// SetUnitPrice sets the "unit_price" field. -func (u *BillingInvoiceItemUpsertOne) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetUnitPrice(v) - }) -} - -// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateUnitPrice() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateUnitPrice() - }) -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (u *BillingInvoiceItemUpsertOne) SetTaxCodeOverride(v billingentity.TaxOverrides) *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetTaxCodeOverride(v) - }) -} - -// UpdateTaxCodeOverride sets the "tax_code_override" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertOne) UpdateTaxCodeOverride() *BillingInvoiceItemUpsertOne { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateTaxCodeOverride() - }) -} - -// Exec executes the query. -func (u *BillingInvoiceItemUpsertOne) Exec(ctx context.Context) error { - if len(u.create.conflict) == 0 { - return errors.New("db: missing options for BillingInvoiceItemCreate.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *BillingInvoiceItemUpsertOne) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} - -// Exec executes the UPSERT query and returns the inserted/updated ID. -func (u *BillingInvoiceItemUpsertOne) ID(ctx context.Context) (id string, err error) { - if u.create.driver.Dialect() == dialect.MySQL { - // In case of "ON CONFLICT", there is no way to get back non-numeric ID - // fields from the database since MySQL does not support the RETURNING clause. - return id, errors.New("db: BillingInvoiceItemUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceItemUpsertOne.Exec instead") - } - node, err := u.create.Save(ctx) - if err != nil { - return id, err - } - return node.ID, nil -} - -// IDX is like ID, but panics if an error occurs. -func (u *BillingInvoiceItemUpsertOne) IDX(ctx context.Context) string { - id, err := u.ID(ctx) - if err != nil { - panic(err) - } - return id -} - -// BillingInvoiceItemCreateBulk is the builder for creating many BillingInvoiceItem entities in bulk. -type BillingInvoiceItemCreateBulk struct { - config - err error - builders []*BillingInvoiceItemCreate - conflict []sql.ConflictOption -} - -// Save creates the BillingInvoiceItem entities in the database. -func (biicb *BillingInvoiceItemCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceItem, error) { - if biicb.err != nil { - return nil, biicb.err - } - specs := make([]*sqlgraph.CreateSpec, len(biicb.builders)) - nodes := make([]*BillingInvoiceItem, len(biicb.builders)) - mutators := make([]Mutator, len(biicb.builders)) - for i := range biicb.builders { - func(i int, root context.Context) { - builder := biicb.builders[i] - builder.defaults() - var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { - mutation, ok := m.(*BillingInvoiceItemMutation) - if !ok { - return nil, fmt.Errorf("unexpected mutation type %T", m) - } - if err := builder.check(); err != nil { - return nil, err - } - builder.mutation = mutation - var err error - nodes[i], specs[i] = builder.createSpec() - if i < len(mutators)-1 { - _, err = mutators[i+1].Mutate(root, biicb.builders[i+1].mutation) - } else { - spec := &sqlgraph.BatchCreateSpec{Nodes: specs} - spec.OnConflict = biicb.conflict - // Invoke the actual operation on the latest mutation in the chain. - if err = sqlgraph.BatchCreate(ctx, biicb.driver, spec); err != nil { - if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - } - } - if err != nil { - return nil, err - } - mutation.id = &nodes[i].ID - mutation.done = true - return nodes[i], nil - }) - for i := len(builder.hooks) - 1; i >= 0; i-- { - mut = builder.hooks[i](mut) - } - mutators[i] = mut - }(i, ctx) - } - if len(mutators) > 0 { - if _, err := mutators[0].Mutate(ctx, biicb.builders[0].mutation); err != nil { - return nil, err - } - } - return nodes, nil -} - -// SaveX is like Save, but panics if an error occurs. -func (biicb *BillingInvoiceItemCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceItem { - v, err := biicb.Save(ctx) - if err != nil { - panic(err) - } - return v -} - -// Exec executes the query. -func (biicb *BillingInvoiceItemCreateBulk) Exec(ctx context.Context) error { - _, err := biicb.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (biicb *BillingInvoiceItemCreateBulk) ExecX(ctx context.Context) { - if err := biicb.Exec(ctx); err != nil { - panic(err) - } -} - -// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause -// of the `INSERT` statement. For example: -// -// client.BillingInvoiceItem.CreateBulk(builders...). -// OnConflict( -// // Update the row with the new values -// // the was proposed for insertion. -// sql.ResolveWithNewValues(), -// ). -// // Override some of the fields with custom -// // update values. -// Update(func(u *ent.BillingInvoiceItemUpsert) { -// SetNamespace(v+v). -// }). -// Exec(ctx) -func (biicb *BillingInvoiceItemCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceItemUpsertBulk { - biicb.conflict = opts - return &BillingInvoiceItemUpsertBulk{ - create: biicb, - } -} - -// OnConflictColumns calls `OnConflict` and configures the columns -// as conflict target. Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict(sql.ConflictColumns(columns...)). -// Exec(ctx) -func (biicb *BillingInvoiceItemCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceItemUpsertBulk { - biicb.conflict = append(biicb.conflict, sql.ConflictColumns(columns...)) - return &BillingInvoiceItemUpsertBulk{ - create: biicb, - } -} - -// BillingInvoiceItemUpsertBulk is the builder for "upsert"-ing -// a bulk of BillingInvoiceItem nodes. -type BillingInvoiceItemUpsertBulk struct { - create *BillingInvoiceItemCreateBulk -} - -// UpdateNewValues updates the mutable fields using the new values that -// were set on create. Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict( -// sql.ResolveWithNewValues(), -// sql.ResolveWith(func(u *sql.UpdateSet) { -// u.SetIgnore(billinginvoiceitem.FieldID) -// }), -// ). -// Exec(ctx) -func (u *BillingInvoiceItemUpsertBulk) UpdateNewValues() *BillingInvoiceItemUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { - for _, b := range u.create.builders { - if _, exists := b.mutation.ID(); exists { - s.SetIgnore(billinginvoiceitem.FieldID) - } - if _, exists := b.mutation.Namespace(); exists { - s.SetIgnore(billinginvoiceitem.FieldNamespace) - } - if _, exists := b.mutation.CreatedAt(); exists { - s.SetIgnore(billinginvoiceitem.FieldCreatedAt) - } - if _, exists := b.mutation.CustomerID(); exists { - s.SetIgnore(billinginvoiceitem.FieldCustomerID) - } - if _, exists := b.mutation.Currency(); exists { - s.SetIgnore(billinginvoiceitem.FieldCurrency) - } - } - })) - return u -} - -// Ignore sets each column to itself in case of conflict. -// Using this option is equivalent to using: -// -// client.BillingInvoiceItem.Create(). -// OnConflict(sql.ResolveWithIgnore()). -// Exec(ctx) -func (u *BillingInvoiceItemUpsertBulk) Ignore() *BillingInvoiceItemUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) - return u -} - -// DoNothing configures the conflict_action to `DO NOTHING`. -// Supported only by SQLite and PostgreSQL. -func (u *BillingInvoiceItemUpsertBulk) DoNothing() *BillingInvoiceItemUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.DoNothing()) - return u -} - -// Update allows overriding fields `UPDATE` values. See the BillingInvoiceItemCreateBulk.OnConflict -// documentation for more info. -func (u *BillingInvoiceItemUpsertBulk) Update(set func(*BillingInvoiceItemUpsert)) *BillingInvoiceItemUpsertBulk { - u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { - set(&BillingInvoiceItemUpsert{UpdateSet: update}) - })) - return u -} - -// SetUpdatedAt sets the "updated_at" field. -func (u *BillingInvoiceItemUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetUpdatedAt(v) - }) -} - -// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateUpdatedAt() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateUpdatedAt() - }) -} - -// SetDeletedAt sets the "deleted_at" field. -func (u *BillingInvoiceItemUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetDeletedAt(v) - }) -} - -// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateDeletedAt() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateDeletedAt() - }) -} - -// ClearDeletedAt clears the value of the "deleted_at" field. -func (u *BillingInvoiceItemUpsertBulk) ClearDeletedAt() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearDeletedAt() - }) -} - -// SetMetadata sets the "metadata" field. -func (u *BillingInvoiceItemUpsertBulk) SetMetadata(v map[string]string) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetMetadata(v) - }) -} - -// UpdateMetadata sets the "metadata" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateMetadata() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateMetadata() - }) -} - -// ClearMetadata clears the value of the "metadata" field. -func (u *BillingInvoiceItemUpsertBulk) ClearMetadata() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearMetadata() - }) -} - -// SetInvoiceID sets the "invoice_id" field. -func (u *BillingInvoiceItemUpsertBulk) SetInvoiceID(v string) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetInvoiceID(v) - }) -} - -// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateInvoiceID() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateInvoiceID() - }) -} - -// ClearInvoiceID clears the value of the "invoice_id" field. -func (u *BillingInvoiceItemUpsertBulk) ClearInvoiceID() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearInvoiceID() - }) -} - -// SetPeriodStart sets the "period_start" field. -func (u *BillingInvoiceItemUpsertBulk) SetPeriodStart(v time.Time) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetPeriodStart(v) - }) -} - -// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdatePeriodStart() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdatePeriodStart() - }) -} - -// SetPeriodEnd sets the "period_end" field. -func (u *BillingInvoiceItemUpsertBulk) SetPeriodEnd(v time.Time) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetPeriodEnd(v) - }) -} - -// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdatePeriodEnd() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdatePeriodEnd() - }) -} - -// SetInvoiceAt sets the "invoice_at" field. -func (u *BillingInvoiceItemUpsertBulk) SetInvoiceAt(v time.Time) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetInvoiceAt(v) - }) -} - -// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateInvoiceAt() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateInvoiceAt() - }) -} - -// SetType sets the "type" field. -func (u *BillingInvoiceItemUpsertBulk) SetType(v billingentity.InvoiceItemType) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetType(v) - }) -} - -// UpdateType sets the "type" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateType() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateType() - }) -} - -// SetName sets the "name" field. -func (u *BillingInvoiceItemUpsertBulk) SetName(v string) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetName(v) - }) -} - -// UpdateName sets the "name" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateName() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateName() - }) -} - -// SetQuantity sets the "quantity" field. -func (u *BillingInvoiceItemUpsertBulk) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetQuantity(v) - }) -} - -// UpdateQuantity sets the "quantity" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateQuantity() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateQuantity() - }) -} - -// ClearQuantity clears the value of the "quantity" field. -func (u *BillingInvoiceItemUpsertBulk) ClearQuantity() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.ClearQuantity() - }) -} - -// SetUnitPrice sets the "unit_price" field. -func (u *BillingInvoiceItemUpsertBulk) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetUnitPrice(v) - }) -} - -// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateUnitPrice() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateUnitPrice() - }) -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (u *BillingInvoiceItemUpsertBulk) SetTaxCodeOverride(v billingentity.TaxOverrides) *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.SetTaxCodeOverride(v) - }) -} - -// UpdateTaxCodeOverride sets the "tax_code_override" field to the value that was provided on create. -func (u *BillingInvoiceItemUpsertBulk) UpdateTaxCodeOverride() *BillingInvoiceItemUpsertBulk { - return u.Update(func(s *BillingInvoiceItemUpsert) { - s.UpdateTaxCodeOverride() - }) -} - -// Exec executes the query. -func (u *BillingInvoiceItemUpsertBulk) Exec(ctx context.Context) error { - if u.create.err != nil { - return u.create.err - } - for i, b := range u.create.builders { - if len(b.conflict) != 0 { - return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceItemCreateBulk instead", i) - } - } - if len(u.create.conflict) == 0 { - return errors.New("db: missing options for BillingInvoiceItemCreateBulk.OnConflict") - } - return u.create.Exec(ctx) -} - -// ExecX is like Exec, but panics if an error occurs. -func (u *BillingInvoiceItemUpsertBulk) ExecX(ctx context.Context) { - if err := u.create.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/openmeter/ent/db/billinginvoiceitem_delete.go b/openmeter/ent/db/billinginvoiceitem_delete.go deleted file mode 100644 index fa8f072fa..000000000 --- a/openmeter/ent/db/billinginvoiceitem_delete.go +++ /dev/null @@ -1,88 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package db - -import ( - "context" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" - "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" -) - -// BillingInvoiceItemDelete is the builder for deleting a BillingInvoiceItem entity. -type BillingInvoiceItemDelete struct { - config - hooks []Hook - mutation *BillingInvoiceItemMutation -} - -// Where appends a list predicates to the BillingInvoiceItemDelete builder. -func (biid *BillingInvoiceItemDelete) Where(ps ...predicate.BillingInvoiceItem) *BillingInvoiceItemDelete { - biid.mutation.Where(ps...) - return biid -} - -// Exec executes the deletion query and returns how many vertices were deleted. -func (biid *BillingInvoiceItemDelete) Exec(ctx context.Context) (int, error) { - return withHooks(ctx, biid.sqlExec, biid.mutation, biid.hooks) -} - -// ExecX is like Exec, but panics if an error occurs. -func (biid *BillingInvoiceItemDelete) ExecX(ctx context.Context) int { - n, err := biid.Exec(ctx) - if err != nil { - panic(err) - } - return n -} - -func (biid *BillingInvoiceItemDelete) sqlExec(ctx context.Context) (int, error) { - _spec := sqlgraph.NewDeleteSpec(billinginvoiceitem.Table, sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString)) - if ps := biid.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - affected, err := sqlgraph.DeleteNodes(ctx, biid.driver, _spec) - if err != nil && sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - biid.mutation.done = true - return affected, err -} - -// BillingInvoiceItemDeleteOne is the builder for deleting a single BillingInvoiceItem entity. -type BillingInvoiceItemDeleteOne struct { - biid *BillingInvoiceItemDelete -} - -// Where appends a list predicates to the BillingInvoiceItemDelete builder. -func (biido *BillingInvoiceItemDeleteOne) Where(ps ...predicate.BillingInvoiceItem) *BillingInvoiceItemDeleteOne { - biido.biid.mutation.Where(ps...) - return biido -} - -// Exec executes the deletion query. -func (biido *BillingInvoiceItemDeleteOne) Exec(ctx context.Context) error { - n, err := biido.biid.Exec(ctx) - switch { - case err != nil: - return err - case n == 0: - return &NotFoundError{billinginvoiceitem.Label} - default: - return nil - } -} - -// ExecX is like Exec, but panics if an error occurs. -func (biido *BillingInvoiceItemDeleteOne) ExecX(ctx context.Context) { - if err := biido.Exec(ctx); err != nil { - panic(err) - } -} diff --git a/openmeter/ent/db/billinginvoiceitem_query.go b/openmeter/ent/db/billinginvoiceitem_query.go deleted file mode 100644 index 745fe86e6..000000000 --- a/openmeter/ent/db/billinginvoiceitem_query.go +++ /dev/null @@ -1,646 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package db - -import ( - "context" - "fmt" - "math" - - "entgo.io/ent" - "entgo.io/ent/dialect" - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" - "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" -) - -// BillingInvoiceItemQuery is the builder for querying BillingInvoiceItem entities. -type BillingInvoiceItemQuery struct { - config - ctx *QueryContext - order []billinginvoiceitem.OrderOption - inters []Interceptor - predicates []predicate.BillingInvoiceItem - withBillingInvoice *BillingInvoiceQuery - modifiers []func(*sql.Selector) - // intermediate query (i.e. traversal path). - sql *sql.Selector - path func(context.Context) (*sql.Selector, error) -} - -// Where adds a new predicate for the BillingInvoiceItemQuery builder. -func (biiq *BillingInvoiceItemQuery) Where(ps ...predicate.BillingInvoiceItem) *BillingInvoiceItemQuery { - biiq.predicates = append(biiq.predicates, ps...) - return biiq -} - -// Limit the number of records to be returned by this query. -func (biiq *BillingInvoiceItemQuery) Limit(limit int) *BillingInvoiceItemQuery { - biiq.ctx.Limit = &limit - return biiq -} - -// Offset to start from. -func (biiq *BillingInvoiceItemQuery) Offset(offset int) *BillingInvoiceItemQuery { - biiq.ctx.Offset = &offset - return biiq -} - -// Unique configures the query builder to filter duplicate records on query. -// By default, unique is set to true, and can be disabled using this method. -func (biiq *BillingInvoiceItemQuery) Unique(unique bool) *BillingInvoiceItemQuery { - biiq.ctx.Unique = &unique - return biiq -} - -// Order specifies how the records should be ordered. -func (biiq *BillingInvoiceItemQuery) Order(o ...billinginvoiceitem.OrderOption) *BillingInvoiceItemQuery { - biiq.order = append(biiq.order, o...) - return biiq -} - -// QueryBillingInvoice chains the current query on the "billing_invoice" edge. -func (biiq *BillingInvoiceItemQuery) QueryBillingInvoice() *BillingInvoiceQuery { - query := (&BillingInvoiceClient{config: biiq.config}).Query() - query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { - if err := biiq.prepareQuery(ctx); err != nil { - return nil, err - } - selector := biiq.sqlQuery(ctx) - if err := selector.Err(); err != nil { - return nil, err - } - step := sqlgraph.NewStep( - sqlgraph.From(billinginvoiceitem.Table, billinginvoiceitem.FieldID, selector), - sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, billinginvoiceitem.BillingInvoiceTable, billinginvoiceitem.BillingInvoiceColumn), - ) - fromU = sqlgraph.SetNeighbors(biiq.driver.Dialect(), step) - return fromU, nil - } - return query -} - -// First returns the first BillingInvoiceItem entity from the query. -// Returns a *NotFoundError when no BillingInvoiceItem was found. -func (biiq *BillingInvoiceItemQuery) First(ctx context.Context) (*BillingInvoiceItem, error) { - nodes, err := biiq.Limit(1).All(setContextOp(ctx, biiq.ctx, ent.OpQueryFirst)) - if err != nil { - return nil, err - } - if len(nodes) == 0 { - return nil, &NotFoundError{billinginvoiceitem.Label} - } - return nodes[0], nil -} - -// FirstX is like First, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) FirstX(ctx context.Context) *BillingInvoiceItem { - node, err := biiq.First(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return node -} - -// FirstID returns the first BillingInvoiceItem ID from the query. -// Returns a *NotFoundError when no BillingInvoiceItem ID was found. -func (biiq *BillingInvoiceItemQuery) FirstID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = biiq.Limit(1).IDs(setContextOp(ctx, biiq.ctx, ent.OpQueryFirstID)); err != nil { - return - } - if len(ids) == 0 { - err = &NotFoundError{billinginvoiceitem.Label} - return - } - return ids[0], nil -} - -// FirstIDX is like FirstID, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) FirstIDX(ctx context.Context) string { - id, err := biiq.FirstID(ctx) - if err != nil && !IsNotFound(err) { - panic(err) - } - return id -} - -// Only returns a single BillingInvoiceItem entity found by the query, ensuring it only returns one. -// Returns a *NotSingularError when more than one BillingInvoiceItem entity is found. -// Returns a *NotFoundError when no BillingInvoiceItem entities are found. -func (biiq *BillingInvoiceItemQuery) Only(ctx context.Context) (*BillingInvoiceItem, error) { - nodes, err := biiq.Limit(2).All(setContextOp(ctx, biiq.ctx, ent.OpQueryOnly)) - if err != nil { - return nil, err - } - switch len(nodes) { - case 1: - return nodes[0], nil - case 0: - return nil, &NotFoundError{billinginvoiceitem.Label} - default: - return nil, &NotSingularError{billinginvoiceitem.Label} - } -} - -// OnlyX is like Only, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) OnlyX(ctx context.Context) *BillingInvoiceItem { - node, err := biiq.Only(ctx) - if err != nil { - panic(err) - } - return node -} - -// OnlyID is like Only, but returns the only BillingInvoiceItem ID in the query. -// Returns a *NotSingularError when more than one BillingInvoiceItem ID is found. -// Returns a *NotFoundError when no entities are found. -func (biiq *BillingInvoiceItemQuery) OnlyID(ctx context.Context) (id string, err error) { - var ids []string - if ids, err = biiq.Limit(2).IDs(setContextOp(ctx, biiq.ctx, ent.OpQueryOnlyID)); err != nil { - return - } - switch len(ids) { - case 1: - id = ids[0] - case 0: - err = &NotFoundError{billinginvoiceitem.Label} - default: - err = &NotSingularError{billinginvoiceitem.Label} - } - return -} - -// OnlyIDX is like OnlyID, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) OnlyIDX(ctx context.Context) string { - id, err := biiq.OnlyID(ctx) - if err != nil { - panic(err) - } - return id -} - -// All executes the query and returns a list of BillingInvoiceItems. -func (biiq *BillingInvoiceItemQuery) All(ctx context.Context) ([]*BillingInvoiceItem, error) { - ctx = setContextOp(ctx, biiq.ctx, ent.OpQueryAll) - if err := biiq.prepareQuery(ctx); err != nil { - return nil, err - } - qr := querierAll[[]*BillingInvoiceItem, *BillingInvoiceItemQuery]() - return withInterceptors[[]*BillingInvoiceItem](ctx, biiq, qr, biiq.inters) -} - -// AllX is like All, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) AllX(ctx context.Context) []*BillingInvoiceItem { - nodes, err := biiq.All(ctx) - if err != nil { - panic(err) - } - return nodes -} - -// IDs executes the query and returns a list of BillingInvoiceItem IDs. -func (biiq *BillingInvoiceItemQuery) IDs(ctx context.Context) (ids []string, err error) { - if biiq.ctx.Unique == nil && biiq.path != nil { - biiq.Unique(true) - } - ctx = setContextOp(ctx, biiq.ctx, ent.OpQueryIDs) - if err = biiq.Select(billinginvoiceitem.FieldID).Scan(ctx, &ids); err != nil { - return nil, err - } - return ids, nil -} - -// IDsX is like IDs, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) IDsX(ctx context.Context) []string { - ids, err := biiq.IDs(ctx) - if err != nil { - panic(err) - } - return ids -} - -// Count returns the count of the given query. -func (biiq *BillingInvoiceItemQuery) Count(ctx context.Context) (int, error) { - ctx = setContextOp(ctx, biiq.ctx, ent.OpQueryCount) - if err := biiq.prepareQuery(ctx); err != nil { - return 0, err - } - return withInterceptors[int](ctx, biiq, querierCount[*BillingInvoiceItemQuery](), biiq.inters) -} - -// CountX is like Count, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) CountX(ctx context.Context) int { - count, err := biiq.Count(ctx) - if err != nil { - panic(err) - } - return count -} - -// Exist returns true if the query has elements in the graph. -func (biiq *BillingInvoiceItemQuery) Exist(ctx context.Context) (bool, error) { - ctx = setContextOp(ctx, biiq.ctx, ent.OpQueryExist) - switch _, err := biiq.FirstID(ctx); { - case IsNotFound(err): - return false, nil - case err != nil: - return false, fmt.Errorf("db: check existence: %w", err) - default: - return true, nil - } -} - -// ExistX is like Exist, but panics if an error occurs. -func (biiq *BillingInvoiceItemQuery) ExistX(ctx context.Context) bool { - exist, err := biiq.Exist(ctx) - if err != nil { - panic(err) - } - return exist -} - -// Clone returns a duplicate of the BillingInvoiceItemQuery builder, including all associated steps. It can be -// used to prepare common query builders and use them differently after the clone is made. -func (biiq *BillingInvoiceItemQuery) Clone() *BillingInvoiceItemQuery { - if biiq == nil { - return nil - } - return &BillingInvoiceItemQuery{ - config: biiq.config, - ctx: biiq.ctx.Clone(), - order: append([]billinginvoiceitem.OrderOption{}, biiq.order...), - inters: append([]Interceptor{}, biiq.inters...), - predicates: append([]predicate.BillingInvoiceItem{}, biiq.predicates...), - withBillingInvoice: biiq.withBillingInvoice.Clone(), - // clone intermediate query. - sql: biiq.sql.Clone(), - path: biiq.path, - } -} - -// WithBillingInvoice tells the query-builder to eager-load the nodes that are connected to -// the "billing_invoice" edge. The optional arguments are used to configure the query builder of the edge. -func (biiq *BillingInvoiceItemQuery) WithBillingInvoice(opts ...func(*BillingInvoiceQuery)) *BillingInvoiceItemQuery { - query := (&BillingInvoiceClient{config: biiq.config}).Query() - for _, opt := range opts { - opt(query) - } - biiq.withBillingInvoice = query - return biiq -} - -// GroupBy is used to group vertices by one or more fields/columns. -// It is often used with aggregate functions, like: count, max, mean, min, sum. -// -// Example: -// -// var v []struct { -// Namespace string `json:"namespace,omitempty"` -// Count int `json:"count,omitempty"` -// } -// -// client.BillingInvoiceItem.Query(). -// GroupBy(billinginvoiceitem.FieldNamespace). -// Aggregate(db.Count()). -// Scan(ctx, &v) -func (biiq *BillingInvoiceItemQuery) GroupBy(field string, fields ...string) *BillingInvoiceItemGroupBy { - biiq.ctx.Fields = append([]string{field}, fields...) - grbuild := &BillingInvoiceItemGroupBy{build: biiq} - grbuild.flds = &biiq.ctx.Fields - grbuild.label = billinginvoiceitem.Label - grbuild.scan = grbuild.Scan - return grbuild -} - -// Select allows the selection one or more fields/columns for the given query, -// instead of selecting all fields in the entity. -// -// Example: -// -// var v []struct { -// Namespace string `json:"namespace,omitempty"` -// } -// -// client.BillingInvoiceItem.Query(). -// Select(billinginvoiceitem.FieldNamespace). -// Scan(ctx, &v) -func (biiq *BillingInvoiceItemQuery) Select(fields ...string) *BillingInvoiceItemSelect { - biiq.ctx.Fields = append(biiq.ctx.Fields, fields...) - sbuild := &BillingInvoiceItemSelect{BillingInvoiceItemQuery: biiq} - sbuild.label = billinginvoiceitem.Label - sbuild.flds, sbuild.scan = &biiq.ctx.Fields, sbuild.Scan - return sbuild -} - -// Aggregate returns a BillingInvoiceItemSelect configured with the given aggregations. -func (biiq *BillingInvoiceItemQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceItemSelect { - return biiq.Select().Aggregate(fns...) -} - -func (biiq *BillingInvoiceItemQuery) prepareQuery(ctx context.Context) error { - for _, inter := range biiq.inters { - if inter == nil { - return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") - } - if trv, ok := inter.(Traverser); ok { - if err := trv.Traverse(ctx, biiq); err != nil { - return err - } - } - } - for _, f := range biiq.ctx.Fields { - if !billinginvoiceitem.ValidColumn(f) { - return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} - } - } - if biiq.path != nil { - prev, err := biiq.path(ctx) - if err != nil { - return err - } - biiq.sql = prev - } - return nil -} - -func (biiq *BillingInvoiceItemQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceItem, error) { - var ( - nodes = []*BillingInvoiceItem{} - _spec = biiq.querySpec() - loadedTypes = [1]bool{ - biiq.withBillingInvoice != nil, - } - ) - _spec.ScanValues = func(columns []string) ([]any, error) { - return (*BillingInvoiceItem).scanValues(nil, columns) - } - _spec.Assign = func(columns []string, values []any) error { - node := &BillingInvoiceItem{config: biiq.config} - nodes = append(nodes, node) - node.Edges.loadedTypes = loadedTypes - return node.assignValues(columns, values) - } - if len(biiq.modifiers) > 0 { - _spec.Modifiers = biiq.modifiers - } - for i := range hooks { - hooks[i](ctx, _spec) - } - if err := sqlgraph.QueryNodes(ctx, biiq.driver, _spec); err != nil { - return nil, err - } - if len(nodes) == 0 { - return nodes, nil - } - if query := biiq.withBillingInvoice; query != nil { - if err := biiq.loadBillingInvoice(ctx, query, nodes, nil, - func(n *BillingInvoiceItem, e *BillingInvoice) { n.Edges.BillingInvoice = e }); err != nil { - return nil, err - } - } - return nodes, nil -} - -func (biiq *BillingInvoiceItemQuery) loadBillingInvoice(ctx context.Context, query *BillingInvoiceQuery, nodes []*BillingInvoiceItem, init func(*BillingInvoiceItem), assign func(*BillingInvoiceItem, *BillingInvoice)) error { - ids := make([]string, 0, len(nodes)) - nodeids := make(map[string][]*BillingInvoiceItem) - for i := range nodes { - if nodes[i].InvoiceID == nil { - continue - } - fk := *nodes[i].InvoiceID - if _, ok := nodeids[fk]; !ok { - ids = append(ids, fk) - } - nodeids[fk] = append(nodeids[fk], nodes[i]) - } - if len(ids) == 0 { - return nil - } - query.Where(billinginvoice.IDIn(ids...)) - neighbors, err := query.All(ctx) - if err != nil { - return err - } - for _, n := range neighbors { - nodes, ok := nodeids[n.ID] - if !ok { - return fmt.Errorf(`unexpected foreign-key "invoice_id" returned %v`, n.ID) - } - for i := range nodes { - assign(nodes[i], n) - } - } - return nil -} - -func (biiq *BillingInvoiceItemQuery) sqlCount(ctx context.Context) (int, error) { - _spec := biiq.querySpec() - if len(biiq.modifiers) > 0 { - _spec.Modifiers = biiq.modifiers - } - _spec.Node.Columns = biiq.ctx.Fields - if len(biiq.ctx.Fields) > 0 { - _spec.Unique = biiq.ctx.Unique != nil && *biiq.ctx.Unique - } - return sqlgraph.CountNodes(ctx, biiq.driver, _spec) -} - -func (biiq *BillingInvoiceItemQuery) querySpec() *sqlgraph.QuerySpec { - _spec := sqlgraph.NewQuerySpec(billinginvoiceitem.Table, billinginvoiceitem.Columns, sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString)) - _spec.From = biiq.sql - if unique := biiq.ctx.Unique; unique != nil { - _spec.Unique = *unique - } else if biiq.path != nil { - _spec.Unique = true - } - if fields := biiq.ctx.Fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceitem.FieldID) - for i := range fields { - if fields[i] != billinginvoiceitem.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) - } - } - if biiq.withBillingInvoice != nil { - _spec.Node.AddColumnOnce(billinginvoiceitem.FieldInvoiceID) - } - } - if ps := biiq.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if limit := biiq.ctx.Limit; limit != nil { - _spec.Limit = *limit - } - if offset := biiq.ctx.Offset; offset != nil { - _spec.Offset = *offset - } - if ps := biiq.order; len(ps) > 0 { - _spec.Order = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - return _spec -} - -func (biiq *BillingInvoiceItemQuery) sqlQuery(ctx context.Context) *sql.Selector { - builder := sql.Dialect(biiq.driver.Dialect()) - t1 := builder.Table(billinginvoiceitem.Table) - columns := biiq.ctx.Fields - if len(columns) == 0 { - columns = billinginvoiceitem.Columns - } - selector := builder.Select(t1.Columns(columns...)...).From(t1) - if biiq.sql != nil { - selector = biiq.sql - selector.Select(selector.Columns(columns...)...) - } - if biiq.ctx.Unique != nil && *biiq.ctx.Unique { - selector.Distinct() - } - for _, m := range biiq.modifiers { - m(selector) - } - for _, p := range biiq.predicates { - p(selector) - } - for _, p := range biiq.order { - p(selector) - } - if offset := biiq.ctx.Offset; offset != nil { - // limit is mandatory for offset clause. We start - // with default value, and override it below if needed. - selector.Offset(*offset).Limit(math.MaxInt32) - } - if limit := biiq.ctx.Limit; limit != nil { - selector.Limit(*limit) - } - return selector -} - -// ForUpdate locks the selected rows against concurrent updates, and prevent them from being -// updated, deleted or "selected ... for update" by other sessions, until the transaction is -// either committed or rolled-back. -func (biiq *BillingInvoiceItemQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceItemQuery { - if biiq.driver.Dialect() == dialect.Postgres { - biiq.Unique(false) - } - biiq.modifiers = append(biiq.modifiers, func(s *sql.Selector) { - s.ForUpdate(opts...) - }) - return biiq -} - -// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock -// on any rows that are read. Other sessions can read the rows, but cannot modify them -// until your transaction commits. -func (biiq *BillingInvoiceItemQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceItemQuery { - if biiq.driver.Dialect() == dialect.Postgres { - biiq.Unique(false) - } - biiq.modifiers = append(biiq.modifiers, func(s *sql.Selector) { - s.ForShare(opts...) - }) - return biiq -} - -// BillingInvoiceItemGroupBy is the group-by builder for BillingInvoiceItem entities. -type BillingInvoiceItemGroupBy struct { - selector - build *BillingInvoiceItemQuery -} - -// Aggregate adds the given aggregation functions to the group-by query. -func (biigb *BillingInvoiceItemGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceItemGroupBy { - biigb.fns = append(biigb.fns, fns...) - return biigb -} - -// Scan applies the selector query and scans the result into the given value. -func (biigb *BillingInvoiceItemGroupBy) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, biigb.build.ctx, ent.OpQueryGroupBy) - if err := biigb.build.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*BillingInvoiceItemQuery, *BillingInvoiceItemGroupBy](ctx, biigb.build, biigb, biigb.build.inters, v) -} - -func (biigb *BillingInvoiceItemGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceItemQuery, v any) error { - selector := root.sqlQuery(ctx).Select() - aggregation := make([]string, 0, len(biigb.fns)) - for _, fn := range biigb.fns { - aggregation = append(aggregation, fn(selector)) - } - if len(selector.SelectedColumns()) == 0 { - columns := make([]string, 0, len(*biigb.flds)+len(biigb.fns)) - for _, f := range *biigb.flds { - columns = append(columns, selector.C(f)) - } - columns = append(columns, aggregation...) - selector.Select(columns...) - } - selector.GroupBy(selector.Columns(*biigb.flds...)...) - if err := selector.Err(); err != nil { - return err - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := biigb.build.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} - -// BillingInvoiceItemSelect is the builder for selecting fields of BillingInvoiceItem entities. -type BillingInvoiceItemSelect struct { - *BillingInvoiceItemQuery - selector -} - -// Aggregate adds the given aggregation functions to the selector query. -func (biis *BillingInvoiceItemSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceItemSelect { - biis.fns = append(biis.fns, fns...) - return biis -} - -// Scan applies the selector query and scans the result into the given value. -func (biis *BillingInvoiceItemSelect) Scan(ctx context.Context, v any) error { - ctx = setContextOp(ctx, biis.ctx, ent.OpQuerySelect) - if err := biis.prepareQuery(ctx); err != nil { - return err - } - return scanWithInterceptors[*BillingInvoiceItemQuery, *BillingInvoiceItemSelect](ctx, biis.BillingInvoiceItemQuery, biis, biis.inters, v) -} - -func (biis *BillingInvoiceItemSelect) sqlScan(ctx context.Context, root *BillingInvoiceItemQuery, v any) error { - selector := root.sqlQuery(ctx) - aggregation := make([]string, 0, len(biis.fns)) - for _, fn := range biis.fns { - aggregation = append(aggregation, fn(selector)) - } - switch n := len(*biis.selector.flds); { - case n == 0 && len(aggregation) > 0: - selector.Select(aggregation...) - case n != 0 && len(aggregation) > 0: - selector.AppendSelect(aggregation...) - } - rows := &sql.Rows{} - query, args := selector.Query() - if err := biis.driver.Query(ctx, query, args, rows); err != nil { - return err - } - defer rows.Close() - return sql.ScanSlice(rows, v) -} diff --git a/openmeter/ent/db/billinginvoiceitem_update.go b/openmeter/ent/db/billinginvoiceitem_update.go deleted file mode 100644 index 9832330ff..000000000 --- a/openmeter/ent/db/billinginvoiceitem_update.go +++ /dev/null @@ -1,777 +0,0 @@ -// Code generated by ent, DO NOT EDIT. - -package db - -import ( - "context" - "errors" - "fmt" - "time" - - "entgo.io/ent/dialect/sql" - "entgo.io/ent/dialect/sql/sqlgraph" - "entgo.io/ent/schema/field" - "github.com/alpacahq/alpacadecimal" - billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" - "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" -) - -// BillingInvoiceItemUpdate is the builder for updating BillingInvoiceItem entities. -type BillingInvoiceItemUpdate struct { - config - hooks []Hook - mutation *BillingInvoiceItemMutation -} - -// Where appends a list predicates to the BillingInvoiceItemUpdate builder. -func (biiu *BillingInvoiceItemUpdate) Where(ps ...predicate.BillingInvoiceItem) *BillingInvoiceItemUpdate { - biiu.mutation.Where(ps...) - return biiu -} - -// SetUpdatedAt sets the "updated_at" field. -func (biiu *BillingInvoiceItemUpdate) SetUpdatedAt(t time.Time) *BillingInvoiceItemUpdate { - biiu.mutation.SetUpdatedAt(t) - return biiu -} - -// SetDeletedAt sets the "deleted_at" field. -func (biiu *BillingInvoiceItemUpdate) SetDeletedAt(t time.Time) *BillingInvoiceItemUpdate { - biiu.mutation.SetDeletedAt(t) - return biiu -} - -// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableDeletedAt(t *time.Time) *BillingInvoiceItemUpdate { - if t != nil { - biiu.SetDeletedAt(*t) - } - return biiu -} - -// ClearDeletedAt clears the value of the "deleted_at" field. -func (biiu *BillingInvoiceItemUpdate) ClearDeletedAt() *BillingInvoiceItemUpdate { - biiu.mutation.ClearDeletedAt() - return biiu -} - -// SetMetadata sets the "metadata" field. -func (biiu *BillingInvoiceItemUpdate) SetMetadata(m map[string]string) *BillingInvoiceItemUpdate { - biiu.mutation.SetMetadata(m) - return biiu -} - -// ClearMetadata clears the value of the "metadata" field. -func (biiu *BillingInvoiceItemUpdate) ClearMetadata() *BillingInvoiceItemUpdate { - biiu.mutation.ClearMetadata() - return biiu -} - -// SetInvoiceID sets the "invoice_id" field. -func (biiu *BillingInvoiceItemUpdate) SetInvoiceID(s string) *BillingInvoiceItemUpdate { - biiu.mutation.SetInvoiceID(s) - return biiu -} - -// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableInvoiceID(s *string) *BillingInvoiceItemUpdate { - if s != nil { - biiu.SetInvoiceID(*s) - } - return biiu -} - -// ClearInvoiceID clears the value of the "invoice_id" field. -func (biiu *BillingInvoiceItemUpdate) ClearInvoiceID() *BillingInvoiceItemUpdate { - biiu.mutation.ClearInvoiceID() - return biiu -} - -// SetPeriodStart sets the "period_start" field. -func (biiu *BillingInvoiceItemUpdate) SetPeriodStart(t time.Time) *BillingInvoiceItemUpdate { - biiu.mutation.SetPeriodStart(t) - return biiu -} - -// SetNillablePeriodStart sets the "period_start" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillablePeriodStart(t *time.Time) *BillingInvoiceItemUpdate { - if t != nil { - biiu.SetPeriodStart(*t) - } - return biiu -} - -// SetPeriodEnd sets the "period_end" field. -func (biiu *BillingInvoiceItemUpdate) SetPeriodEnd(t time.Time) *BillingInvoiceItemUpdate { - biiu.mutation.SetPeriodEnd(t) - return biiu -} - -// SetNillablePeriodEnd sets the "period_end" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillablePeriodEnd(t *time.Time) *BillingInvoiceItemUpdate { - if t != nil { - biiu.SetPeriodEnd(*t) - } - return biiu -} - -// SetInvoiceAt sets the "invoice_at" field. -func (biiu *BillingInvoiceItemUpdate) SetInvoiceAt(t time.Time) *BillingInvoiceItemUpdate { - biiu.mutation.SetInvoiceAt(t) - return biiu -} - -// SetNillableInvoiceAt sets the "invoice_at" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableInvoiceAt(t *time.Time) *BillingInvoiceItemUpdate { - if t != nil { - biiu.SetInvoiceAt(*t) - } - return biiu -} - -// SetType sets the "type" field. -func (biiu *BillingInvoiceItemUpdate) SetType(bit billingentity.InvoiceItemType) *BillingInvoiceItemUpdate { - biiu.mutation.SetType(bit) - return biiu -} - -// SetNillableType sets the "type" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableType(bit *billingentity.InvoiceItemType) *BillingInvoiceItemUpdate { - if bit != nil { - biiu.SetType(*bit) - } - return biiu -} - -// SetName sets the "name" field. -func (biiu *BillingInvoiceItemUpdate) SetName(s string) *BillingInvoiceItemUpdate { - biiu.mutation.SetName(s) - return biiu -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableName(s *string) *BillingInvoiceItemUpdate { - if s != nil { - biiu.SetName(*s) - } - return biiu -} - -// SetQuantity sets the "quantity" field. -func (biiu *BillingInvoiceItemUpdate) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceItemUpdate { - biiu.mutation.SetQuantity(a) - return biiu -} - -// SetNillableQuantity sets the "quantity" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceItemUpdate { - if a != nil { - biiu.SetQuantity(*a) - } - return biiu -} - -// ClearQuantity clears the value of the "quantity" field. -func (biiu *BillingInvoiceItemUpdate) ClearQuantity() *BillingInvoiceItemUpdate { - biiu.mutation.ClearQuantity() - return biiu -} - -// SetUnitPrice sets the "unit_price" field. -func (biiu *BillingInvoiceItemUpdate) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceItemUpdate { - biiu.mutation.SetUnitPrice(a) - return biiu -} - -// SetNillableUnitPrice sets the "unit_price" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableUnitPrice(a *alpacadecimal.Decimal) *BillingInvoiceItemUpdate { - if a != nil { - biiu.SetUnitPrice(*a) - } - return biiu -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (biiu *BillingInvoiceItemUpdate) SetTaxCodeOverride(bo billingentity.TaxOverrides) *BillingInvoiceItemUpdate { - biiu.mutation.SetTaxCodeOverride(bo) - return biiu -} - -// SetNillableTaxCodeOverride sets the "tax_code_override" field if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableTaxCodeOverride(bo *billingentity.TaxOverrides) *BillingInvoiceItemUpdate { - if bo != nil { - biiu.SetTaxCodeOverride(*bo) - } - return biiu -} - -// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. -func (biiu *BillingInvoiceItemUpdate) SetBillingInvoiceID(id string) *BillingInvoiceItemUpdate { - biiu.mutation.SetBillingInvoiceID(id) - return biiu -} - -// SetNillableBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID if the given value is not nil. -func (biiu *BillingInvoiceItemUpdate) SetNillableBillingInvoiceID(id *string) *BillingInvoiceItemUpdate { - if id != nil { - biiu = biiu.SetBillingInvoiceID(*id) - } - return biiu -} - -// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. -func (biiu *BillingInvoiceItemUpdate) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceItemUpdate { - return biiu.SetBillingInvoiceID(b.ID) -} - -// Mutation returns the BillingInvoiceItemMutation object of the builder. -func (biiu *BillingInvoiceItemUpdate) Mutation() *BillingInvoiceItemMutation { - return biiu.mutation -} - -// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. -func (biiu *BillingInvoiceItemUpdate) ClearBillingInvoice() *BillingInvoiceItemUpdate { - biiu.mutation.ClearBillingInvoice() - return biiu -} - -// Save executes the query and returns the number of nodes affected by the update operation. -func (biiu *BillingInvoiceItemUpdate) Save(ctx context.Context) (int, error) { - biiu.defaults() - return withHooks(ctx, biiu.sqlSave, biiu.mutation, biiu.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (biiu *BillingInvoiceItemUpdate) SaveX(ctx context.Context) int { - affected, err := biiu.Save(ctx) - if err != nil { - panic(err) - } - return affected -} - -// Exec executes the query. -func (biiu *BillingInvoiceItemUpdate) Exec(ctx context.Context) error { - _, err := biiu.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (biiu *BillingInvoiceItemUpdate) ExecX(ctx context.Context) { - if err := biiu.Exec(ctx); err != nil { - panic(err) - } -} - -// defaults sets the default values of the builder before save. -func (biiu *BillingInvoiceItemUpdate) defaults() { - if _, ok := biiu.mutation.UpdatedAt(); !ok { - v := billinginvoiceitem.UpdateDefaultUpdatedAt() - biiu.mutation.SetUpdatedAt(v) - } -} - -// check runs all checks and user-defined validators on the builder. -func (biiu *BillingInvoiceItemUpdate) check() error { - if v, ok := biiu.mutation.GetType(); ok { - if err := billinginvoiceitem.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.type": %w`, err)} - } - } - if v, ok := biiu.mutation.Name(); ok { - if err := billinginvoiceitem.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.name": %w`, err)} - } - } - return nil -} - -func (biiu *BillingInvoiceItemUpdate) sqlSave(ctx context.Context) (n int, err error) { - if err := biiu.check(); err != nil { - return n, err - } - _spec := sqlgraph.NewUpdateSpec(billinginvoiceitem.Table, billinginvoiceitem.Columns, sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString)) - if ps := biiu.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := biiu.mutation.UpdatedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldUpdatedAt, field.TypeTime, value) - } - if value, ok := biiu.mutation.DeletedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldDeletedAt, field.TypeTime, value) - } - if biiu.mutation.DeletedAtCleared() { - _spec.ClearField(billinginvoiceitem.FieldDeletedAt, field.TypeTime) - } - if value, ok := biiu.mutation.Metadata(); ok { - _spec.SetField(billinginvoiceitem.FieldMetadata, field.TypeJSON, value) - } - if biiu.mutation.MetadataCleared() { - _spec.ClearField(billinginvoiceitem.FieldMetadata, field.TypeJSON) - } - if value, ok := biiu.mutation.PeriodStart(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodStart, field.TypeTime, value) - } - if value, ok := biiu.mutation.PeriodEnd(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodEnd, field.TypeTime, value) - } - if value, ok := biiu.mutation.InvoiceAt(); ok { - _spec.SetField(billinginvoiceitem.FieldInvoiceAt, field.TypeTime, value) - } - if value, ok := biiu.mutation.GetType(); ok { - _spec.SetField(billinginvoiceitem.FieldType, field.TypeEnum, value) - } - if value, ok := biiu.mutation.Name(); ok { - _spec.SetField(billinginvoiceitem.FieldName, field.TypeString, value) - } - if value, ok := biiu.mutation.Quantity(); ok { - _spec.SetField(billinginvoiceitem.FieldQuantity, field.TypeOther, value) - } - if biiu.mutation.QuantityCleared() { - _spec.ClearField(billinginvoiceitem.FieldQuantity, field.TypeOther) - } - if value, ok := biiu.mutation.UnitPrice(); ok { - _spec.SetField(billinginvoiceitem.FieldUnitPrice, field.TypeOther, value) - } - if value, ok := biiu.mutation.TaxCodeOverride(); ok { - _spec.SetField(billinginvoiceitem.FieldTaxCodeOverride, field.TypeJSON, value) - } - if biiu.mutation.BillingInvoiceCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: true, - Table: billinginvoiceitem.BillingInvoiceTable, - Columns: []string{billinginvoiceitem.BillingInvoiceColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := biiu.mutation.BillingInvoiceIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: true, - Table: billinginvoiceitem.BillingInvoiceTable, - Columns: []string{billinginvoiceitem.BillingInvoiceColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - if n, err = sqlgraph.UpdateNodes(ctx, biiu.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{billinginvoiceitem.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return 0, err - } - biiu.mutation.done = true - return n, nil -} - -// BillingInvoiceItemUpdateOne is the builder for updating a single BillingInvoiceItem entity. -type BillingInvoiceItemUpdateOne struct { - config - fields []string - hooks []Hook - mutation *BillingInvoiceItemMutation -} - -// SetUpdatedAt sets the "updated_at" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetUpdatedAt(t time.Time) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetUpdatedAt(t) - return biiuo -} - -// SetDeletedAt sets the "deleted_at" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetDeletedAt(t time.Time) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetDeletedAt(t) - return biiuo -} - -// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableDeletedAt(t *time.Time) *BillingInvoiceItemUpdateOne { - if t != nil { - biiuo.SetDeletedAt(*t) - } - return biiuo -} - -// ClearDeletedAt clears the value of the "deleted_at" field. -func (biiuo *BillingInvoiceItemUpdateOne) ClearDeletedAt() *BillingInvoiceItemUpdateOne { - biiuo.mutation.ClearDeletedAt() - return biiuo -} - -// SetMetadata sets the "metadata" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetMetadata(m map[string]string) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetMetadata(m) - return biiuo -} - -// ClearMetadata clears the value of the "metadata" field. -func (biiuo *BillingInvoiceItemUpdateOne) ClearMetadata() *BillingInvoiceItemUpdateOne { - biiuo.mutation.ClearMetadata() - return biiuo -} - -// SetInvoiceID sets the "invoice_id" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetInvoiceID(s string) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetInvoiceID(s) - return biiuo -} - -// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableInvoiceID(s *string) *BillingInvoiceItemUpdateOne { - if s != nil { - biiuo.SetInvoiceID(*s) - } - return biiuo -} - -// ClearInvoiceID clears the value of the "invoice_id" field. -func (biiuo *BillingInvoiceItemUpdateOne) ClearInvoiceID() *BillingInvoiceItemUpdateOne { - biiuo.mutation.ClearInvoiceID() - return biiuo -} - -// SetPeriodStart sets the "period_start" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetPeriodStart(t time.Time) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetPeriodStart(t) - return biiuo -} - -// SetNillablePeriodStart sets the "period_start" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillablePeriodStart(t *time.Time) *BillingInvoiceItemUpdateOne { - if t != nil { - biiuo.SetPeriodStart(*t) - } - return biiuo -} - -// SetPeriodEnd sets the "period_end" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetPeriodEnd(t time.Time) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetPeriodEnd(t) - return biiuo -} - -// SetNillablePeriodEnd sets the "period_end" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillablePeriodEnd(t *time.Time) *BillingInvoiceItemUpdateOne { - if t != nil { - biiuo.SetPeriodEnd(*t) - } - return biiuo -} - -// SetInvoiceAt sets the "invoice_at" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetInvoiceAt(t time.Time) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetInvoiceAt(t) - return biiuo -} - -// SetNillableInvoiceAt sets the "invoice_at" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableInvoiceAt(t *time.Time) *BillingInvoiceItemUpdateOne { - if t != nil { - biiuo.SetInvoiceAt(*t) - } - return biiuo -} - -// SetType sets the "type" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetType(bit billingentity.InvoiceItemType) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetType(bit) - return biiuo -} - -// SetNillableType sets the "type" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableType(bit *billingentity.InvoiceItemType) *BillingInvoiceItemUpdateOne { - if bit != nil { - biiuo.SetType(*bit) - } - return biiuo -} - -// SetName sets the "name" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetName(s string) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetName(s) - return biiuo -} - -// SetNillableName sets the "name" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableName(s *string) *BillingInvoiceItemUpdateOne { - if s != nil { - biiuo.SetName(*s) - } - return biiuo -} - -// SetQuantity sets the "quantity" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetQuantity(a) - return biiuo -} - -// SetNillableQuantity sets the "quantity" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceItemUpdateOne { - if a != nil { - biiuo.SetQuantity(*a) - } - return biiuo -} - -// ClearQuantity clears the value of the "quantity" field. -func (biiuo *BillingInvoiceItemUpdateOne) ClearQuantity() *BillingInvoiceItemUpdateOne { - biiuo.mutation.ClearQuantity() - return biiuo -} - -// SetUnitPrice sets the "unit_price" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetUnitPrice(a) - return biiuo -} - -// SetNillableUnitPrice sets the "unit_price" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableUnitPrice(a *alpacadecimal.Decimal) *BillingInvoiceItemUpdateOne { - if a != nil { - biiuo.SetUnitPrice(*a) - } - return biiuo -} - -// SetTaxCodeOverride sets the "tax_code_override" field. -func (biiuo *BillingInvoiceItemUpdateOne) SetTaxCodeOverride(bo billingentity.TaxOverrides) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetTaxCodeOverride(bo) - return biiuo -} - -// SetNillableTaxCodeOverride sets the "tax_code_override" field if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableTaxCodeOverride(bo *billingentity.TaxOverrides) *BillingInvoiceItemUpdateOne { - if bo != nil { - biiuo.SetTaxCodeOverride(*bo) - } - return biiuo -} - -// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. -func (biiuo *BillingInvoiceItemUpdateOne) SetBillingInvoiceID(id string) *BillingInvoiceItemUpdateOne { - biiuo.mutation.SetBillingInvoiceID(id) - return biiuo -} - -// SetNillableBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID if the given value is not nil. -func (biiuo *BillingInvoiceItemUpdateOne) SetNillableBillingInvoiceID(id *string) *BillingInvoiceItemUpdateOne { - if id != nil { - biiuo = biiuo.SetBillingInvoiceID(*id) - } - return biiuo -} - -// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. -func (biiuo *BillingInvoiceItemUpdateOne) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceItemUpdateOne { - return biiuo.SetBillingInvoiceID(b.ID) -} - -// Mutation returns the BillingInvoiceItemMutation object of the builder. -func (biiuo *BillingInvoiceItemUpdateOne) Mutation() *BillingInvoiceItemMutation { - return biiuo.mutation -} - -// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. -func (biiuo *BillingInvoiceItemUpdateOne) ClearBillingInvoice() *BillingInvoiceItemUpdateOne { - biiuo.mutation.ClearBillingInvoice() - return biiuo -} - -// Where appends a list predicates to the BillingInvoiceItemUpdate builder. -func (biiuo *BillingInvoiceItemUpdateOne) Where(ps ...predicate.BillingInvoiceItem) *BillingInvoiceItemUpdateOne { - biiuo.mutation.Where(ps...) - return biiuo -} - -// Select allows selecting one or more fields (columns) of the returned entity. -// The default is selecting all fields defined in the entity schema. -func (biiuo *BillingInvoiceItemUpdateOne) Select(field string, fields ...string) *BillingInvoiceItemUpdateOne { - biiuo.fields = append([]string{field}, fields...) - return biiuo -} - -// Save executes the query and returns the updated BillingInvoiceItem entity. -func (biiuo *BillingInvoiceItemUpdateOne) Save(ctx context.Context) (*BillingInvoiceItem, error) { - biiuo.defaults() - return withHooks(ctx, biiuo.sqlSave, biiuo.mutation, biiuo.hooks) -} - -// SaveX is like Save, but panics if an error occurs. -func (biiuo *BillingInvoiceItemUpdateOne) SaveX(ctx context.Context) *BillingInvoiceItem { - node, err := biiuo.Save(ctx) - if err != nil { - panic(err) - } - return node -} - -// Exec executes the query on the entity. -func (biiuo *BillingInvoiceItemUpdateOne) Exec(ctx context.Context) error { - _, err := biiuo.Save(ctx) - return err -} - -// ExecX is like Exec, but panics if an error occurs. -func (biiuo *BillingInvoiceItemUpdateOne) ExecX(ctx context.Context) { - if err := biiuo.Exec(ctx); err != nil { - panic(err) - } -} - -// defaults sets the default values of the builder before save. -func (biiuo *BillingInvoiceItemUpdateOne) defaults() { - if _, ok := biiuo.mutation.UpdatedAt(); !ok { - v := billinginvoiceitem.UpdateDefaultUpdatedAt() - biiuo.mutation.SetUpdatedAt(v) - } -} - -// check runs all checks and user-defined validators on the builder. -func (biiuo *BillingInvoiceItemUpdateOne) check() error { - if v, ok := biiuo.mutation.GetType(); ok { - if err := billinginvoiceitem.TypeValidator(v); err != nil { - return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.type": %w`, err)} - } - } - if v, ok := biiuo.mutation.Name(); ok { - if err := billinginvoiceitem.NameValidator(v); err != nil { - return &ValidationError{Name: "name", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceItem.name": %w`, err)} - } - } - return nil -} - -func (biiuo *BillingInvoiceItemUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceItem, err error) { - if err := biiuo.check(); err != nil { - return _node, err - } - _spec := sqlgraph.NewUpdateSpec(billinginvoiceitem.Table, billinginvoiceitem.Columns, sqlgraph.NewFieldSpec(billinginvoiceitem.FieldID, field.TypeString)) - id, ok := biiuo.mutation.ID() - if !ok { - return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceItem.id" for update`)} - } - _spec.Node.ID.Value = id - if fields := biiuo.fields; len(fields) > 0 { - _spec.Node.Columns = make([]string, 0, len(fields)) - _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceitem.FieldID) - for _, f := range fields { - if !billinginvoiceitem.ValidColumn(f) { - return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} - } - if f != billinginvoiceitem.FieldID { - _spec.Node.Columns = append(_spec.Node.Columns, f) - } - } - } - if ps := biiuo.mutation.predicates; len(ps) > 0 { - _spec.Predicate = func(selector *sql.Selector) { - for i := range ps { - ps[i](selector) - } - } - } - if value, ok := biiuo.mutation.UpdatedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldUpdatedAt, field.TypeTime, value) - } - if value, ok := biiuo.mutation.DeletedAt(); ok { - _spec.SetField(billinginvoiceitem.FieldDeletedAt, field.TypeTime, value) - } - if biiuo.mutation.DeletedAtCleared() { - _spec.ClearField(billinginvoiceitem.FieldDeletedAt, field.TypeTime) - } - if value, ok := biiuo.mutation.Metadata(); ok { - _spec.SetField(billinginvoiceitem.FieldMetadata, field.TypeJSON, value) - } - if biiuo.mutation.MetadataCleared() { - _spec.ClearField(billinginvoiceitem.FieldMetadata, field.TypeJSON) - } - if value, ok := biiuo.mutation.PeriodStart(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodStart, field.TypeTime, value) - } - if value, ok := biiuo.mutation.PeriodEnd(); ok { - _spec.SetField(billinginvoiceitem.FieldPeriodEnd, field.TypeTime, value) - } - if value, ok := biiuo.mutation.InvoiceAt(); ok { - _spec.SetField(billinginvoiceitem.FieldInvoiceAt, field.TypeTime, value) - } - if value, ok := biiuo.mutation.GetType(); ok { - _spec.SetField(billinginvoiceitem.FieldType, field.TypeEnum, value) - } - if value, ok := biiuo.mutation.Name(); ok { - _spec.SetField(billinginvoiceitem.FieldName, field.TypeString, value) - } - if value, ok := biiuo.mutation.Quantity(); ok { - _spec.SetField(billinginvoiceitem.FieldQuantity, field.TypeOther, value) - } - if biiuo.mutation.QuantityCleared() { - _spec.ClearField(billinginvoiceitem.FieldQuantity, field.TypeOther) - } - if value, ok := biiuo.mutation.UnitPrice(); ok { - _spec.SetField(billinginvoiceitem.FieldUnitPrice, field.TypeOther, value) - } - if value, ok := biiuo.mutation.TaxCodeOverride(); ok { - _spec.SetField(billinginvoiceitem.FieldTaxCodeOverride, field.TypeJSON, value) - } - if biiuo.mutation.BillingInvoiceCleared() { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: true, - Table: billinginvoiceitem.BillingInvoiceTable, - Columns: []string{billinginvoiceitem.BillingInvoiceColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), - }, - } - _spec.Edges.Clear = append(_spec.Edges.Clear, edge) - } - if nodes := biiuo.mutation.BillingInvoiceIDs(); len(nodes) > 0 { - edge := &sqlgraph.EdgeSpec{ - Rel: sqlgraph.M2O, - Inverse: true, - Table: billinginvoiceitem.BillingInvoiceTable, - Columns: []string{billinginvoiceitem.BillingInvoiceColumn}, - Bidi: false, - Target: &sqlgraph.EdgeTarget{ - IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), - }, - } - for _, k := range nodes { - edge.Target.Nodes = append(edge.Target.Nodes, k) - } - _spec.Edges.Add = append(_spec.Edges.Add, edge) - } - _node = &BillingInvoiceItem{config: biiuo.config} - _spec.Assign = _node.assignValues - _spec.ScanValues = _node.scanValues - if err = sqlgraph.UpdateNode(ctx, biiuo.driver, _spec); err != nil { - if _, ok := err.(*sqlgraph.NotFoundError); ok { - err = &NotFoundError{billinginvoiceitem.Label} - } else if sqlgraph.IsConstraintError(err) { - err = &ConstraintError{msg: err.Error(), wrap: err} - } - return nil, err - } - biiuo.mutation.done = true - return _node, nil -} diff --git a/openmeter/ent/db/billinginvoiceitem.go b/openmeter/ent/db/billinginvoiceline.go similarity index 50% rename from openmeter/ent/db/billinginvoiceitem.go rename to openmeter/ent/db/billinginvoiceline.go index 92b288257..125074388 100644 --- a/openmeter/ent/db/billinginvoiceitem.go +++ b/openmeter/ent/db/billinginvoiceline.go @@ -13,29 +13,32 @@ import ( "github.com/alpacahq/alpacadecimal" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" "github.com/openmeterio/openmeter/pkg/currencyx" ) -// BillingInvoiceItem is the model entity for the BillingInvoiceItem schema. -type BillingInvoiceItem struct { +// BillingInvoiceLine is the model entity for the BillingInvoiceLine schema. +type BillingInvoiceLine struct { config `json:"-"` // ID of the ent. ID string `json:"id,omitempty"` // Namespace holds the value of the "namespace" field. Namespace string `json:"namespace,omitempty"` + // Metadata holds the value of the "metadata" field. + Metadata map[string]string `json:"metadata,omitempty"` // CreatedAt holds the value of the "created_at" field. CreatedAt time.Time `json:"created_at,omitempty"` // UpdatedAt holds the value of the "updated_at" field. UpdatedAt time.Time `json:"updated_at,omitempty"` // DeletedAt holds the value of the "deleted_at" field. DeletedAt *time.Time `json:"deleted_at,omitempty"` - // Metadata holds the value of the "metadata" field. - Metadata map[string]string `json:"metadata,omitempty"` + // Name holds the value of the "name" field. + Name string `json:"name,omitempty"` + // Description holds the value of the "description" field. + Description *string `json:"description,omitempty"` // InvoiceID holds the value of the "invoice_id" field. - InvoiceID *string `json:"invoice_id,omitempty"` - // CustomerID holds the value of the "customer_id" field. - CustomerID string `json:"customer_id,omitempty"` + InvoiceID string `json:"invoice_id,omitempty"` // PeriodStart holds the value of the "period_start" field. PeriodStart time.Time `json:"period_start,omitempty"` // PeriodEnd holds the value of the "period_end" field. @@ -43,35 +46,36 @@ type BillingInvoiceItem struct { // InvoiceAt holds the value of the "invoice_at" field. InvoiceAt time.Time `json:"invoice_at,omitempty"` // Type holds the value of the "type" field. - Type billingentity.InvoiceItemType `json:"type,omitempty"` - // Name holds the value of the "name" field. - Name string `json:"name,omitempty"` - // Quantity holds the value of the "quantity" field. - Quantity *alpacadecimal.Decimal `json:"quantity,omitempty"` - // UnitPrice holds the value of the "unit_price" field. - UnitPrice alpacadecimal.Decimal `json:"unit_price,omitempty"` + Type billingentity.InvoiceLineType `json:"type,omitempty"` + // Status holds the value of the "status" field. + Status billingentity.InvoiceLineStatus `json:"status,omitempty"` // Currency holds the value of the "currency" field. Currency currencyx.Code `json:"currency,omitempty"` - // TaxCodeOverride holds the value of the "tax_code_override" field. - TaxCodeOverride billingentity.TaxOverrides `json:"tax_code_override,omitempty"` + // Quantity holds the value of the "quantity" field. + Quantity *alpacadecimal.Decimal `json:"quantity,omitempty"` + // TaxOverrides holds the value of the "tax_overrides" field. + TaxOverrides *billingentity.TaxOverrides `json:"tax_overrides,omitempty"` // Edges holds the relations/edges for other nodes in the graph. - // The values are being populated by the BillingInvoiceItemQuery when eager-loading is set. - Edges BillingInvoiceItemEdges `json:"edges"` - selectValues sql.SelectValues + // The values are being populated by the BillingInvoiceLineQuery when eager-loading is set. + Edges BillingInvoiceLineEdges `json:"edges"` + manual_line_config_id *string + selectValues sql.SelectValues } -// BillingInvoiceItemEdges holds the relations/edges for other nodes in the graph. -type BillingInvoiceItemEdges struct { +// BillingInvoiceLineEdges holds the relations/edges for other nodes in the graph. +type BillingInvoiceLineEdges struct { // BillingInvoice holds the value of the billing_invoice edge. BillingInvoice *BillingInvoice `json:"billing_invoice,omitempty"` + // BillingInvoiceManualLines holds the value of the billing_invoice_manual_lines edge. + BillingInvoiceManualLines *BillingInvoiceManualLineConfig `json:"billing_invoice_manual_lines,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [1]bool + loadedTypes [2]bool } // BillingInvoiceOrErr returns the BillingInvoice value or an error if the edge // was not loaded in eager-loading, or loaded but was not found. -func (e BillingInvoiceItemEdges) BillingInvoiceOrErr() (*BillingInvoice, error) { +func (e BillingInvoiceLineEdges) BillingInvoiceOrErr() (*BillingInvoice, error) { if e.BillingInvoice != nil { return e.BillingInvoice, nil } else if e.loadedTypes[0] { @@ -80,21 +84,32 @@ func (e BillingInvoiceItemEdges) BillingInvoiceOrErr() (*BillingInvoice, error) return nil, &NotLoadedError{edge: "billing_invoice"} } +// BillingInvoiceManualLinesOrErr returns the BillingInvoiceManualLines value or an error if the edge +// was not loaded in eager-loading, or loaded but was not found. +func (e BillingInvoiceLineEdges) BillingInvoiceManualLinesOrErr() (*BillingInvoiceManualLineConfig, error) { + if e.BillingInvoiceManualLines != nil { + return e.BillingInvoiceManualLines, nil + } else if e.loadedTypes[1] { + return nil, &NotFoundError{label: billinginvoicemanuallineconfig.Label} + } + return nil, &NotLoadedError{edge: "billing_invoice_manual_lines"} +} + // scanValues returns the types for scanning values from sql.Rows. -func (*BillingInvoiceItem) scanValues(columns []string) ([]any, error) { +func (*BillingInvoiceLine) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) for i := range columns { switch columns[i] { - case billinginvoiceitem.FieldQuantity: + case billinginvoiceline.FieldQuantity: values[i] = &sql.NullScanner{S: new(alpacadecimal.Decimal)} - case billinginvoiceitem.FieldMetadata, billinginvoiceitem.FieldTaxCodeOverride: + case billinginvoiceline.FieldMetadata, billinginvoiceline.FieldTaxOverrides: values[i] = new([]byte) - case billinginvoiceitem.FieldUnitPrice: - values[i] = new(alpacadecimal.Decimal) - case billinginvoiceitem.FieldID, billinginvoiceitem.FieldNamespace, billinginvoiceitem.FieldInvoiceID, billinginvoiceitem.FieldCustomerID, billinginvoiceitem.FieldType, billinginvoiceitem.FieldName, billinginvoiceitem.FieldCurrency: + case billinginvoiceline.FieldID, billinginvoiceline.FieldNamespace, billinginvoiceline.FieldName, billinginvoiceline.FieldDescription, billinginvoiceline.FieldInvoiceID, billinginvoiceline.FieldType, billinginvoiceline.FieldStatus, billinginvoiceline.FieldCurrency: values[i] = new(sql.NullString) - case billinginvoiceitem.FieldCreatedAt, billinginvoiceitem.FieldUpdatedAt, billinginvoiceitem.FieldDeletedAt, billinginvoiceitem.FieldPeriodStart, billinginvoiceitem.FieldPeriodEnd, billinginvoiceitem.FieldInvoiceAt: + case billinginvoiceline.FieldCreatedAt, billinginvoiceline.FieldUpdatedAt, billinginvoiceline.FieldDeletedAt, billinginvoiceline.FieldPeriodStart, billinginvoiceline.FieldPeriodEnd, billinginvoiceline.FieldInvoiceAt: values[i] = new(sql.NullTime) + case billinginvoiceline.ForeignKeys[0]: // manual_line_config_id + values[i] = new(sql.NullString) default: values[i] = new(sql.UnknownType) } @@ -103,219 +118,231 @@ func (*BillingInvoiceItem) scanValues(columns []string) ([]any, error) { } // assignValues assigns the values that were returned from sql.Rows (after scanning) -// to the BillingInvoiceItem fields. -func (bii *BillingInvoiceItem) assignValues(columns []string, values []any) error { +// to the BillingInvoiceLine fields. +func (bil *BillingInvoiceLine) assignValues(columns []string, values []any) error { if m, n := len(values), len(columns); m < n { return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) } for i := range columns { switch columns[i] { - case billinginvoiceitem.FieldID: + case billinginvoiceline.FieldID: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field id", values[i]) } else if value.Valid { - bii.ID = value.String + bil.ID = value.String } - case billinginvoiceitem.FieldNamespace: + case billinginvoiceline.FieldNamespace: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field namespace", values[i]) } else if value.Valid { - bii.Namespace = value.String + bil.Namespace = value.String + } + case billinginvoiceline.FieldMetadata: + if value, ok := values[i].(*[]byte); !ok { + return fmt.Errorf("unexpected type %T for field metadata", values[i]) + } else if value != nil && len(*value) > 0 { + if err := json.Unmarshal(*value, &bil.Metadata); err != nil { + return fmt.Errorf("unmarshal field metadata: %w", err) + } } - case billinginvoiceitem.FieldCreatedAt: + case billinginvoiceline.FieldCreatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field created_at", values[i]) } else if value.Valid { - bii.CreatedAt = value.Time + bil.CreatedAt = value.Time } - case billinginvoiceitem.FieldUpdatedAt: + case billinginvoiceline.FieldUpdatedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field updated_at", values[i]) } else if value.Valid { - bii.UpdatedAt = value.Time + bil.UpdatedAt = value.Time } - case billinginvoiceitem.FieldDeletedAt: + case billinginvoiceline.FieldDeletedAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field deleted_at", values[i]) } else if value.Valid { - bii.DeletedAt = new(time.Time) - *bii.DeletedAt = value.Time + bil.DeletedAt = new(time.Time) + *bil.DeletedAt = value.Time } - case billinginvoiceitem.FieldMetadata: - if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field metadata", values[i]) - } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &bii.Metadata); err != nil { - return fmt.Errorf("unmarshal field metadata: %w", err) - } + case billinginvoiceline.FieldName: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field name", values[i]) + } else if value.Valid { + bil.Name = value.String } - case billinginvoiceitem.FieldInvoiceID: + case billinginvoiceline.FieldDescription: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field invoice_id", values[i]) + return fmt.Errorf("unexpected type %T for field description", values[i]) } else if value.Valid { - bii.InvoiceID = new(string) - *bii.InvoiceID = value.String + bil.Description = new(string) + *bil.Description = value.String } - case billinginvoiceitem.FieldCustomerID: + case billinginvoiceline.FieldInvoiceID: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field customer_id", values[i]) + return fmt.Errorf("unexpected type %T for field invoice_id", values[i]) } else if value.Valid { - bii.CustomerID = value.String + bil.InvoiceID = value.String } - case billinginvoiceitem.FieldPeriodStart: + case billinginvoiceline.FieldPeriodStart: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field period_start", values[i]) } else if value.Valid { - bii.PeriodStart = value.Time + bil.PeriodStart = value.Time } - case billinginvoiceitem.FieldPeriodEnd: + case billinginvoiceline.FieldPeriodEnd: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field period_end", values[i]) } else if value.Valid { - bii.PeriodEnd = value.Time + bil.PeriodEnd = value.Time } - case billinginvoiceitem.FieldInvoiceAt: + case billinginvoiceline.FieldInvoiceAt: if value, ok := values[i].(*sql.NullTime); !ok { return fmt.Errorf("unexpected type %T for field invoice_at", values[i]) } else if value.Valid { - bii.InvoiceAt = value.Time + bil.InvoiceAt = value.Time } - case billinginvoiceitem.FieldType: + case billinginvoiceline.FieldType: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field type", values[i]) } else if value.Valid { - bii.Type = billingentity.InvoiceItemType(value.String) + bil.Type = billingentity.InvoiceLineType(value.String) } - case billinginvoiceitem.FieldName: + case billinginvoiceline.FieldStatus: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field name", values[i]) + return fmt.Errorf("unexpected type %T for field status", values[i]) } else if value.Valid { - bii.Name = value.String + bil.Status = billingentity.InvoiceLineStatus(value.String) } - case billinginvoiceitem.FieldQuantity: - if value, ok := values[i].(*sql.NullScanner); !ok { - return fmt.Errorf("unexpected type %T for field quantity", values[i]) - } else if value.Valid { - bii.Quantity = new(alpacadecimal.Decimal) - *bii.Quantity = *value.S.(*alpacadecimal.Decimal) - } - case billinginvoiceitem.FieldUnitPrice: - if value, ok := values[i].(*alpacadecimal.Decimal); !ok { - return fmt.Errorf("unexpected type %T for field unit_price", values[i]) - } else if value != nil { - bii.UnitPrice = *value - } - case billinginvoiceitem.FieldCurrency: + case billinginvoiceline.FieldCurrency: if value, ok := values[i].(*sql.NullString); !ok { return fmt.Errorf("unexpected type %T for field currency", values[i]) } else if value.Valid { - bii.Currency = currencyx.Code(value.String) + bil.Currency = currencyx.Code(value.String) } - case billinginvoiceitem.FieldTaxCodeOverride: + case billinginvoiceline.FieldQuantity: + if value, ok := values[i].(*sql.NullScanner); !ok { + return fmt.Errorf("unexpected type %T for field quantity", values[i]) + } else if value.Valid { + bil.Quantity = new(alpacadecimal.Decimal) + *bil.Quantity = *value.S.(*alpacadecimal.Decimal) + } + case billinginvoiceline.FieldTaxOverrides: if value, ok := values[i].(*[]byte); !ok { - return fmt.Errorf("unexpected type %T for field tax_code_override", values[i]) + return fmt.Errorf("unexpected type %T for field tax_overrides", values[i]) } else if value != nil && len(*value) > 0 { - if err := json.Unmarshal(*value, &bii.TaxCodeOverride); err != nil { - return fmt.Errorf("unmarshal field tax_code_override: %w", err) + if err := json.Unmarshal(*value, &bil.TaxOverrides); err != nil { + return fmt.Errorf("unmarshal field tax_overrides: %w", err) } } + case billinginvoiceline.ForeignKeys[0]: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field manual_line_config_id", values[i]) + } else if value.Valid { + bil.manual_line_config_id = new(string) + *bil.manual_line_config_id = value.String + } default: - bii.selectValues.Set(columns[i], values[i]) + bil.selectValues.Set(columns[i], values[i]) } } return nil } -// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceItem. +// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceLine. // This includes values selected through modifiers, order, etc. -func (bii *BillingInvoiceItem) Value(name string) (ent.Value, error) { - return bii.selectValues.Get(name) +func (bil *BillingInvoiceLine) Value(name string) (ent.Value, error) { + return bil.selectValues.Get(name) +} + +// QueryBillingInvoice queries the "billing_invoice" edge of the BillingInvoiceLine entity. +func (bil *BillingInvoiceLine) QueryBillingInvoice() *BillingInvoiceQuery { + return NewBillingInvoiceLineClient(bil.config).QueryBillingInvoice(bil) } -// QueryBillingInvoice queries the "billing_invoice" edge of the BillingInvoiceItem entity. -func (bii *BillingInvoiceItem) QueryBillingInvoice() *BillingInvoiceQuery { - return NewBillingInvoiceItemClient(bii.config).QueryBillingInvoice(bii) +// QueryBillingInvoiceManualLines queries the "billing_invoice_manual_lines" edge of the BillingInvoiceLine entity. +func (bil *BillingInvoiceLine) QueryBillingInvoiceManualLines() *BillingInvoiceManualLineConfigQuery { + return NewBillingInvoiceLineClient(bil.config).QueryBillingInvoiceManualLines(bil) } -// Update returns a builder for updating this BillingInvoiceItem. -// Note that you need to call BillingInvoiceItem.Unwrap() before calling this method if this BillingInvoiceItem +// Update returns a builder for updating this BillingInvoiceLine. +// Note that you need to call BillingInvoiceLine.Unwrap() before calling this method if this BillingInvoiceLine // was returned from a transaction, and the transaction was committed or rolled back. -func (bii *BillingInvoiceItem) Update() *BillingInvoiceItemUpdateOne { - return NewBillingInvoiceItemClient(bii.config).UpdateOne(bii) +func (bil *BillingInvoiceLine) Update() *BillingInvoiceLineUpdateOne { + return NewBillingInvoiceLineClient(bil.config).UpdateOne(bil) } -// Unwrap unwraps the BillingInvoiceItem entity that was returned from a transaction after it was closed, +// Unwrap unwraps the BillingInvoiceLine entity that was returned from a transaction after it was closed, // so that all future queries will be executed through the driver which created the transaction. -func (bii *BillingInvoiceItem) Unwrap() *BillingInvoiceItem { - _tx, ok := bii.config.driver.(*txDriver) +func (bil *BillingInvoiceLine) Unwrap() *BillingInvoiceLine { + _tx, ok := bil.config.driver.(*txDriver) if !ok { - panic("db: BillingInvoiceItem is not a transactional entity") + panic("db: BillingInvoiceLine is not a transactional entity") } - bii.config.driver = _tx.drv - return bii + bil.config.driver = _tx.drv + return bil } // String implements the fmt.Stringer. -func (bii *BillingInvoiceItem) String() string { +func (bil *BillingInvoiceLine) String() string { var builder strings.Builder - builder.WriteString("BillingInvoiceItem(") - builder.WriteString(fmt.Sprintf("id=%v, ", bii.ID)) + builder.WriteString("BillingInvoiceLine(") + builder.WriteString(fmt.Sprintf("id=%v, ", bil.ID)) builder.WriteString("namespace=") - builder.WriteString(bii.Namespace) + builder.WriteString(bil.Namespace) + builder.WriteString(", ") + builder.WriteString("metadata=") + builder.WriteString(fmt.Sprintf("%v", bil.Metadata)) builder.WriteString(", ") builder.WriteString("created_at=") - builder.WriteString(bii.CreatedAt.Format(time.ANSIC)) + builder.WriteString(bil.CreatedAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("updated_at=") - builder.WriteString(bii.UpdatedAt.Format(time.ANSIC)) + builder.WriteString(bil.UpdatedAt.Format(time.ANSIC)) builder.WriteString(", ") - if v := bii.DeletedAt; v != nil { + if v := bil.DeletedAt; v != nil { builder.WriteString("deleted_at=") builder.WriteString(v.Format(time.ANSIC)) } builder.WriteString(", ") - builder.WriteString("metadata=") - builder.WriteString(fmt.Sprintf("%v", bii.Metadata)) + builder.WriteString("name=") + builder.WriteString(bil.Name) builder.WriteString(", ") - if v := bii.InvoiceID; v != nil { - builder.WriteString("invoice_id=") + if v := bil.Description; v != nil { + builder.WriteString("description=") builder.WriteString(*v) } builder.WriteString(", ") - builder.WriteString("customer_id=") - builder.WriteString(bii.CustomerID) + builder.WriteString("invoice_id=") + builder.WriteString(bil.InvoiceID) builder.WriteString(", ") builder.WriteString("period_start=") - builder.WriteString(bii.PeriodStart.Format(time.ANSIC)) + builder.WriteString(bil.PeriodStart.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("period_end=") - builder.WriteString(bii.PeriodEnd.Format(time.ANSIC)) + builder.WriteString(bil.PeriodEnd.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("invoice_at=") - builder.WriteString(bii.InvoiceAt.Format(time.ANSIC)) + builder.WriteString(bil.InvoiceAt.Format(time.ANSIC)) builder.WriteString(", ") builder.WriteString("type=") - builder.WriteString(fmt.Sprintf("%v", bii.Type)) + builder.WriteString(fmt.Sprintf("%v", bil.Type)) builder.WriteString(", ") - builder.WriteString("name=") - builder.WriteString(bii.Name) + builder.WriteString("status=") + builder.WriteString(fmt.Sprintf("%v", bil.Status)) + builder.WriteString(", ") + builder.WriteString("currency=") + builder.WriteString(fmt.Sprintf("%v", bil.Currency)) builder.WriteString(", ") - if v := bii.Quantity; v != nil { + if v := bil.Quantity; v != nil { builder.WriteString("quantity=") builder.WriteString(fmt.Sprintf("%v", *v)) } builder.WriteString(", ") - builder.WriteString("unit_price=") - builder.WriteString(fmt.Sprintf("%v", bii.UnitPrice)) - builder.WriteString(", ") - builder.WriteString("currency=") - builder.WriteString(fmt.Sprintf("%v", bii.Currency)) - builder.WriteString(", ") - builder.WriteString("tax_code_override=") - builder.WriteString(fmt.Sprintf("%v", bii.TaxCodeOverride)) + builder.WriteString("tax_overrides=") + builder.WriteString(fmt.Sprintf("%v", bil.TaxOverrides)) builder.WriteByte(')') return builder.String() } -// BillingInvoiceItems is a parsable slice of BillingInvoiceItem. -type BillingInvoiceItems []*BillingInvoiceItem +// BillingInvoiceLines is a parsable slice of BillingInvoiceLine. +type BillingInvoiceLines []*BillingInvoiceLine diff --git a/openmeter/ent/db/billinginvoiceitem/billinginvoiceitem.go b/openmeter/ent/db/billinginvoiceline/billinginvoiceline.go similarity index 66% rename from openmeter/ent/db/billinginvoiceitem/billinginvoiceitem.go rename to openmeter/ent/db/billinginvoiceline/billinginvoiceline.go index 7cd1061f8..7d48882dd 100644 --- a/openmeter/ent/db/billinginvoiceitem/billinginvoiceitem.go +++ b/openmeter/ent/db/billinginvoiceline/billinginvoiceline.go @@ -1,6 +1,6 @@ // Code generated by ent, DO NOT EDIT. -package billinginvoiceitem +package billinginvoiceline import ( "fmt" @@ -12,24 +12,26 @@ import ( ) const ( - // Label holds the string label denoting the billinginvoiceitem type in the database. - Label = "billing_invoice_item" + // Label holds the string label denoting the billinginvoiceline type in the database. + Label = "billing_invoice_line" // FieldID holds the string denoting the id field in the database. FieldID = "id" // FieldNamespace holds the string denoting the namespace field in the database. FieldNamespace = "namespace" + // FieldMetadata holds the string denoting the metadata field in the database. + FieldMetadata = "metadata" // FieldCreatedAt holds the string denoting the created_at field in the database. FieldCreatedAt = "created_at" // FieldUpdatedAt holds the string denoting the updated_at field in the database. FieldUpdatedAt = "updated_at" // FieldDeletedAt holds the string denoting the deleted_at field in the database. FieldDeletedAt = "deleted_at" - // FieldMetadata holds the string denoting the metadata field in the database. - FieldMetadata = "metadata" + // FieldName holds the string denoting the name field in the database. + FieldName = "name" + // FieldDescription holds the string denoting the description field in the database. + FieldDescription = "description" // FieldInvoiceID holds the string denoting the invoice_id field in the database. FieldInvoiceID = "invoice_id" - // FieldCustomerID holds the string denoting the customer_id field in the database. - FieldCustomerID = "customer_id" // FieldPeriodStart holds the string denoting the period_start field in the database. FieldPeriodStart = "period_start" // FieldPeriodEnd holds the string denoting the period_end field in the database. @@ -38,48 +40,61 @@ const ( FieldInvoiceAt = "invoice_at" // FieldType holds the string denoting the type field in the database. FieldType = "type" - // FieldName holds the string denoting the name field in the database. - FieldName = "name" - // FieldQuantity holds the string denoting the quantity field in the database. - FieldQuantity = "quantity" - // FieldUnitPrice holds the string denoting the unit_price field in the database. - FieldUnitPrice = "unit_price" + // FieldStatus holds the string denoting the status field in the database. + FieldStatus = "status" // FieldCurrency holds the string denoting the currency field in the database. FieldCurrency = "currency" - // FieldTaxCodeOverride holds the string denoting the tax_code_override field in the database. - FieldTaxCodeOverride = "tax_code_override" + // FieldQuantity holds the string denoting the quantity field in the database. + FieldQuantity = "quantity" + // FieldTaxOverrides holds the string denoting the tax_overrides field in the database. + FieldTaxOverrides = "tax_overrides" // EdgeBillingInvoice holds the string denoting the billing_invoice edge name in mutations. EdgeBillingInvoice = "billing_invoice" - // Table holds the table name of the billinginvoiceitem in the database. - Table = "billing_invoice_items" + // EdgeBillingInvoiceManualLines holds the string denoting the billing_invoice_manual_lines edge name in mutations. + EdgeBillingInvoiceManualLines = "billing_invoice_manual_lines" + // Table holds the table name of the billinginvoiceline in the database. + Table = "billing_invoice_lines" // BillingInvoiceTable is the table that holds the billing_invoice relation/edge. - BillingInvoiceTable = "billing_invoice_items" + BillingInvoiceTable = "billing_invoice_lines" // BillingInvoiceInverseTable is the table name for the BillingInvoice entity. // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. BillingInvoiceInverseTable = "billing_invoices" // BillingInvoiceColumn is the table column denoting the billing_invoice relation/edge. BillingInvoiceColumn = "invoice_id" + // BillingInvoiceManualLinesTable is the table that holds the billing_invoice_manual_lines relation/edge. + BillingInvoiceManualLinesTable = "billing_invoice_lines" + // BillingInvoiceManualLinesInverseTable is the table name for the BillingInvoiceManualLineConfig entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoicemanuallineconfig" package. + BillingInvoiceManualLinesInverseTable = "billing_invoice_manual_line_configs" + // BillingInvoiceManualLinesColumn is the table column denoting the billing_invoice_manual_lines relation/edge. + BillingInvoiceManualLinesColumn = "manual_line_config_id" ) -// Columns holds all SQL columns for billinginvoiceitem fields. +// Columns holds all SQL columns for billinginvoiceline fields. var Columns = []string{ FieldID, FieldNamespace, + FieldMetadata, FieldCreatedAt, FieldUpdatedAt, FieldDeletedAt, - FieldMetadata, + FieldName, + FieldDescription, FieldInvoiceID, - FieldCustomerID, FieldPeriodStart, FieldPeriodEnd, FieldInvoiceAt, FieldType, - FieldName, - FieldQuantity, - FieldUnitPrice, + FieldStatus, FieldCurrency, - FieldTaxCodeOverride, + FieldQuantity, + FieldTaxOverrides, +} + +// ForeignKeys holds the SQL foreign-keys that are owned by the "billing_invoice_lines" +// table and are not defined as standalone fields in the schema. +var ForeignKeys = []string{ + "manual_line_config_id", } // ValidColumn reports if the column name is valid (part of the table columns). @@ -89,6 +104,11 @@ func ValidColumn(column string) bool { return true } } + for i := range ForeignKeys { + if column == ForeignKeys[i] { + return true + } + } return false } @@ -101,10 +121,6 @@ var ( DefaultUpdatedAt func() time.Time // UpdateDefaultUpdatedAt holds the default value on update for the "updated_at" field. UpdateDefaultUpdatedAt func() time.Time - // CustomerIDValidator is a validator for the "customer_id" field. It is called by the builders before save. - CustomerIDValidator func(string) error - // NameValidator is a validator for the "name" field. It is called by the builders before save. - NameValidator func(string) error // CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. CurrencyValidator func(string) error // DefaultID holds the default value on creation for the "id" field. @@ -112,16 +128,26 @@ var ( ) // TypeValidator is a validator for the "type" field enum values. It is called by the builders before save. -func TypeValidator(_type billingentity.InvoiceItemType) error { +func TypeValidator(_type billingentity.InvoiceLineType) error { switch _type { - case "static", "usage": + case "manual_fee", "flat_fee", "usage_based": return nil default: - return fmt.Errorf("billinginvoiceitem: invalid enum value for type field: %q", _type) + return fmt.Errorf("billinginvoiceline: invalid enum value for type field: %q", _type) } } -// OrderOption defines the ordering options for the BillingInvoiceItem queries. +// StatusValidator is a validator for the "status" field enum values. It is called by the builders before save. +func StatusValidator(s billingentity.InvoiceLineStatus) error { + switch s { + case "valid", "split": + return nil + default: + return fmt.Errorf("billinginvoiceline: invalid enum value for status field: %q", s) + } +} + +// OrderOption defines the ordering options for the BillingInvoiceLine queries. type OrderOption func(*sql.Selector) // ByID orders the results by the id field. @@ -149,16 +175,21 @@ func ByDeletedAt(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldDeletedAt, opts...).ToFunc() } +// ByName orders the results by the name field. +func ByName(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldName, opts...).ToFunc() +} + +// ByDescription orders the results by the description field. +func ByDescription(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldDescription, opts...).ToFunc() +} + // ByInvoiceID orders the results by the invoice_id field. func ByInvoiceID(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldInvoiceID, opts...).ToFunc() } -// ByCustomerID orders the results by the customer_id field. -func ByCustomerID(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldCustomerID, opts...).ToFunc() -} - // ByPeriodStart orders the results by the period_start field. func ByPeriodStart(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldPeriodStart, opts...).ToFunc() @@ -179,19 +210,9 @@ func ByType(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldType, opts...).ToFunc() } -// ByName orders the results by the name field. -func ByName(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldName, opts...).ToFunc() -} - -// ByQuantity orders the results by the quantity field. -func ByQuantity(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldQuantity, opts...).ToFunc() -} - -// ByUnitPrice orders the results by the unit_price field. -func ByUnitPrice(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldUnitPrice, opts...).ToFunc() +// ByStatus orders the results by the status field. +func ByStatus(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldStatus, opts...).ToFunc() } // ByCurrency orders the results by the currency field. @@ -199,12 +220,24 @@ func ByCurrency(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCurrency, opts...).ToFunc() } +// ByQuantity orders the results by the quantity field. +func ByQuantity(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldQuantity, opts...).ToFunc() +} + // ByBillingInvoiceField orders the results by billing_invoice field. func ByBillingInvoiceField(field string, opts ...sql.OrderTermOption) OrderOption { return func(s *sql.Selector) { sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceStep(), sql.OrderByField(field, opts...)) } } + +// ByBillingInvoiceManualLinesField orders the results by billing_invoice_manual_lines field. +func ByBillingInvoiceManualLinesField(field string, opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceManualLinesStep(), sql.OrderByField(field, opts...)) + } +} func newBillingInvoiceStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -212,3 +245,10 @@ func newBillingInvoiceStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn), ) } +func newBillingInvoiceManualLinesStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingInvoiceManualLinesInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, BillingInvoiceManualLinesTable, BillingInvoiceManualLinesColumn), + ) +} diff --git a/openmeter/ent/db/billinginvoiceline/where.go b/openmeter/ent/db/billinginvoiceline/where.go new file mode 100644 index 000000000..7b52876e9 --- /dev/null +++ b/openmeter/ent/db/billinginvoiceline/where.go @@ -0,0 +1,925 @@ +// Code generated by ent, DO NOT EDIT. + +package billinginvoiceline + +import ( + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "github.com/alpacahq/alpacadecimal" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" + "github.com/openmeterio/openmeter/pkg/currencyx" +) + +// ID filters vertices based on their ID field. +func ID(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldID, id)) +} + +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldID, id)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldNamespace, v)) +} + +// CreatedAt applies equality check predicate on the "created_at" field. It's identical to CreatedAtEQ. +func CreatedAt(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldCreatedAt, v)) +} + +// UpdatedAt applies equality check predicate on the "updated_at" field. It's identical to UpdatedAtEQ. +func UpdatedAt(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldUpdatedAt, v)) +} + +// DeletedAt applies equality check predicate on the "deleted_at" field. It's identical to DeletedAtEQ. +func DeletedAt(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldDeletedAt, v)) +} + +// Name applies equality check predicate on the "name" field. It's identical to NameEQ. +func Name(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldName, v)) +} + +// Description applies equality check predicate on the "description" field. It's identical to DescriptionEQ. +func Description(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldDescription, v)) +} + +// InvoiceID applies equality check predicate on the "invoice_id" field. It's identical to InvoiceIDEQ. +func InvoiceID(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldInvoiceID, v)) +} + +// PeriodStart applies equality check predicate on the "period_start" field. It's identical to PeriodStartEQ. +func PeriodStart(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldPeriodStart, v)) +} + +// PeriodEnd applies equality check predicate on the "period_end" field. It's identical to PeriodEndEQ. +func PeriodEnd(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldPeriodEnd, v)) +} + +// InvoiceAt applies equality check predicate on the "invoice_at" field. It's identical to InvoiceAtEQ. +func InvoiceAt(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldInvoiceAt, v)) +} + +// Currency applies equality check predicate on the "currency" field. It's identical to CurrencyEQ. +func Currency(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldCurrency, vc)) +} + +// Quantity applies equality check predicate on the "quantity" field. It's identical to QuantityEQ. +func Quantity(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldQuantity, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldNamespace, v)) +} + +// MetadataIsNil applies the IsNil predicate on the "metadata" field. +func MetadataIsNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIsNull(FieldMetadata)) +} + +// MetadataNotNil applies the NotNil predicate on the "metadata" field. +func MetadataNotNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotNull(FieldMetadata)) +} + +// CreatedAtEQ applies the EQ predicate on the "created_at" field. +func CreatedAtEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldCreatedAt, v)) +} + +// CreatedAtNEQ applies the NEQ predicate on the "created_at" field. +func CreatedAtNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldCreatedAt, v)) +} + +// CreatedAtIn applies the In predicate on the "created_at" field. +func CreatedAtIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldCreatedAt, vs...)) +} + +// CreatedAtNotIn applies the NotIn predicate on the "created_at" field. +func CreatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldCreatedAt, vs...)) +} + +// CreatedAtGT applies the GT predicate on the "created_at" field. +func CreatedAtGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldCreatedAt, v)) +} + +// CreatedAtGTE applies the GTE predicate on the "created_at" field. +func CreatedAtGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldCreatedAt, v)) +} + +// CreatedAtLT applies the LT predicate on the "created_at" field. +func CreatedAtLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldCreatedAt, v)) +} + +// CreatedAtLTE applies the LTE predicate on the "created_at" field. +func CreatedAtLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldCreatedAt, v)) +} + +// UpdatedAtEQ applies the EQ predicate on the "updated_at" field. +func UpdatedAtEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtNEQ applies the NEQ predicate on the "updated_at" field. +func UpdatedAtNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldUpdatedAt, v)) +} + +// UpdatedAtIn applies the In predicate on the "updated_at" field. +func UpdatedAtIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtNotIn applies the NotIn predicate on the "updated_at" field. +func UpdatedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldUpdatedAt, vs...)) +} + +// UpdatedAtGT applies the GT predicate on the "updated_at" field. +func UpdatedAtGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldUpdatedAt, v)) +} + +// UpdatedAtGTE applies the GTE predicate on the "updated_at" field. +func UpdatedAtGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldUpdatedAt, v)) +} + +// UpdatedAtLT applies the LT predicate on the "updated_at" field. +func UpdatedAtLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldUpdatedAt, v)) +} + +// UpdatedAtLTE applies the LTE predicate on the "updated_at" field. +func UpdatedAtLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldUpdatedAt, v)) +} + +// DeletedAtEQ applies the EQ predicate on the "deleted_at" field. +func DeletedAtEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldDeletedAt, v)) +} + +// DeletedAtNEQ applies the NEQ predicate on the "deleted_at" field. +func DeletedAtNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldDeletedAt, v)) +} + +// DeletedAtIn applies the In predicate on the "deleted_at" field. +func DeletedAtIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldDeletedAt, vs...)) +} + +// DeletedAtNotIn applies the NotIn predicate on the "deleted_at" field. +func DeletedAtNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldDeletedAt, vs...)) +} + +// DeletedAtGT applies the GT predicate on the "deleted_at" field. +func DeletedAtGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldDeletedAt, v)) +} + +// DeletedAtGTE applies the GTE predicate on the "deleted_at" field. +func DeletedAtGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldDeletedAt, v)) +} + +// DeletedAtLT applies the LT predicate on the "deleted_at" field. +func DeletedAtLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldDeletedAt, v)) +} + +// DeletedAtLTE applies the LTE predicate on the "deleted_at" field. +func DeletedAtLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldDeletedAt, v)) +} + +// DeletedAtIsNil applies the IsNil predicate on the "deleted_at" field. +func DeletedAtIsNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIsNull(FieldDeletedAt)) +} + +// DeletedAtNotNil applies the NotNil predicate on the "deleted_at" field. +func DeletedAtNotNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotNull(FieldDeletedAt)) +} + +// NameEQ applies the EQ predicate on the "name" field. +func NameEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldName, v)) +} + +// NameNEQ applies the NEQ predicate on the "name" field. +func NameNEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldName, v)) +} + +// NameIn applies the In predicate on the "name" field. +func NameIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldName, vs...)) +} + +// NameNotIn applies the NotIn predicate on the "name" field. +func NameNotIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldName, vs...)) +} + +// NameGT applies the GT predicate on the "name" field. +func NameGT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldName, v)) +} + +// NameGTE applies the GTE predicate on the "name" field. +func NameGTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldName, v)) +} + +// NameLT applies the LT predicate on the "name" field. +func NameLT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldName, v)) +} + +// NameLTE applies the LTE predicate on the "name" field. +func NameLTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldName, v)) +} + +// NameContains applies the Contains predicate on the "name" field. +func NameContains(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContains(FieldName, v)) +} + +// NameHasPrefix applies the HasPrefix predicate on the "name" field. +func NameHasPrefix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasPrefix(FieldName, v)) +} + +// NameHasSuffix applies the HasSuffix predicate on the "name" field. +func NameHasSuffix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasSuffix(FieldName, v)) +} + +// NameEqualFold applies the EqualFold predicate on the "name" field. +func NameEqualFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldName, v)) +} + +// NameContainsFold applies the ContainsFold predicate on the "name" field. +func NameContainsFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldName, v)) +} + +// DescriptionEQ applies the EQ predicate on the "description" field. +func DescriptionEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldDescription, v)) +} + +// DescriptionNEQ applies the NEQ predicate on the "description" field. +func DescriptionNEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldDescription, v)) +} + +// DescriptionIn applies the In predicate on the "description" field. +func DescriptionIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldDescription, vs...)) +} + +// DescriptionNotIn applies the NotIn predicate on the "description" field. +func DescriptionNotIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldDescription, vs...)) +} + +// DescriptionGT applies the GT predicate on the "description" field. +func DescriptionGT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldDescription, v)) +} + +// DescriptionGTE applies the GTE predicate on the "description" field. +func DescriptionGTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldDescription, v)) +} + +// DescriptionLT applies the LT predicate on the "description" field. +func DescriptionLT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldDescription, v)) +} + +// DescriptionLTE applies the LTE predicate on the "description" field. +func DescriptionLTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldDescription, v)) +} + +// DescriptionContains applies the Contains predicate on the "description" field. +func DescriptionContains(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContains(FieldDescription, v)) +} + +// DescriptionHasPrefix applies the HasPrefix predicate on the "description" field. +func DescriptionHasPrefix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasPrefix(FieldDescription, v)) +} + +// DescriptionHasSuffix applies the HasSuffix predicate on the "description" field. +func DescriptionHasSuffix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasSuffix(FieldDescription, v)) +} + +// DescriptionIsNil applies the IsNil predicate on the "description" field. +func DescriptionIsNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIsNull(FieldDescription)) +} + +// DescriptionNotNil applies the NotNil predicate on the "description" field. +func DescriptionNotNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotNull(FieldDescription)) +} + +// DescriptionEqualFold applies the EqualFold predicate on the "description" field. +func DescriptionEqualFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldDescription, v)) +} + +// DescriptionContainsFold applies the ContainsFold predicate on the "description" field. +func DescriptionContainsFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldDescription, v)) +} + +// InvoiceIDEQ applies the EQ predicate on the "invoice_id" field. +func InvoiceIDEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldInvoiceID, v)) +} + +// InvoiceIDNEQ applies the NEQ predicate on the "invoice_id" field. +func InvoiceIDNEQ(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldInvoiceID, v)) +} + +// InvoiceIDIn applies the In predicate on the "invoice_id" field. +func InvoiceIDIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldInvoiceID, vs...)) +} + +// InvoiceIDNotIn applies the NotIn predicate on the "invoice_id" field. +func InvoiceIDNotIn(vs ...string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldInvoiceID, vs...)) +} + +// InvoiceIDGT applies the GT predicate on the "invoice_id" field. +func InvoiceIDGT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldInvoiceID, v)) +} + +// InvoiceIDGTE applies the GTE predicate on the "invoice_id" field. +func InvoiceIDGTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldInvoiceID, v)) +} + +// InvoiceIDLT applies the LT predicate on the "invoice_id" field. +func InvoiceIDLT(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldInvoiceID, v)) +} + +// InvoiceIDLTE applies the LTE predicate on the "invoice_id" field. +func InvoiceIDLTE(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldInvoiceID, v)) +} + +// InvoiceIDContains applies the Contains predicate on the "invoice_id" field. +func InvoiceIDContains(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContains(FieldInvoiceID, v)) +} + +// InvoiceIDHasPrefix applies the HasPrefix predicate on the "invoice_id" field. +func InvoiceIDHasPrefix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasPrefix(FieldInvoiceID, v)) +} + +// InvoiceIDHasSuffix applies the HasSuffix predicate on the "invoice_id" field. +func InvoiceIDHasSuffix(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldHasSuffix(FieldInvoiceID, v)) +} + +// InvoiceIDEqualFold applies the EqualFold predicate on the "invoice_id" field. +func InvoiceIDEqualFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldInvoiceID, v)) +} + +// InvoiceIDContainsFold applies the ContainsFold predicate on the "invoice_id" field. +func InvoiceIDContainsFold(v string) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldInvoiceID, v)) +} + +// PeriodStartEQ applies the EQ predicate on the "period_start" field. +func PeriodStartEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldPeriodStart, v)) +} + +// PeriodStartNEQ applies the NEQ predicate on the "period_start" field. +func PeriodStartNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldPeriodStart, v)) +} + +// PeriodStartIn applies the In predicate on the "period_start" field. +func PeriodStartIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldPeriodStart, vs...)) +} + +// PeriodStartNotIn applies the NotIn predicate on the "period_start" field. +func PeriodStartNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldPeriodStart, vs...)) +} + +// PeriodStartGT applies the GT predicate on the "period_start" field. +func PeriodStartGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldPeriodStart, v)) +} + +// PeriodStartGTE applies the GTE predicate on the "period_start" field. +func PeriodStartGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldPeriodStart, v)) +} + +// PeriodStartLT applies the LT predicate on the "period_start" field. +func PeriodStartLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldPeriodStart, v)) +} + +// PeriodStartLTE applies the LTE predicate on the "period_start" field. +func PeriodStartLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldPeriodStart, v)) +} + +// PeriodEndEQ applies the EQ predicate on the "period_end" field. +func PeriodEndEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldPeriodEnd, v)) +} + +// PeriodEndNEQ applies the NEQ predicate on the "period_end" field. +func PeriodEndNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldPeriodEnd, v)) +} + +// PeriodEndIn applies the In predicate on the "period_end" field. +func PeriodEndIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldPeriodEnd, vs...)) +} + +// PeriodEndNotIn applies the NotIn predicate on the "period_end" field. +func PeriodEndNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldPeriodEnd, vs...)) +} + +// PeriodEndGT applies the GT predicate on the "period_end" field. +func PeriodEndGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldPeriodEnd, v)) +} + +// PeriodEndGTE applies the GTE predicate on the "period_end" field. +func PeriodEndGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldPeriodEnd, v)) +} + +// PeriodEndLT applies the LT predicate on the "period_end" field. +func PeriodEndLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldPeriodEnd, v)) +} + +// PeriodEndLTE applies the LTE predicate on the "period_end" field. +func PeriodEndLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldPeriodEnd, v)) +} + +// InvoiceAtEQ applies the EQ predicate on the "invoice_at" field. +func InvoiceAtEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldInvoiceAt, v)) +} + +// InvoiceAtNEQ applies the NEQ predicate on the "invoice_at" field. +func InvoiceAtNEQ(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldInvoiceAt, v)) +} + +// InvoiceAtIn applies the In predicate on the "invoice_at" field. +func InvoiceAtIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldInvoiceAt, vs...)) +} + +// InvoiceAtNotIn applies the NotIn predicate on the "invoice_at" field. +func InvoiceAtNotIn(vs ...time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldInvoiceAt, vs...)) +} + +// InvoiceAtGT applies the GT predicate on the "invoice_at" field. +func InvoiceAtGT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldInvoiceAt, v)) +} + +// InvoiceAtGTE applies the GTE predicate on the "invoice_at" field. +func InvoiceAtGTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldInvoiceAt, v)) +} + +// InvoiceAtLT applies the LT predicate on the "invoice_at" field. +func InvoiceAtLT(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldInvoiceAt, v)) +} + +// InvoiceAtLTE applies the LTE predicate on the "invoice_at" field. +func InvoiceAtLTE(v time.Time) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldInvoiceAt, v)) +} + +// TypeEQ applies the EQ predicate on the "type" field. +func TypeEQ(v billingentity.InvoiceLineType) predicate.BillingInvoiceLine { + vc := v + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldType, vc)) +} + +// TypeNEQ applies the NEQ predicate on the "type" field. +func TypeNEQ(v billingentity.InvoiceLineType) predicate.BillingInvoiceLine { + vc := v + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldType, vc)) +} + +// TypeIn applies the In predicate on the "type" field. +func TypeIn(vs ...billingentity.InvoiceLineType) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoiceLine(sql.FieldIn(FieldType, v...)) +} + +// TypeNotIn applies the NotIn predicate on the "type" field. +func TypeNotIn(vs ...billingentity.InvoiceLineType) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldType, v...)) +} + +// StatusEQ applies the EQ predicate on the "status" field. +func StatusEQ(v billingentity.InvoiceLineStatus) predicate.BillingInvoiceLine { + vc := v + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldStatus, vc)) +} + +// StatusNEQ applies the NEQ predicate on the "status" field. +func StatusNEQ(v billingentity.InvoiceLineStatus) predicate.BillingInvoiceLine { + vc := v + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldStatus, vc)) +} + +// StatusIn applies the In predicate on the "status" field. +func StatusIn(vs ...billingentity.InvoiceLineStatus) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoiceLine(sql.FieldIn(FieldStatus, v...)) +} + +// StatusNotIn applies the NotIn predicate on the "status" field. +func StatusNotIn(vs ...billingentity.InvoiceLineStatus) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = vs[i] + } + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldStatus, v...)) +} + +// CurrencyEQ applies the EQ predicate on the "currency" field. +func CurrencyEQ(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldCurrency, vc)) +} + +// CurrencyNEQ applies the NEQ predicate on the "currency" field. +func CurrencyNEQ(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldCurrency, vc)) +} + +// CurrencyIn applies the In predicate on the "currency" field. +func CurrencyIn(vs ...currencyx.Code) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoiceLine(sql.FieldIn(FieldCurrency, v...)) +} + +// CurrencyNotIn applies the NotIn predicate on the "currency" field. +func CurrencyNotIn(vs ...currencyx.Code) predicate.BillingInvoiceLine { + v := make([]any, len(vs)) + for i := range v { + v[i] = string(vs[i]) + } + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldCurrency, v...)) +} + +// CurrencyGT applies the GT predicate on the "currency" field. +func CurrencyGT(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldGT(FieldCurrency, vc)) +} + +// CurrencyGTE applies the GTE predicate on the "currency" field. +func CurrencyGTE(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldCurrency, vc)) +} + +// CurrencyLT applies the LT predicate on the "currency" field. +func CurrencyLT(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldLT(FieldCurrency, vc)) +} + +// CurrencyLTE applies the LTE predicate on the "currency" field. +func CurrencyLTE(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldCurrency, vc)) +} + +// CurrencyContains applies the Contains predicate on the "currency" field. +func CurrencyContains(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldContains(FieldCurrency, vc)) +} + +// CurrencyHasPrefix applies the HasPrefix predicate on the "currency" field. +func CurrencyHasPrefix(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldHasPrefix(FieldCurrency, vc)) +} + +// CurrencyHasSuffix applies the HasSuffix predicate on the "currency" field. +func CurrencyHasSuffix(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldHasSuffix(FieldCurrency, vc)) +} + +// CurrencyEqualFold applies the EqualFold predicate on the "currency" field. +func CurrencyEqualFold(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldEqualFold(FieldCurrency, vc)) +} + +// CurrencyContainsFold applies the ContainsFold predicate on the "currency" field. +func CurrencyContainsFold(v currencyx.Code) predicate.BillingInvoiceLine { + vc := string(v) + return predicate.BillingInvoiceLine(sql.FieldContainsFold(FieldCurrency, vc)) +} + +// QuantityEQ applies the EQ predicate on the "quantity" field. +func QuantityEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldEQ(FieldQuantity, v)) +} + +// QuantityNEQ applies the NEQ predicate on the "quantity" field. +func QuantityNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNEQ(FieldQuantity, v)) +} + +// QuantityIn applies the In predicate on the "quantity" field. +func QuantityIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIn(FieldQuantity, vs...)) +} + +// QuantityNotIn applies the NotIn predicate on the "quantity" field. +func QuantityNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotIn(FieldQuantity, vs...)) +} + +// QuantityGT applies the GT predicate on the "quantity" field. +func QuantityGT(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGT(FieldQuantity, v)) +} + +// QuantityGTE applies the GTE predicate on the "quantity" field. +func QuantityGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldGTE(FieldQuantity, v)) +} + +// QuantityLT applies the LT predicate on the "quantity" field. +func QuantityLT(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLT(FieldQuantity, v)) +} + +// QuantityLTE applies the LTE predicate on the "quantity" field. +func QuantityLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldLTE(FieldQuantity, v)) +} + +// QuantityIsNil applies the IsNil predicate on the "quantity" field. +func QuantityIsNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIsNull(FieldQuantity)) +} + +// QuantityNotNil applies the NotNil predicate on the "quantity" field. +func QuantityNotNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotNull(FieldQuantity)) +} + +// TaxOverridesIsNil applies the IsNil predicate on the "tax_overrides" field. +func TaxOverridesIsNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldIsNull(FieldTaxOverrides)) +} + +// TaxOverridesNotNil applies the NotNil predicate on the "tax_overrides" field. +func TaxOverridesNotNil() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.FieldNotNull(FieldTaxOverrides)) +} + +// HasBillingInvoice applies the HasEdge predicate on the "billing_invoice" edge. +func HasBillingInvoice() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, BillingInvoiceTable, BillingInvoiceColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceWith applies the HasEdge predicate on the "billing_invoice" edge with a given conditions (other predicates). +func HasBillingInvoiceWith(preds ...predicate.BillingInvoice) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(func(s *sql.Selector) { + step := newBillingInvoiceStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// HasBillingInvoiceManualLines applies the HasEdge predicate on the "billing_invoice_manual_lines" edge. +func HasBillingInvoiceManualLines() predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, BillingInvoiceManualLinesTable, BillingInvoiceManualLinesColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceManualLinesWith applies the HasEdge predicate on the "billing_invoice_manual_lines" edge with a given conditions (other predicates). +func HasBillingInvoiceManualLinesWith(preds ...predicate.BillingInvoiceManualLineConfig) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(func(s *sql.Selector) { + step := newBillingInvoiceManualLinesStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.BillingInvoiceLine) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.BillingInvoiceLine) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.BillingInvoiceLine) predicate.BillingInvoiceLine { + return predicate.BillingInvoiceLine(sql.NotPredicates(p)) +} diff --git a/openmeter/ent/db/billinginvoiceline_create.go b/openmeter/ent/db/billinginvoiceline_create.go new file mode 100644 index 000000000..53266856e --- /dev/null +++ b/openmeter/ent/db/billinginvoiceline_create.go @@ -0,0 +1,1422 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/alpacahq/alpacadecimal" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/pkg/currencyx" +) + +// BillingInvoiceLineCreate is the builder for creating a BillingInvoiceLine entity. +type BillingInvoiceLineCreate struct { + config + mutation *BillingInvoiceLineMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetNamespace sets the "namespace" field. +func (bilc *BillingInvoiceLineCreate) SetNamespace(s string) *BillingInvoiceLineCreate { + bilc.mutation.SetNamespace(s) + return bilc +} + +// SetMetadata sets the "metadata" field. +func (bilc *BillingInvoiceLineCreate) SetMetadata(m map[string]string) *BillingInvoiceLineCreate { + bilc.mutation.SetMetadata(m) + return bilc +} + +// SetCreatedAt sets the "created_at" field. +func (bilc *BillingInvoiceLineCreate) SetCreatedAt(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetCreatedAt(t) + return bilc +} + +// SetNillableCreatedAt sets the "created_at" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableCreatedAt(t *time.Time) *BillingInvoiceLineCreate { + if t != nil { + bilc.SetCreatedAt(*t) + } + return bilc +} + +// SetUpdatedAt sets the "updated_at" field. +func (bilc *BillingInvoiceLineCreate) SetUpdatedAt(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetUpdatedAt(t) + return bilc +} + +// SetNillableUpdatedAt sets the "updated_at" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableUpdatedAt(t *time.Time) *BillingInvoiceLineCreate { + if t != nil { + bilc.SetUpdatedAt(*t) + } + return bilc +} + +// SetDeletedAt sets the "deleted_at" field. +func (bilc *BillingInvoiceLineCreate) SetDeletedAt(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetDeletedAt(t) + return bilc +} + +// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableDeletedAt(t *time.Time) *BillingInvoiceLineCreate { + if t != nil { + bilc.SetDeletedAt(*t) + } + return bilc +} + +// SetName sets the "name" field. +func (bilc *BillingInvoiceLineCreate) SetName(s string) *BillingInvoiceLineCreate { + bilc.mutation.SetName(s) + return bilc +} + +// SetDescription sets the "description" field. +func (bilc *BillingInvoiceLineCreate) SetDescription(s string) *BillingInvoiceLineCreate { + bilc.mutation.SetDescription(s) + return bilc +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableDescription(s *string) *BillingInvoiceLineCreate { + if s != nil { + bilc.SetDescription(*s) + } + return bilc +} + +// SetInvoiceID sets the "invoice_id" field. +func (bilc *BillingInvoiceLineCreate) SetInvoiceID(s string) *BillingInvoiceLineCreate { + bilc.mutation.SetInvoiceID(s) + return bilc +} + +// SetPeriodStart sets the "period_start" field. +func (bilc *BillingInvoiceLineCreate) SetPeriodStart(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetPeriodStart(t) + return bilc +} + +// SetPeriodEnd sets the "period_end" field. +func (bilc *BillingInvoiceLineCreate) SetPeriodEnd(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetPeriodEnd(t) + return bilc +} + +// SetInvoiceAt sets the "invoice_at" field. +func (bilc *BillingInvoiceLineCreate) SetInvoiceAt(t time.Time) *BillingInvoiceLineCreate { + bilc.mutation.SetInvoiceAt(t) + return bilc +} + +// SetType sets the "type" field. +func (bilc *BillingInvoiceLineCreate) SetType(blt billingentity.InvoiceLineType) *BillingInvoiceLineCreate { + bilc.mutation.SetType(blt) + return bilc +} + +// SetStatus sets the "status" field. +func (bilc *BillingInvoiceLineCreate) SetStatus(bls billingentity.InvoiceLineStatus) *BillingInvoiceLineCreate { + bilc.mutation.SetStatus(bls) + return bilc +} + +// SetCurrency sets the "currency" field. +func (bilc *BillingInvoiceLineCreate) SetCurrency(c currencyx.Code) *BillingInvoiceLineCreate { + bilc.mutation.SetCurrency(c) + return bilc +} + +// SetQuantity sets the "quantity" field. +func (bilc *BillingInvoiceLineCreate) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceLineCreate { + bilc.mutation.SetQuantity(a) + return bilc +} + +// SetNillableQuantity sets the "quantity" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceLineCreate { + if a != nil { + bilc.SetQuantity(*a) + } + return bilc +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (bilc *BillingInvoiceLineCreate) SetTaxOverrides(bo *billingentity.TaxOverrides) *BillingInvoiceLineCreate { + bilc.mutation.SetTaxOverrides(bo) + return bilc +} + +// SetID sets the "id" field. +func (bilc *BillingInvoiceLineCreate) SetID(s string) *BillingInvoiceLineCreate { + bilc.mutation.SetID(s) + return bilc +} + +// SetNillableID sets the "id" field if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableID(s *string) *BillingInvoiceLineCreate { + if s != nil { + bilc.SetID(*s) + } + return bilc +} + +// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. +func (bilc *BillingInvoiceLineCreate) SetBillingInvoiceID(id string) *BillingInvoiceLineCreate { + bilc.mutation.SetBillingInvoiceID(id) + return bilc +} + +// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. +func (bilc *BillingInvoiceLineCreate) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceLineCreate { + return bilc.SetBillingInvoiceID(b.ID) +} + +// SetBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID. +func (bilc *BillingInvoiceLineCreate) SetBillingInvoiceManualLinesID(id string) *BillingInvoiceLineCreate { + bilc.mutation.SetBillingInvoiceManualLinesID(id) + return bilc +} + +// SetNillableBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID if the given value is not nil. +func (bilc *BillingInvoiceLineCreate) SetNillableBillingInvoiceManualLinesID(id *string) *BillingInvoiceLineCreate { + if id != nil { + bilc = bilc.SetBillingInvoiceManualLinesID(*id) + } + return bilc +} + +// SetBillingInvoiceManualLines sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (bilc *BillingInvoiceLineCreate) SetBillingInvoiceManualLines(b *BillingInvoiceManualLineConfig) *BillingInvoiceLineCreate { + return bilc.SetBillingInvoiceManualLinesID(b.ID) +} + +// Mutation returns the BillingInvoiceLineMutation object of the builder. +func (bilc *BillingInvoiceLineCreate) Mutation() *BillingInvoiceLineMutation { + return bilc.mutation +} + +// Save creates the BillingInvoiceLine in the database. +func (bilc *BillingInvoiceLineCreate) Save(ctx context.Context) (*BillingInvoiceLine, error) { + bilc.defaults() + return withHooks(ctx, bilc.sqlSave, bilc.mutation, bilc.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (bilc *BillingInvoiceLineCreate) SaveX(ctx context.Context) *BillingInvoiceLine { + v, err := bilc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bilc *BillingInvoiceLineCreate) Exec(ctx context.Context) error { + _, err := bilc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bilc *BillingInvoiceLineCreate) ExecX(ctx context.Context) { + if err := bilc.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (bilc *BillingInvoiceLineCreate) defaults() { + if _, ok := bilc.mutation.CreatedAt(); !ok { + v := billinginvoiceline.DefaultCreatedAt() + bilc.mutation.SetCreatedAt(v) + } + if _, ok := bilc.mutation.UpdatedAt(); !ok { + v := billinginvoiceline.DefaultUpdatedAt() + bilc.mutation.SetUpdatedAt(v) + } + if _, ok := bilc.mutation.ID(); !ok { + v := billinginvoiceline.DefaultID() + bilc.mutation.SetID(v) + } +} + +// check runs all checks and user-defined validators on the builder. +func (bilc *BillingInvoiceLineCreate) check() error { + if _, ok := bilc.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceLine.namespace"`)} + } + if v, ok := bilc.mutation.Namespace(); ok { + if err := billinginvoiceline.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.namespace": %w`, err)} + } + } + if _, ok := bilc.mutation.CreatedAt(); !ok { + return &ValidationError{Name: "created_at", err: errors.New(`db: missing required field "BillingInvoiceLine.created_at"`)} + } + if _, ok := bilc.mutation.UpdatedAt(); !ok { + return &ValidationError{Name: "updated_at", err: errors.New(`db: missing required field "BillingInvoiceLine.updated_at"`)} + } + if _, ok := bilc.mutation.Name(); !ok { + return &ValidationError{Name: "name", err: errors.New(`db: missing required field "BillingInvoiceLine.name"`)} + } + if _, ok := bilc.mutation.InvoiceID(); !ok { + return &ValidationError{Name: "invoice_id", err: errors.New(`db: missing required field "BillingInvoiceLine.invoice_id"`)} + } + if _, ok := bilc.mutation.PeriodStart(); !ok { + return &ValidationError{Name: "period_start", err: errors.New(`db: missing required field "BillingInvoiceLine.period_start"`)} + } + if _, ok := bilc.mutation.PeriodEnd(); !ok { + return &ValidationError{Name: "period_end", err: errors.New(`db: missing required field "BillingInvoiceLine.period_end"`)} + } + if _, ok := bilc.mutation.InvoiceAt(); !ok { + return &ValidationError{Name: "invoice_at", err: errors.New(`db: missing required field "BillingInvoiceLine.invoice_at"`)} + } + if _, ok := bilc.mutation.GetType(); !ok { + return &ValidationError{Name: "type", err: errors.New(`db: missing required field "BillingInvoiceLine.type"`)} + } + if v, ok := bilc.mutation.GetType(); ok { + if err := billinginvoiceline.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.type": %w`, err)} + } + } + if _, ok := bilc.mutation.Status(); !ok { + return &ValidationError{Name: "status", err: errors.New(`db: missing required field "BillingInvoiceLine.status"`)} + } + if v, ok := bilc.mutation.Status(); ok { + if err := billinginvoiceline.StatusValidator(v); err != nil { + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.status": %w`, err)} + } + } + if _, ok := bilc.mutation.Currency(); !ok { + return &ValidationError{Name: "currency", err: errors.New(`db: missing required field "BillingInvoiceLine.currency"`)} + } + if v, ok := bilc.mutation.Currency(); ok { + if err := billinginvoiceline.CurrencyValidator(string(v)); err != nil { + return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.currency": %w`, err)} + } + } + if len(bilc.mutation.BillingInvoiceIDs()) == 0 { + return &ValidationError{Name: "billing_invoice", err: errors.New(`db: missing required edge "BillingInvoiceLine.billing_invoice"`)} + } + return nil +} + +func (bilc *BillingInvoiceLineCreate) sqlSave(ctx context.Context) (*BillingInvoiceLine, error) { + if err := bilc.check(); err != nil { + return nil, err + } + _node, _spec := bilc.createSpec() + if err := sqlgraph.CreateNode(ctx, bilc.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected BillingInvoiceLine.ID type: %T", _spec.ID.Value) + } + } + bilc.mutation.id = &_node.ID + bilc.mutation.done = true + return _node, nil +} + +func (bilc *BillingInvoiceLineCreate) createSpec() (*BillingInvoiceLine, *sqlgraph.CreateSpec) { + var ( + _node = &BillingInvoiceLine{config: bilc.config} + _spec = sqlgraph.NewCreateSpec(billinginvoiceline.Table, sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString)) + ) + _spec.OnConflict = bilc.conflict + if id, ok := bilc.mutation.ID(); ok { + _node.ID = id + _spec.ID.Value = id + } + if value, ok := bilc.mutation.Namespace(); ok { + _spec.SetField(billinginvoiceline.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := bilc.mutation.Metadata(); ok { + _spec.SetField(billinginvoiceline.FieldMetadata, field.TypeJSON, value) + _node.Metadata = value + } + if value, ok := bilc.mutation.CreatedAt(); ok { + _spec.SetField(billinginvoiceline.FieldCreatedAt, field.TypeTime, value) + _node.CreatedAt = value + } + if value, ok := bilc.mutation.UpdatedAt(); ok { + _spec.SetField(billinginvoiceline.FieldUpdatedAt, field.TypeTime, value) + _node.UpdatedAt = value + } + if value, ok := bilc.mutation.DeletedAt(); ok { + _spec.SetField(billinginvoiceline.FieldDeletedAt, field.TypeTime, value) + _node.DeletedAt = &value + } + if value, ok := bilc.mutation.Name(); ok { + _spec.SetField(billinginvoiceline.FieldName, field.TypeString, value) + _node.Name = value + } + if value, ok := bilc.mutation.Description(); ok { + _spec.SetField(billinginvoiceline.FieldDescription, field.TypeString, value) + _node.Description = &value + } + if value, ok := bilc.mutation.PeriodStart(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodStart, field.TypeTime, value) + _node.PeriodStart = value + } + if value, ok := bilc.mutation.PeriodEnd(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodEnd, field.TypeTime, value) + _node.PeriodEnd = value + } + if value, ok := bilc.mutation.InvoiceAt(); ok { + _spec.SetField(billinginvoiceline.FieldInvoiceAt, field.TypeTime, value) + _node.InvoiceAt = value + } + if value, ok := bilc.mutation.GetType(); ok { + _spec.SetField(billinginvoiceline.FieldType, field.TypeEnum, value) + _node.Type = value + } + if value, ok := bilc.mutation.Status(); ok { + _spec.SetField(billinginvoiceline.FieldStatus, field.TypeEnum, value) + _node.Status = value + } + if value, ok := bilc.mutation.Currency(); ok { + _spec.SetField(billinginvoiceline.FieldCurrency, field.TypeString, value) + _node.Currency = value + } + if value, ok := bilc.mutation.Quantity(); ok { + _spec.SetField(billinginvoiceline.FieldQuantity, field.TypeOther, value) + _node.Quantity = &value + } + if value, ok := bilc.mutation.TaxOverrides(); ok { + _spec.SetField(billinginvoiceline.FieldTaxOverrides, field.TypeJSON, value) + _node.TaxOverrides = value + } + if nodes := bilc.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoiceline.BillingInvoiceTable, + Columns: []string{billinginvoiceline.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.InvoiceID = nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + if nodes := bilc.mutation.BillingInvoiceManualLinesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: billinginvoiceline.BillingInvoiceManualLinesTable, + Columns: []string{billinginvoiceline.BillingInvoiceManualLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _node.manual_line_config_id = &nodes[0] + _spec.Edges = append(_spec.Edges, edge) + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoiceLine.Create(). +// SetNamespace(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceLineUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bilc *BillingInvoiceLineCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineUpsertOne { + bilc.conflict = opts + return &BillingInvoiceLineUpsertOne{ + create: bilc, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (bilc *BillingInvoiceLineCreate) OnConflictColumns(columns ...string) *BillingInvoiceLineUpsertOne { + bilc.conflict = append(bilc.conflict, sql.ConflictColumns(columns...)) + return &BillingInvoiceLineUpsertOne{ + create: bilc, + } +} + +type ( + // BillingInvoiceLineUpsertOne is the builder for "upsert"-ing + // one BillingInvoiceLine node. + BillingInvoiceLineUpsertOne struct { + create *BillingInvoiceLineCreate + } + + // BillingInvoiceLineUpsert is the "OnConflict" setter. + BillingInvoiceLineUpsert struct { + *sql.UpdateSet + } +) + +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceLineUpsert) SetMetadata(v map[string]string) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldMetadata, v) + return u +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateMetadata() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldMetadata) + return u +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceLineUpsert) ClearMetadata() *BillingInvoiceLineUpsert { + u.SetNull(billinginvoiceline.FieldMetadata) + return u +} + +// SetUpdatedAt sets the "updated_at" field. +func (u *BillingInvoiceLineUpsert) SetUpdatedAt(v time.Time) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldUpdatedAt, v) + return u +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateUpdatedAt() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldUpdatedAt) + return u +} + +// SetDeletedAt sets the "deleted_at" field. +func (u *BillingInvoiceLineUpsert) SetDeletedAt(v time.Time) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldDeletedAt, v) + return u +} + +// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateDeletedAt() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldDeletedAt) + return u +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (u *BillingInvoiceLineUpsert) ClearDeletedAt() *BillingInvoiceLineUpsert { + u.SetNull(billinginvoiceline.FieldDeletedAt) + return u +} + +// SetName sets the "name" field. +func (u *BillingInvoiceLineUpsert) SetName(v string) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldName, v) + return u +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateName() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldName) + return u +} + +// SetDescription sets the "description" field. +func (u *BillingInvoiceLineUpsert) SetDescription(v string) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldDescription, v) + return u +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateDescription() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldDescription) + return u +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceLineUpsert) ClearDescription() *BillingInvoiceLineUpsert { + u.SetNull(billinginvoiceline.FieldDescription) + return u +} + +// SetInvoiceID sets the "invoice_id" field. +func (u *BillingInvoiceLineUpsert) SetInvoiceID(v string) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldInvoiceID, v) + return u +} + +// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateInvoiceID() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldInvoiceID) + return u +} + +// SetPeriodStart sets the "period_start" field. +func (u *BillingInvoiceLineUpsert) SetPeriodStart(v time.Time) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldPeriodStart, v) + return u +} + +// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdatePeriodStart() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldPeriodStart) + return u +} + +// SetPeriodEnd sets the "period_end" field. +func (u *BillingInvoiceLineUpsert) SetPeriodEnd(v time.Time) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldPeriodEnd, v) + return u +} + +// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdatePeriodEnd() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldPeriodEnd) + return u +} + +// SetInvoiceAt sets the "invoice_at" field. +func (u *BillingInvoiceLineUpsert) SetInvoiceAt(v time.Time) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldInvoiceAt, v) + return u +} + +// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateInvoiceAt() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldInvoiceAt) + return u +} + +// SetType sets the "type" field. +func (u *BillingInvoiceLineUpsert) SetType(v billingentity.InvoiceLineType) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldType, v) + return u +} + +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateType() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldType) + return u +} + +// SetStatus sets the "status" field. +func (u *BillingInvoiceLineUpsert) SetStatus(v billingentity.InvoiceLineStatus) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldStatus, v) + return u +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateStatus() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldStatus) + return u +} + +// SetQuantity sets the "quantity" field. +func (u *BillingInvoiceLineUpsert) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldQuantity, v) + return u +} + +// UpdateQuantity sets the "quantity" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateQuantity() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldQuantity) + return u +} + +// ClearQuantity clears the value of the "quantity" field. +func (u *BillingInvoiceLineUpsert) ClearQuantity() *BillingInvoiceLineUpsert { + u.SetNull(billinginvoiceline.FieldQuantity) + return u +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (u *BillingInvoiceLineUpsert) SetTaxOverrides(v *billingentity.TaxOverrides) *BillingInvoiceLineUpsert { + u.Set(billinginvoiceline.FieldTaxOverrides, v) + return u +} + +// UpdateTaxOverrides sets the "tax_overrides" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsert) UpdateTaxOverrides() *BillingInvoiceLineUpsert { + u.SetExcluded(billinginvoiceline.FieldTaxOverrides) + return u +} + +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (u *BillingInvoiceLineUpsert) ClearTaxOverrides() *BillingInvoiceLineUpsert { + u.SetNull(billinginvoiceline.FieldTaxOverrides) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. +// Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// sql.ResolveWith(func(u *sql.UpdateSet) { +// u.SetIgnore(billinginvoiceline.FieldID) +// }), +// ). +// Exec(ctx) +func (u *BillingInvoiceLineUpsertOne) UpdateNewValues() *BillingInvoiceLineUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.ID(); exists { + s.SetIgnore(billinginvoiceline.FieldID) + } + if _, exists := u.create.mutation.Namespace(); exists { + s.SetIgnore(billinginvoiceline.FieldNamespace) + } + if _, exists := u.create.mutation.CreatedAt(); exists { + s.SetIgnore(billinginvoiceline.FieldCreatedAt) + } + if _, exists := u.create.mutation.Currency(); exists { + s.SetIgnore(billinginvoiceline.FieldCurrency) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceLineUpsertOne) Ignore() *BillingInvoiceLineUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BillingInvoiceLineUpsertOne) DoNothing() *BillingInvoiceLineUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineCreate.OnConflict +// documentation for more info. +func (u *BillingInvoiceLineUpsertOne) Update(set func(*BillingInvoiceLineUpsert)) *BillingInvoiceLineUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BillingInvoiceLineUpsert{UpdateSet: update}) + })) + return u +} + +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceLineUpsertOne) SetMetadata(v map[string]string) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetMetadata(v) + }) +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateMetadata() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateMetadata() + }) +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceLineUpsertOne) ClearMetadata() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearMetadata() + }) +} + +// SetUpdatedAt sets the "updated_at" field. +func (u *BillingInvoiceLineUpsertOne) SetUpdatedAt(v time.Time) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateUpdatedAt() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateUpdatedAt() + }) +} + +// SetDeletedAt sets the "deleted_at" field. +func (u *BillingInvoiceLineUpsertOne) SetDeletedAt(v time.Time) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetDeletedAt(v) + }) +} + +// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateDeletedAt() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateDeletedAt() + }) +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (u *BillingInvoiceLineUpsertOne) ClearDeletedAt() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearDeletedAt() + }) +} + +// SetName sets the "name" field. +func (u *BillingInvoiceLineUpsertOne) SetName(v string) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetName(v) + }) +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateName() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateName() + }) +} + +// SetDescription sets the "description" field. +func (u *BillingInvoiceLineUpsertOne) SetDescription(v string) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateDescription() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceLineUpsertOne) ClearDescription() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearDescription() + }) +} + +// SetInvoiceID sets the "invoice_id" field. +func (u *BillingInvoiceLineUpsertOne) SetInvoiceID(v string) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetInvoiceID(v) + }) +} + +// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateInvoiceID() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateInvoiceID() + }) +} + +// SetPeriodStart sets the "period_start" field. +func (u *BillingInvoiceLineUpsertOne) SetPeriodStart(v time.Time) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetPeriodStart(v) + }) +} + +// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdatePeriodStart() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdatePeriodStart() + }) +} + +// SetPeriodEnd sets the "period_end" field. +func (u *BillingInvoiceLineUpsertOne) SetPeriodEnd(v time.Time) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetPeriodEnd(v) + }) +} + +// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdatePeriodEnd() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdatePeriodEnd() + }) +} + +// SetInvoiceAt sets the "invoice_at" field. +func (u *BillingInvoiceLineUpsertOne) SetInvoiceAt(v time.Time) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetInvoiceAt(v) + }) +} + +// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateInvoiceAt() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateInvoiceAt() + }) +} + +// SetType sets the "type" field. +func (u *BillingInvoiceLineUpsertOne) SetType(v billingentity.InvoiceLineType) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetType(v) + }) +} + +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateType() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateType() + }) +} + +// SetStatus sets the "status" field. +func (u *BillingInvoiceLineUpsertOne) SetStatus(v billingentity.InvoiceLineStatus) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetStatus(v) + }) +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateStatus() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateStatus() + }) +} + +// SetQuantity sets the "quantity" field. +func (u *BillingInvoiceLineUpsertOne) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetQuantity(v) + }) +} + +// UpdateQuantity sets the "quantity" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateQuantity() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateQuantity() + }) +} + +// ClearQuantity clears the value of the "quantity" field. +func (u *BillingInvoiceLineUpsertOne) ClearQuantity() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearQuantity() + }) +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (u *BillingInvoiceLineUpsertOne) SetTaxOverrides(v *billingentity.TaxOverrides) *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetTaxOverrides(v) + }) +} + +// UpdateTaxOverrides sets the "tax_overrides" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertOne) UpdateTaxOverrides() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateTaxOverrides() + }) +} + +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (u *BillingInvoiceLineUpsertOne) ClearTaxOverrides() *BillingInvoiceLineUpsertOne { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearTaxOverrides() + }) +} + +// Exec executes the query. +func (u *BillingInvoiceLineUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("db: missing options for BillingInvoiceLineCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BillingInvoiceLineUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *BillingInvoiceLineUpsertOne) ID(ctx context.Context) (id string, err error) { + if u.create.driver.Dialect() == dialect.MySQL { + // In case of "ON CONFLICT", there is no way to get back non-numeric ID + // fields from the database since MySQL does not support the RETURNING clause. + return id, errors.New("db: BillingInvoiceLineUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceLineUpsertOne.Exec instead") + } + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *BillingInvoiceLineUpsertOne) IDX(ctx context.Context) string { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// BillingInvoiceLineCreateBulk is the builder for creating many BillingInvoiceLine entities in bulk. +type BillingInvoiceLineCreateBulk struct { + config + err error + builders []*BillingInvoiceLineCreate + conflict []sql.ConflictOption +} + +// Save creates the BillingInvoiceLine entities in the database. +func (bilcb *BillingInvoiceLineCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceLine, error) { + if bilcb.err != nil { + return nil, bilcb.err + } + specs := make([]*sqlgraph.CreateSpec, len(bilcb.builders)) + nodes := make([]*BillingInvoiceLine, len(bilcb.builders)) + mutators := make([]Mutator, len(bilcb.builders)) + for i := range bilcb.builders { + func(i int, root context.Context) { + builder := bilcb.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*BillingInvoiceLineMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, bilcb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = bilcb.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, bilcb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, bilcb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (bilcb *BillingInvoiceLineCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceLine { + v, err := bilcb.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bilcb *BillingInvoiceLineCreateBulk) Exec(ctx context.Context) error { + _, err := bilcb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bilcb *BillingInvoiceLineCreateBulk) ExecX(ctx context.Context) { + if err := bilcb.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoiceLine.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceLineUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bilcb *BillingInvoiceLineCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceLineUpsertBulk { + bilcb.conflict = opts + return &BillingInvoiceLineUpsertBulk{ + create: bilcb, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (bilcb *BillingInvoiceLineCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceLineUpsertBulk { + bilcb.conflict = append(bilcb.conflict, sql.ConflictColumns(columns...)) + return &BillingInvoiceLineUpsertBulk{ + create: bilcb, + } +} + +// BillingInvoiceLineUpsertBulk is the builder for "upsert"-ing +// a bulk of BillingInvoiceLine nodes. +type BillingInvoiceLineUpsertBulk struct { + create *BillingInvoiceLineCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// sql.ResolveWith(func(u *sql.UpdateSet) { +// u.SetIgnore(billinginvoiceline.FieldID) +// }), +// ). +// Exec(ctx) +func (u *BillingInvoiceLineUpsertBulk) UpdateNewValues() *BillingInvoiceLineUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.ID(); exists { + s.SetIgnore(billinginvoiceline.FieldID) + } + if _, exists := b.mutation.Namespace(); exists { + s.SetIgnore(billinginvoiceline.FieldNamespace) + } + if _, exists := b.mutation.CreatedAt(); exists { + s.SetIgnore(billinginvoiceline.FieldCreatedAt) + } + if _, exists := b.mutation.Currency(); exists { + s.SetIgnore(billinginvoiceline.FieldCurrency) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BillingInvoiceLine.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceLineUpsertBulk) Ignore() *BillingInvoiceLineUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BillingInvoiceLineUpsertBulk) DoNothing() *BillingInvoiceLineUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceLineCreateBulk.OnConflict +// documentation for more info. +func (u *BillingInvoiceLineUpsertBulk) Update(set func(*BillingInvoiceLineUpsert)) *BillingInvoiceLineUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BillingInvoiceLineUpsert{UpdateSet: update}) + })) + return u +} + +// SetMetadata sets the "metadata" field. +func (u *BillingInvoiceLineUpsertBulk) SetMetadata(v map[string]string) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetMetadata(v) + }) +} + +// UpdateMetadata sets the "metadata" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateMetadata() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateMetadata() + }) +} + +// ClearMetadata clears the value of the "metadata" field. +func (u *BillingInvoiceLineUpsertBulk) ClearMetadata() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearMetadata() + }) +} + +// SetUpdatedAt sets the "updated_at" field. +func (u *BillingInvoiceLineUpsertBulk) SetUpdatedAt(v time.Time) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetUpdatedAt(v) + }) +} + +// UpdateUpdatedAt sets the "updated_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateUpdatedAt() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateUpdatedAt() + }) +} + +// SetDeletedAt sets the "deleted_at" field. +func (u *BillingInvoiceLineUpsertBulk) SetDeletedAt(v time.Time) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetDeletedAt(v) + }) +} + +// UpdateDeletedAt sets the "deleted_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateDeletedAt() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateDeletedAt() + }) +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (u *BillingInvoiceLineUpsertBulk) ClearDeletedAt() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearDeletedAt() + }) +} + +// SetName sets the "name" field. +func (u *BillingInvoiceLineUpsertBulk) SetName(v string) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetName(v) + }) +} + +// UpdateName sets the "name" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateName() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateName() + }) +} + +// SetDescription sets the "description" field. +func (u *BillingInvoiceLineUpsertBulk) SetDescription(v string) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetDescription(v) + }) +} + +// UpdateDescription sets the "description" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateDescription() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateDescription() + }) +} + +// ClearDescription clears the value of the "description" field. +func (u *BillingInvoiceLineUpsertBulk) ClearDescription() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearDescription() + }) +} + +// SetInvoiceID sets the "invoice_id" field. +func (u *BillingInvoiceLineUpsertBulk) SetInvoiceID(v string) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetInvoiceID(v) + }) +} + +// UpdateInvoiceID sets the "invoice_id" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateInvoiceID() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateInvoiceID() + }) +} + +// SetPeriodStart sets the "period_start" field. +func (u *BillingInvoiceLineUpsertBulk) SetPeriodStart(v time.Time) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetPeriodStart(v) + }) +} + +// UpdatePeriodStart sets the "period_start" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdatePeriodStart() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdatePeriodStart() + }) +} + +// SetPeriodEnd sets the "period_end" field. +func (u *BillingInvoiceLineUpsertBulk) SetPeriodEnd(v time.Time) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetPeriodEnd(v) + }) +} + +// UpdatePeriodEnd sets the "period_end" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdatePeriodEnd() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdatePeriodEnd() + }) +} + +// SetInvoiceAt sets the "invoice_at" field. +func (u *BillingInvoiceLineUpsertBulk) SetInvoiceAt(v time.Time) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetInvoiceAt(v) + }) +} + +// UpdateInvoiceAt sets the "invoice_at" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateInvoiceAt() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateInvoiceAt() + }) +} + +// SetType sets the "type" field. +func (u *BillingInvoiceLineUpsertBulk) SetType(v billingentity.InvoiceLineType) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetType(v) + }) +} + +// UpdateType sets the "type" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateType() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateType() + }) +} + +// SetStatus sets the "status" field. +func (u *BillingInvoiceLineUpsertBulk) SetStatus(v billingentity.InvoiceLineStatus) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetStatus(v) + }) +} + +// UpdateStatus sets the "status" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateStatus() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateStatus() + }) +} + +// SetQuantity sets the "quantity" field. +func (u *BillingInvoiceLineUpsertBulk) SetQuantity(v alpacadecimal.Decimal) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetQuantity(v) + }) +} + +// UpdateQuantity sets the "quantity" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateQuantity() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateQuantity() + }) +} + +// ClearQuantity clears the value of the "quantity" field. +func (u *BillingInvoiceLineUpsertBulk) ClearQuantity() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearQuantity() + }) +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (u *BillingInvoiceLineUpsertBulk) SetTaxOverrides(v *billingentity.TaxOverrides) *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.SetTaxOverrides(v) + }) +} + +// UpdateTaxOverrides sets the "tax_overrides" field to the value that was provided on create. +func (u *BillingInvoiceLineUpsertBulk) UpdateTaxOverrides() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.UpdateTaxOverrides() + }) +} + +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (u *BillingInvoiceLineUpsertBulk) ClearTaxOverrides() *BillingInvoiceLineUpsertBulk { + return u.Update(func(s *BillingInvoiceLineUpsert) { + s.ClearTaxOverrides() + }) +} + +// Exec executes the query. +func (u *BillingInvoiceLineUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceLineCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("db: missing options for BillingInvoiceLineCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BillingInvoiceLineUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/openmeter/ent/db/billinginvoiceline_delete.go b/openmeter/ent/db/billinginvoiceline_delete.go new file mode 100644 index 000000000..a86c4f6df --- /dev/null +++ b/openmeter/ent/db/billinginvoiceline_delete.go @@ -0,0 +1,88 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceLineDelete is the builder for deleting a BillingInvoiceLine entity. +type BillingInvoiceLineDelete struct { + config + hooks []Hook + mutation *BillingInvoiceLineMutation +} + +// Where appends a list predicates to the BillingInvoiceLineDelete builder. +func (bild *BillingInvoiceLineDelete) Where(ps ...predicate.BillingInvoiceLine) *BillingInvoiceLineDelete { + bild.mutation.Where(ps...) + return bild +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (bild *BillingInvoiceLineDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, bild.sqlExec, bild.mutation, bild.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (bild *BillingInvoiceLineDelete) ExecX(ctx context.Context) int { + n, err := bild.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (bild *BillingInvoiceLineDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(billinginvoiceline.Table, sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString)) + if ps := bild.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, bild.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + bild.mutation.done = true + return affected, err +} + +// BillingInvoiceLineDeleteOne is the builder for deleting a single BillingInvoiceLine entity. +type BillingInvoiceLineDeleteOne struct { + bild *BillingInvoiceLineDelete +} + +// Where appends a list predicates to the BillingInvoiceLineDelete builder. +func (bildo *BillingInvoiceLineDeleteOne) Where(ps ...predicate.BillingInvoiceLine) *BillingInvoiceLineDeleteOne { + bildo.bild.mutation.Where(ps...) + return bildo +} + +// Exec executes the deletion query. +func (bildo *BillingInvoiceLineDeleteOne) Exec(ctx context.Context) error { + n, err := bildo.bild.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{billinginvoiceline.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (bildo *BillingInvoiceLineDeleteOne) ExecX(ctx context.Context) { + if err := bildo.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/openmeter/ent/db/billinginvoiceline_query.go b/openmeter/ent/db/billinginvoiceline_query.go new file mode 100644 index 000000000..828204b46 --- /dev/null +++ b/openmeter/ent/db/billinginvoiceline_query.go @@ -0,0 +1,726 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "fmt" + "math" + + "entgo.io/ent" + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceLineQuery is the builder for querying BillingInvoiceLine entities. +type BillingInvoiceLineQuery struct { + config + ctx *QueryContext + order []billinginvoiceline.OrderOption + inters []Interceptor + predicates []predicate.BillingInvoiceLine + withBillingInvoice *BillingInvoiceQuery + withBillingInvoiceManualLines *BillingInvoiceManualLineConfigQuery + withFKs bool + modifiers []func(*sql.Selector) + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the BillingInvoiceLineQuery builder. +func (bilq *BillingInvoiceLineQuery) Where(ps ...predicate.BillingInvoiceLine) *BillingInvoiceLineQuery { + bilq.predicates = append(bilq.predicates, ps...) + return bilq +} + +// Limit the number of records to be returned by this query. +func (bilq *BillingInvoiceLineQuery) Limit(limit int) *BillingInvoiceLineQuery { + bilq.ctx.Limit = &limit + return bilq +} + +// Offset to start from. +func (bilq *BillingInvoiceLineQuery) Offset(offset int) *BillingInvoiceLineQuery { + bilq.ctx.Offset = &offset + return bilq +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (bilq *BillingInvoiceLineQuery) Unique(unique bool) *BillingInvoiceLineQuery { + bilq.ctx.Unique = &unique + return bilq +} + +// Order specifies how the records should be ordered. +func (bilq *BillingInvoiceLineQuery) Order(o ...billinginvoiceline.OrderOption) *BillingInvoiceLineQuery { + bilq.order = append(bilq.order, o...) + return bilq +} + +// QueryBillingInvoice chains the current query on the "billing_invoice" edge. +func (bilq *BillingInvoiceLineQuery) QueryBillingInvoice() *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: bilq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := bilq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := bilq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoiceline.Table, billinginvoiceline.FieldID, selector), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoiceline.BillingInvoiceTable, billinginvoiceline.BillingInvoiceColumn), + ) + fromU = sqlgraph.SetNeighbors(bilq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// QueryBillingInvoiceManualLines chains the current query on the "billing_invoice_manual_lines" edge. +func (bilq *BillingInvoiceLineQuery) QueryBillingInvoiceManualLines() *BillingInvoiceManualLineConfigQuery { + query := (&BillingInvoiceManualLineConfigClient{config: bilq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := bilq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := bilq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoiceline.Table, billinginvoiceline.FieldID, selector), + sqlgraph.To(billinginvoicemanuallineconfig.Table, billinginvoicemanuallineconfig.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, billinginvoiceline.BillingInvoiceManualLinesTable, billinginvoiceline.BillingInvoiceManualLinesColumn), + ) + fromU = sqlgraph.SetNeighbors(bilq.driver.Dialect(), step) + return fromU, nil + } + return query +} + +// First returns the first BillingInvoiceLine entity from the query. +// Returns a *NotFoundError when no BillingInvoiceLine was found. +func (bilq *BillingInvoiceLineQuery) First(ctx context.Context) (*BillingInvoiceLine, error) { + nodes, err := bilq.Limit(1).All(setContextOp(ctx, bilq.ctx, ent.OpQueryFirst)) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{billinginvoiceline.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) FirstX(ctx context.Context) *BillingInvoiceLine { + node, err := bilq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first BillingInvoiceLine ID from the query. +// Returns a *NotFoundError when no BillingInvoiceLine ID was found. +func (bilq *BillingInvoiceLineQuery) FirstID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bilq.Limit(1).IDs(setContextOp(ctx, bilq.ctx, ent.OpQueryFirstID)); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{billinginvoiceline.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) FirstIDX(ctx context.Context) string { + id, err := bilq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single BillingInvoiceLine entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one BillingInvoiceLine entity is found. +// Returns a *NotFoundError when no BillingInvoiceLine entities are found. +func (bilq *BillingInvoiceLineQuery) Only(ctx context.Context) (*BillingInvoiceLine, error) { + nodes, err := bilq.Limit(2).All(setContextOp(ctx, bilq.ctx, ent.OpQueryOnly)) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{billinginvoiceline.Label} + default: + return nil, &NotSingularError{billinginvoiceline.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) OnlyX(ctx context.Context) *BillingInvoiceLine { + node, err := bilq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only BillingInvoiceLine ID in the query. +// Returns a *NotSingularError when more than one BillingInvoiceLine ID is found. +// Returns a *NotFoundError when no entities are found. +func (bilq *BillingInvoiceLineQuery) OnlyID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bilq.Limit(2).IDs(setContextOp(ctx, bilq.ctx, ent.OpQueryOnlyID)); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{billinginvoiceline.Label} + default: + err = &NotSingularError{billinginvoiceline.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) OnlyIDX(ctx context.Context) string { + id, err := bilq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of BillingInvoiceLines. +func (bilq *BillingInvoiceLineQuery) All(ctx context.Context) ([]*BillingInvoiceLine, error) { + ctx = setContextOp(ctx, bilq.ctx, ent.OpQueryAll) + if err := bilq.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*BillingInvoiceLine, *BillingInvoiceLineQuery]() + return withInterceptors[[]*BillingInvoiceLine](ctx, bilq, qr, bilq.inters) +} + +// AllX is like All, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) AllX(ctx context.Context) []*BillingInvoiceLine { + nodes, err := bilq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of BillingInvoiceLine IDs. +func (bilq *BillingInvoiceLineQuery) IDs(ctx context.Context) (ids []string, err error) { + if bilq.ctx.Unique == nil && bilq.path != nil { + bilq.Unique(true) + } + ctx = setContextOp(ctx, bilq.ctx, ent.OpQueryIDs) + if err = bilq.Select(billinginvoiceline.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) IDsX(ctx context.Context) []string { + ids, err := bilq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (bilq *BillingInvoiceLineQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, bilq.ctx, ent.OpQueryCount) + if err := bilq.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, bilq, querierCount[*BillingInvoiceLineQuery](), bilq.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) CountX(ctx context.Context) int { + count, err := bilq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (bilq *BillingInvoiceLineQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, bilq.ctx, ent.OpQueryExist) + switch _, err := bilq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("db: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (bilq *BillingInvoiceLineQuery) ExistX(ctx context.Context) bool { + exist, err := bilq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the BillingInvoiceLineQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (bilq *BillingInvoiceLineQuery) Clone() *BillingInvoiceLineQuery { + if bilq == nil { + return nil + } + return &BillingInvoiceLineQuery{ + config: bilq.config, + ctx: bilq.ctx.Clone(), + order: append([]billinginvoiceline.OrderOption{}, bilq.order...), + inters: append([]Interceptor{}, bilq.inters...), + predicates: append([]predicate.BillingInvoiceLine{}, bilq.predicates...), + withBillingInvoice: bilq.withBillingInvoice.Clone(), + withBillingInvoiceManualLines: bilq.withBillingInvoiceManualLines.Clone(), + // clone intermediate query. + sql: bilq.sql.Clone(), + path: bilq.path, + } +} + +// WithBillingInvoice tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice" edge. The optional arguments are used to configure the query builder of the edge. +func (bilq *BillingInvoiceLineQuery) WithBillingInvoice(opts ...func(*BillingInvoiceQuery)) *BillingInvoiceLineQuery { + query := (&BillingInvoiceClient{config: bilq.config}).Query() + for _, opt := range opts { + opt(query) + } + bilq.withBillingInvoice = query + return bilq +} + +// WithBillingInvoiceManualLines tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice_manual_lines" edge. The optional arguments are used to configure the query builder of the edge. +func (bilq *BillingInvoiceLineQuery) WithBillingInvoiceManualLines(opts ...func(*BillingInvoiceManualLineConfigQuery)) *BillingInvoiceLineQuery { + query := (&BillingInvoiceManualLineConfigClient{config: bilq.config}).Query() + for _, opt := range opts { + opt(query) + } + bilq.withBillingInvoiceManualLines = query + return bilq +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// Namespace string `json:"namespace,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.BillingInvoiceLine.Query(). +// GroupBy(billinginvoiceline.FieldNamespace). +// Aggregate(db.Count()). +// Scan(ctx, &v) +func (bilq *BillingInvoiceLineQuery) GroupBy(field string, fields ...string) *BillingInvoiceLineGroupBy { + bilq.ctx.Fields = append([]string{field}, fields...) + grbuild := &BillingInvoiceLineGroupBy{build: bilq} + grbuild.flds = &bilq.ctx.Fields + grbuild.label = billinginvoiceline.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// Namespace string `json:"namespace,omitempty"` +// } +// +// client.BillingInvoiceLine.Query(). +// Select(billinginvoiceline.FieldNamespace). +// Scan(ctx, &v) +func (bilq *BillingInvoiceLineQuery) Select(fields ...string) *BillingInvoiceLineSelect { + bilq.ctx.Fields = append(bilq.ctx.Fields, fields...) + sbuild := &BillingInvoiceLineSelect{BillingInvoiceLineQuery: bilq} + sbuild.label = billinginvoiceline.Label + sbuild.flds, sbuild.scan = &bilq.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a BillingInvoiceLineSelect configured with the given aggregations. +func (bilq *BillingInvoiceLineQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineSelect { + return bilq.Select().Aggregate(fns...) +} + +func (bilq *BillingInvoiceLineQuery) prepareQuery(ctx context.Context) error { + for _, inter := range bilq.inters { + if inter == nil { + return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, bilq); err != nil { + return err + } + } + } + for _, f := range bilq.ctx.Fields { + if !billinginvoiceline.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} + } + } + if bilq.path != nil { + prev, err := bilq.path(ctx) + if err != nil { + return err + } + bilq.sql = prev + } + return nil +} + +func (bilq *BillingInvoiceLineQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceLine, error) { + var ( + nodes = []*BillingInvoiceLine{} + withFKs = bilq.withFKs + _spec = bilq.querySpec() + loadedTypes = [2]bool{ + bilq.withBillingInvoice != nil, + bilq.withBillingInvoiceManualLines != nil, + } + ) + if bilq.withBillingInvoiceManualLines != nil { + withFKs = true + } + if withFKs { + _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceline.ForeignKeys...) + } + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*BillingInvoiceLine).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &BillingInvoiceLine{config: bilq.config} + nodes = append(nodes, node) + node.Edges.loadedTypes = loadedTypes + return node.assignValues(columns, values) + } + if len(bilq.modifiers) > 0 { + _spec.Modifiers = bilq.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, bilq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + if query := bilq.withBillingInvoice; query != nil { + if err := bilq.loadBillingInvoice(ctx, query, nodes, nil, + func(n *BillingInvoiceLine, e *BillingInvoice) { n.Edges.BillingInvoice = e }); err != nil { + return nil, err + } + } + if query := bilq.withBillingInvoiceManualLines; query != nil { + if err := bilq.loadBillingInvoiceManualLines(ctx, query, nodes, nil, + func(n *BillingInvoiceLine, e *BillingInvoiceManualLineConfig) { n.Edges.BillingInvoiceManualLines = e }); err != nil { + return nil, err + } + } + return nodes, nil +} + +func (bilq *BillingInvoiceLineQuery) loadBillingInvoice(ctx context.Context, query *BillingInvoiceQuery, nodes []*BillingInvoiceLine, init func(*BillingInvoiceLine), assign func(*BillingInvoiceLine, *BillingInvoice)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoiceLine) + for i := range nodes { + fk := nodes[i].InvoiceID + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(billinginvoice.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "invoice_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} +func (bilq *BillingInvoiceLineQuery) loadBillingInvoiceManualLines(ctx context.Context, query *BillingInvoiceManualLineConfigQuery, nodes []*BillingInvoiceLine, init func(*BillingInvoiceLine), assign func(*BillingInvoiceLine, *BillingInvoiceManualLineConfig)) error { + ids := make([]string, 0, len(nodes)) + nodeids := make(map[string][]*BillingInvoiceLine) + for i := range nodes { + if nodes[i].manual_line_config_id == nil { + continue + } + fk := *nodes[i].manual_line_config_id + if _, ok := nodeids[fk]; !ok { + ids = append(ids, fk) + } + nodeids[fk] = append(nodeids[fk], nodes[i]) + } + if len(ids) == 0 { + return nil + } + query.Where(billinginvoicemanuallineconfig.IDIn(ids...)) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + nodes, ok := nodeids[n.ID] + if !ok { + return fmt.Errorf(`unexpected foreign-key "manual_line_config_id" returned %v`, n.ID) + } + for i := range nodes { + assign(nodes[i], n) + } + } + return nil +} + +func (bilq *BillingInvoiceLineQuery) sqlCount(ctx context.Context) (int, error) { + _spec := bilq.querySpec() + if len(bilq.modifiers) > 0 { + _spec.Modifiers = bilq.modifiers + } + _spec.Node.Columns = bilq.ctx.Fields + if len(bilq.ctx.Fields) > 0 { + _spec.Unique = bilq.ctx.Unique != nil && *bilq.ctx.Unique + } + return sqlgraph.CountNodes(ctx, bilq.driver, _spec) +} + +func (bilq *BillingInvoiceLineQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(billinginvoiceline.Table, billinginvoiceline.Columns, sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString)) + _spec.From = bilq.sql + if unique := bilq.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if bilq.path != nil { + _spec.Unique = true + } + if fields := bilq.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceline.FieldID) + for i := range fields { + if fields[i] != billinginvoiceline.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + if bilq.withBillingInvoice != nil { + _spec.Node.AddColumnOnce(billinginvoiceline.FieldInvoiceID) + } + } + if ps := bilq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := bilq.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := bilq.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := bilq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (bilq *BillingInvoiceLineQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(bilq.driver.Dialect()) + t1 := builder.Table(billinginvoiceline.Table) + columns := bilq.ctx.Fields + if len(columns) == 0 { + columns = billinginvoiceline.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if bilq.sql != nil { + selector = bilq.sql + selector.Select(selector.Columns(columns...)...) + } + if bilq.ctx.Unique != nil && *bilq.ctx.Unique { + selector.Distinct() + } + for _, m := range bilq.modifiers { + m(selector) + } + for _, p := range bilq.predicates { + p(selector) + } + for _, p := range bilq.order { + p(selector) + } + if offset := bilq.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := bilq.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (bilq *BillingInvoiceLineQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceLineQuery { + if bilq.driver.Dialect() == dialect.Postgres { + bilq.Unique(false) + } + bilq.modifiers = append(bilq.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return bilq +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (bilq *BillingInvoiceLineQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceLineQuery { + if bilq.driver.Dialect() == dialect.Postgres { + bilq.Unique(false) + } + bilq.modifiers = append(bilq.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return bilq +} + +// BillingInvoiceLineGroupBy is the group-by builder for BillingInvoiceLine entities. +type BillingInvoiceLineGroupBy struct { + selector + build *BillingInvoiceLineQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (bilgb *BillingInvoiceLineGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineGroupBy { + bilgb.fns = append(bilgb.fns, fns...) + return bilgb +} + +// Scan applies the selector query and scans the result into the given value. +func (bilgb *BillingInvoiceLineGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bilgb.build.ctx, ent.OpQueryGroupBy) + if err := bilgb.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BillingInvoiceLineQuery, *BillingInvoiceLineGroupBy](ctx, bilgb.build, bilgb, bilgb.build.inters, v) +} + +func (bilgb *BillingInvoiceLineGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceLineQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(bilgb.fns)) + for _, fn := range bilgb.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*bilgb.flds)+len(bilgb.fns)) + for _, f := range *bilgb.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*bilgb.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bilgb.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// BillingInvoiceLineSelect is the builder for selecting fields of BillingInvoiceLine entities. +type BillingInvoiceLineSelect struct { + *BillingInvoiceLineQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (bils *BillingInvoiceLineSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceLineSelect { + bils.fns = append(bils.fns, fns...) + return bils +} + +// Scan applies the selector query and scans the result into the given value. +func (bils *BillingInvoiceLineSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bils.ctx, ent.OpQuerySelect) + if err := bils.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BillingInvoiceLineQuery, *BillingInvoiceLineSelect](ctx, bils.BillingInvoiceLineQuery, bils, bils.inters, v) +} + +func (bils *BillingInvoiceLineSelect) sqlScan(ctx context.Context, root *BillingInvoiceLineQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(bils.fns)) + for _, fn := range bils.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*bils.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bils.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/openmeter/ent/db/billinginvoiceline_update.go b/openmeter/ent/db/billinginvoiceline_update.go new file mode 100644 index 000000000..55b221181 --- /dev/null +++ b/openmeter/ent/db/billinginvoiceline_update.go @@ -0,0 +1,918 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "errors" + "fmt" + "time" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/alpacahq/alpacadecimal" + billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceLineUpdate is the builder for updating BillingInvoiceLine entities. +type BillingInvoiceLineUpdate struct { + config + hooks []Hook + mutation *BillingInvoiceLineMutation +} + +// Where appends a list predicates to the BillingInvoiceLineUpdate builder. +func (bilu *BillingInvoiceLineUpdate) Where(ps ...predicate.BillingInvoiceLine) *BillingInvoiceLineUpdate { + bilu.mutation.Where(ps...) + return bilu +} + +// SetMetadata sets the "metadata" field. +func (bilu *BillingInvoiceLineUpdate) SetMetadata(m map[string]string) *BillingInvoiceLineUpdate { + bilu.mutation.SetMetadata(m) + return bilu +} + +// ClearMetadata clears the value of the "metadata" field. +func (bilu *BillingInvoiceLineUpdate) ClearMetadata() *BillingInvoiceLineUpdate { + bilu.mutation.ClearMetadata() + return bilu +} + +// SetUpdatedAt sets the "updated_at" field. +func (bilu *BillingInvoiceLineUpdate) SetUpdatedAt(t time.Time) *BillingInvoiceLineUpdate { + bilu.mutation.SetUpdatedAt(t) + return bilu +} + +// SetDeletedAt sets the "deleted_at" field. +func (bilu *BillingInvoiceLineUpdate) SetDeletedAt(t time.Time) *BillingInvoiceLineUpdate { + bilu.mutation.SetDeletedAt(t) + return bilu +} + +// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableDeletedAt(t *time.Time) *BillingInvoiceLineUpdate { + if t != nil { + bilu.SetDeletedAt(*t) + } + return bilu +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (bilu *BillingInvoiceLineUpdate) ClearDeletedAt() *BillingInvoiceLineUpdate { + bilu.mutation.ClearDeletedAt() + return bilu +} + +// SetName sets the "name" field. +func (bilu *BillingInvoiceLineUpdate) SetName(s string) *BillingInvoiceLineUpdate { + bilu.mutation.SetName(s) + return bilu +} + +// SetNillableName sets the "name" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableName(s *string) *BillingInvoiceLineUpdate { + if s != nil { + bilu.SetName(*s) + } + return bilu +} + +// SetDescription sets the "description" field. +func (bilu *BillingInvoiceLineUpdate) SetDescription(s string) *BillingInvoiceLineUpdate { + bilu.mutation.SetDescription(s) + return bilu +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableDescription(s *string) *BillingInvoiceLineUpdate { + if s != nil { + bilu.SetDescription(*s) + } + return bilu +} + +// ClearDescription clears the value of the "description" field. +func (bilu *BillingInvoiceLineUpdate) ClearDescription() *BillingInvoiceLineUpdate { + bilu.mutation.ClearDescription() + return bilu +} + +// SetInvoiceID sets the "invoice_id" field. +func (bilu *BillingInvoiceLineUpdate) SetInvoiceID(s string) *BillingInvoiceLineUpdate { + bilu.mutation.SetInvoiceID(s) + return bilu +} + +// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableInvoiceID(s *string) *BillingInvoiceLineUpdate { + if s != nil { + bilu.SetInvoiceID(*s) + } + return bilu +} + +// SetPeriodStart sets the "period_start" field. +func (bilu *BillingInvoiceLineUpdate) SetPeriodStart(t time.Time) *BillingInvoiceLineUpdate { + bilu.mutation.SetPeriodStart(t) + return bilu +} + +// SetNillablePeriodStart sets the "period_start" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillablePeriodStart(t *time.Time) *BillingInvoiceLineUpdate { + if t != nil { + bilu.SetPeriodStart(*t) + } + return bilu +} + +// SetPeriodEnd sets the "period_end" field. +func (bilu *BillingInvoiceLineUpdate) SetPeriodEnd(t time.Time) *BillingInvoiceLineUpdate { + bilu.mutation.SetPeriodEnd(t) + return bilu +} + +// SetNillablePeriodEnd sets the "period_end" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillablePeriodEnd(t *time.Time) *BillingInvoiceLineUpdate { + if t != nil { + bilu.SetPeriodEnd(*t) + } + return bilu +} + +// SetInvoiceAt sets the "invoice_at" field. +func (bilu *BillingInvoiceLineUpdate) SetInvoiceAt(t time.Time) *BillingInvoiceLineUpdate { + bilu.mutation.SetInvoiceAt(t) + return bilu +} + +// SetNillableInvoiceAt sets the "invoice_at" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableInvoiceAt(t *time.Time) *BillingInvoiceLineUpdate { + if t != nil { + bilu.SetInvoiceAt(*t) + } + return bilu +} + +// SetType sets the "type" field. +func (bilu *BillingInvoiceLineUpdate) SetType(blt billingentity.InvoiceLineType) *BillingInvoiceLineUpdate { + bilu.mutation.SetType(blt) + return bilu +} + +// SetNillableType sets the "type" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableType(blt *billingentity.InvoiceLineType) *BillingInvoiceLineUpdate { + if blt != nil { + bilu.SetType(*blt) + } + return bilu +} + +// SetStatus sets the "status" field. +func (bilu *BillingInvoiceLineUpdate) SetStatus(bls billingentity.InvoiceLineStatus) *BillingInvoiceLineUpdate { + bilu.mutation.SetStatus(bls) + return bilu +} + +// SetNillableStatus sets the "status" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableStatus(bls *billingentity.InvoiceLineStatus) *BillingInvoiceLineUpdate { + if bls != nil { + bilu.SetStatus(*bls) + } + return bilu +} + +// SetQuantity sets the "quantity" field. +func (bilu *BillingInvoiceLineUpdate) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceLineUpdate { + bilu.mutation.SetQuantity(a) + return bilu +} + +// SetNillableQuantity sets the "quantity" field if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceLineUpdate { + if a != nil { + bilu.SetQuantity(*a) + } + return bilu +} + +// ClearQuantity clears the value of the "quantity" field. +func (bilu *BillingInvoiceLineUpdate) ClearQuantity() *BillingInvoiceLineUpdate { + bilu.mutation.ClearQuantity() + return bilu +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (bilu *BillingInvoiceLineUpdate) SetTaxOverrides(bo *billingentity.TaxOverrides) *BillingInvoiceLineUpdate { + bilu.mutation.SetTaxOverrides(bo) + return bilu +} + +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (bilu *BillingInvoiceLineUpdate) ClearTaxOverrides() *BillingInvoiceLineUpdate { + bilu.mutation.ClearTaxOverrides() + return bilu +} + +// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. +func (bilu *BillingInvoiceLineUpdate) SetBillingInvoiceID(id string) *BillingInvoiceLineUpdate { + bilu.mutation.SetBillingInvoiceID(id) + return bilu +} + +// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. +func (bilu *BillingInvoiceLineUpdate) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceLineUpdate { + return bilu.SetBillingInvoiceID(b.ID) +} + +// SetBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID. +func (bilu *BillingInvoiceLineUpdate) SetBillingInvoiceManualLinesID(id string) *BillingInvoiceLineUpdate { + bilu.mutation.SetBillingInvoiceManualLinesID(id) + return bilu +} + +// SetNillableBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID if the given value is not nil. +func (bilu *BillingInvoiceLineUpdate) SetNillableBillingInvoiceManualLinesID(id *string) *BillingInvoiceLineUpdate { + if id != nil { + bilu = bilu.SetBillingInvoiceManualLinesID(*id) + } + return bilu +} + +// SetBillingInvoiceManualLines sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (bilu *BillingInvoiceLineUpdate) SetBillingInvoiceManualLines(b *BillingInvoiceManualLineConfig) *BillingInvoiceLineUpdate { + return bilu.SetBillingInvoiceManualLinesID(b.ID) +} + +// Mutation returns the BillingInvoiceLineMutation object of the builder. +func (bilu *BillingInvoiceLineUpdate) Mutation() *BillingInvoiceLineMutation { + return bilu.mutation +} + +// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. +func (bilu *BillingInvoiceLineUpdate) ClearBillingInvoice() *BillingInvoiceLineUpdate { + bilu.mutation.ClearBillingInvoice() + return bilu +} + +// ClearBillingInvoiceManualLines clears the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (bilu *BillingInvoiceLineUpdate) ClearBillingInvoiceManualLines() *BillingInvoiceLineUpdate { + bilu.mutation.ClearBillingInvoiceManualLines() + return bilu +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (bilu *BillingInvoiceLineUpdate) Save(ctx context.Context) (int, error) { + bilu.defaults() + return withHooks(ctx, bilu.sqlSave, bilu.mutation, bilu.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (bilu *BillingInvoiceLineUpdate) SaveX(ctx context.Context) int { + affected, err := bilu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (bilu *BillingInvoiceLineUpdate) Exec(ctx context.Context) error { + _, err := bilu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bilu *BillingInvoiceLineUpdate) ExecX(ctx context.Context) { + if err := bilu.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (bilu *BillingInvoiceLineUpdate) defaults() { + if _, ok := bilu.mutation.UpdatedAt(); !ok { + v := billinginvoiceline.UpdateDefaultUpdatedAt() + bilu.mutation.SetUpdatedAt(v) + } +} + +// check runs all checks and user-defined validators on the builder. +func (bilu *BillingInvoiceLineUpdate) check() error { + if v, ok := bilu.mutation.GetType(); ok { + if err := billinginvoiceline.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.type": %w`, err)} + } + } + if v, ok := bilu.mutation.Status(); ok { + if err := billinginvoiceline.StatusValidator(v); err != nil { + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.status": %w`, err)} + } + } + if bilu.mutation.BillingInvoiceCleared() && len(bilu.mutation.BillingInvoiceIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoiceLine.billing_invoice"`) + } + return nil +} + +func (bilu *BillingInvoiceLineUpdate) sqlSave(ctx context.Context) (n int, err error) { + if err := bilu.check(); err != nil { + return n, err + } + _spec := sqlgraph.NewUpdateSpec(billinginvoiceline.Table, billinginvoiceline.Columns, sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString)) + if ps := bilu.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := bilu.mutation.Metadata(); ok { + _spec.SetField(billinginvoiceline.FieldMetadata, field.TypeJSON, value) + } + if bilu.mutation.MetadataCleared() { + _spec.ClearField(billinginvoiceline.FieldMetadata, field.TypeJSON) + } + if value, ok := bilu.mutation.UpdatedAt(); ok { + _spec.SetField(billinginvoiceline.FieldUpdatedAt, field.TypeTime, value) + } + if value, ok := bilu.mutation.DeletedAt(); ok { + _spec.SetField(billinginvoiceline.FieldDeletedAt, field.TypeTime, value) + } + if bilu.mutation.DeletedAtCleared() { + _spec.ClearField(billinginvoiceline.FieldDeletedAt, field.TypeTime) + } + if value, ok := bilu.mutation.Name(); ok { + _spec.SetField(billinginvoiceline.FieldName, field.TypeString, value) + } + if value, ok := bilu.mutation.Description(); ok { + _spec.SetField(billinginvoiceline.FieldDescription, field.TypeString, value) + } + if bilu.mutation.DescriptionCleared() { + _spec.ClearField(billinginvoiceline.FieldDescription, field.TypeString) + } + if value, ok := bilu.mutation.PeriodStart(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodStart, field.TypeTime, value) + } + if value, ok := bilu.mutation.PeriodEnd(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodEnd, field.TypeTime, value) + } + if value, ok := bilu.mutation.InvoiceAt(); ok { + _spec.SetField(billinginvoiceline.FieldInvoiceAt, field.TypeTime, value) + } + if value, ok := bilu.mutation.GetType(); ok { + _spec.SetField(billinginvoiceline.FieldType, field.TypeEnum, value) + } + if value, ok := bilu.mutation.Status(); ok { + _spec.SetField(billinginvoiceline.FieldStatus, field.TypeEnum, value) + } + if value, ok := bilu.mutation.Quantity(); ok { + _spec.SetField(billinginvoiceline.FieldQuantity, field.TypeOther, value) + } + if bilu.mutation.QuantityCleared() { + _spec.ClearField(billinginvoiceline.FieldQuantity, field.TypeOther) + } + if value, ok := bilu.mutation.TaxOverrides(); ok { + _spec.SetField(billinginvoiceline.FieldTaxOverrides, field.TypeJSON, value) + } + if bilu.mutation.TaxOverridesCleared() { + _spec.ClearField(billinginvoiceline.FieldTaxOverrides, field.TypeJSON) + } + if bilu.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoiceline.BillingInvoiceTable, + Columns: []string{billinginvoiceline.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bilu.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoiceline.BillingInvoiceTable, + Columns: []string{billinginvoiceline.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if bilu.mutation.BillingInvoiceManualLinesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: billinginvoiceline.BillingInvoiceManualLinesTable, + Columns: []string{billinginvoiceline.BillingInvoiceManualLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := bilu.mutation.BillingInvoiceManualLinesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: billinginvoiceline.BillingInvoiceManualLinesTable, + Columns: []string{billinginvoiceline.BillingInvoiceManualLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if n, err = sqlgraph.UpdateNodes(ctx, bilu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{billinginvoiceline.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + bilu.mutation.done = true + return n, nil +} + +// BillingInvoiceLineUpdateOne is the builder for updating a single BillingInvoiceLine entity. +type BillingInvoiceLineUpdateOne struct { + config + fields []string + hooks []Hook + mutation *BillingInvoiceLineMutation +} + +// SetMetadata sets the "metadata" field. +func (biluo *BillingInvoiceLineUpdateOne) SetMetadata(m map[string]string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetMetadata(m) + return biluo +} + +// ClearMetadata clears the value of the "metadata" field. +func (biluo *BillingInvoiceLineUpdateOne) ClearMetadata() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearMetadata() + return biluo +} + +// SetUpdatedAt sets the "updated_at" field. +func (biluo *BillingInvoiceLineUpdateOne) SetUpdatedAt(t time.Time) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetUpdatedAt(t) + return biluo +} + +// SetDeletedAt sets the "deleted_at" field. +func (biluo *BillingInvoiceLineUpdateOne) SetDeletedAt(t time.Time) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetDeletedAt(t) + return biluo +} + +// SetNillableDeletedAt sets the "deleted_at" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableDeletedAt(t *time.Time) *BillingInvoiceLineUpdateOne { + if t != nil { + biluo.SetDeletedAt(*t) + } + return biluo +} + +// ClearDeletedAt clears the value of the "deleted_at" field. +func (biluo *BillingInvoiceLineUpdateOne) ClearDeletedAt() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearDeletedAt() + return biluo +} + +// SetName sets the "name" field. +func (biluo *BillingInvoiceLineUpdateOne) SetName(s string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetName(s) + return biluo +} + +// SetNillableName sets the "name" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableName(s *string) *BillingInvoiceLineUpdateOne { + if s != nil { + biluo.SetName(*s) + } + return biluo +} + +// SetDescription sets the "description" field. +func (biluo *BillingInvoiceLineUpdateOne) SetDescription(s string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetDescription(s) + return biluo +} + +// SetNillableDescription sets the "description" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableDescription(s *string) *BillingInvoiceLineUpdateOne { + if s != nil { + biluo.SetDescription(*s) + } + return biluo +} + +// ClearDescription clears the value of the "description" field. +func (biluo *BillingInvoiceLineUpdateOne) ClearDescription() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearDescription() + return biluo +} + +// SetInvoiceID sets the "invoice_id" field. +func (biluo *BillingInvoiceLineUpdateOne) SetInvoiceID(s string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetInvoiceID(s) + return biluo +} + +// SetNillableInvoiceID sets the "invoice_id" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableInvoiceID(s *string) *BillingInvoiceLineUpdateOne { + if s != nil { + biluo.SetInvoiceID(*s) + } + return biluo +} + +// SetPeriodStart sets the "period_start" field. +func (biluo *BillingInvoiceLineUpdateOne) SetPeriodStart(t time.Time) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetPeriodStart(t) + return biluo +} + +// SetNillablePeriodStart sets the "period_start" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillablePeriodStart(t *time.Time) *BillingInvoiceLineUpdateOne { + if t != nil { + biluo.SetPeriodStart(*t) + } + return biluo +} + +// SetPeriodEnd sets the "period_end" field. +func (biluo *BillingInvoiceLineUpdateOne) SetPeriodEnd(t time.Time) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetPeriodEnd(t) + return biluo +} + +// SetNillablePeriodEnd sets the "period_end" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillablePeriodEnd(t *time.Time) *BillingInvoiceLineUpdateOne { + if t != nil { + biluo.SetPeriodEnd(*t) + } + return biluo +} + +// SetInvoiceAt sets the "invoice_at" field. +func (biluo *BillingInvoiceLineUpdateOne) SetInvoiceAt(t time.Time) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetInvoiceAt(t) + return biluo +} + +// SetNillableInvoiceAt sets the "invoice_at" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableInvoiceAt(t *time.Time) *BillingInvoiceLineUpdateOne { + if t != nil { + biluo.SetInvoiceAt(*t) + } + return biluo +} + +// SetType sets the "type" field. +func (biluo *BillingInvoiceLineUpdateOne) SetType(blt billingentity.InvoiceLineType) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetType(blt) + return biluo +} + +// SetNillableType sets the "type" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableType(blt *billingentity.InvoiceLineType) *BillingInvoiceLineUpdateOne { + if blt != nil { + biluo.SetType(*blt) + } + return biluo +} + +// SetStatus sets the "status" field. +func (biluo *BillingInvoiceLineUpdateOne) SetStatus(bls billingentity.InvoiceLineStatus) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetStatus(bls) + return biluo +} + +// SetNillableStatus sets the "status" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableStatus(bls *billingentity.InvoiceLineStatus) *BillingInvoiceLineUpdateOne { + if bls != nil { + biluo.SetStatus(*bls) + } + return biluo +} + +// SetQuantity sets the "quantity" field. +func (biluo *BillingInvoiceLineUpdateOne) SetQuantity(a alpacadecimal.Decimal) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetQuantity(a) + return biluo +} + +// SetNillableQuantity sets the "quantity" field if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableQuantity(a *alpacadecimal.Decimal) *BillingInvoiceLineUpdateOne { + if a != nil { + biluo.SetQuantity(*a) + } + return biluo +} + +// ClearQuantity clears the value of the "quantity" field. +func (biluo *BillingInvoiceLineUpdateOne) ClearQuantity() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearQuantity() + return biluo +} + +// SetTaxOverrides sets the "tax_overrides" field. +func (biluo *BillingInvoiceLineUpdateOne) SetTaxOverrides(bo *billingentity.TaxOverrides) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetTaxOverrides(bo) + return biluo +} + +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (biluo *BillingInvoiceLineUpdateOne) ClearTaxOverrides() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearTaxOverrides() + return biluo +} + +// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by ID. +func (biluo *BillingInvoiceLineUpdateOne) SetBillingInvoiceID(id string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetBillingInvoiceID(id) + return biluo +} + +// SetBillingInvoice sets the "billing_invoice" edge to the BillingInvoice entity. +func (biluo *BillingInvoiceLineUpdateOne) SetBillingInvoice(b *BillingInvoice) *BillingInvoiceLineUpdateOne { + return biluo.SetBillingInvoiceID(b.ID) +} + +// SetBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID. +func (biluo *BillingInvoiceLineUpdateOne) SetBillingInvoiceManualLinesID(id string) *BillingInvoiceLineUpdateOne { + biluo.mutation.SetBillingInvoiceManualLinesID(id) + return biluo +} + +// SetNillableBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by ID if the given value is not nil. +func (biluo *BillingInvoiceLineUpdateOne) SetNillableBillingInvoiceManualLinesID(id *string) *BillingInvoiceLineUpdateOne { + if id != nil { + biluo = biluo.SetBillingInvoiceManualLinesID(*id) + } + return biluo +} + +// SetBillingInvoiceManualLines sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (biluo *BillingInvoiceLineUpdateOne) SetBillingInvoiceManualLines(b *BillingInvoiceManualLineConfig) *BillingInvoiceLineUpdateOne { + return biluo.SetBillingInvoiceManualLinesID(b.ID) +} + +// Mutation returns the BillingInvoiceLineMutation object of the builder. +func (biluo *BillingInvoiceLineUpdateOne) Mutation() *BillingInvoiceLineMutation { + return biluo.mutation +} + +// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. +func (biluo *BillingInvoiceLineUpdateOne) ClearBillingInvoice() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearBillingInvoice() + return biluo +} + +// ClearBillingInvoiceManualLines clears the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (biluo *BillingInvoiceLineUpdateOne) ClearBillingInvoiceManualLines() *BillingInvoiceLineUpdateOne { + biluo.mutation.ClearBillingInvoiceManualLines() + return biluo +} + +// Where appends a list predicates to the BillingInvoiceLineUpdate builder. +func (biluo *BillingInvoiceLineUpdateOne) Where(ps ...predicate.BillingInvoiceLine) *BillingInvoiceLineUpdateOne { + biluo.mutation.Where(ps...) + return biluo +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (biluo *BillingInvoiceLineUpdateOne) Select(field string, fields ...string) *BillingInvoiceLineUpdateOne { + biluo.fields = append([]string{field}, fields...) + return biluo +} + +// Save executes the query and returns the updated BillingInvoiceLine entity. +func (biluo *BillingInvoiceLineUpdateOne) Save(ctx context.Context) (*BillingInvoiceLine, error) { + biluo.defaults() + return withHooks(ctx, biluo.sqlSave, biluo.mutation, biluo.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (biluo *BillingInvoiceLineUpdateOne) SaveX(ctx context.Context) *BillingInvoiceLine { + node, err := biluo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (biluo *BillingInvoiceLineUpdateOne) Exec(ctx context.Context) error { + _, err := biluo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (biluo *BillingInvoiceLineUpdateOne) ExecX(ctx context.Context) { + if err := biluo.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (biluo *BillingInvoiceLineUpdateOne) defaults() { + if _, ok := biluo.mutation.UpdatedAt(); !ok { + v := billinginvoiceline.UpdateDefaultUpdatedAt() + biluo.mutation.SetUpdatedAt(v) + } +} + +// check runs all checks and user-defined validators on the builder. +func (biluo *BillingInvoiceLineUpdateOne) check() error { + if v, ok := biluo.mutation.GetType(); ok { + if err := billinginvoiceline.TypeValidator(v); err != nil { + return &ValidationError{Name: "type", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.type": %w`, err)} + } + } + if v, ok := biluo.mutation.Status(); ok { + if err := billinginvoiceline.StatusValidator(v); err != nil { + return &ValidationError{Name: "status", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceLine.status": %w`, err)} + } + } + if biluo.mutation.BillingInvoiceCleared() && len(biluo.mutation.BillingInvoiceIDs()) > 0 { + return errors.New(`db: clearing a required unique edge "BillingInvoiceLine.billing_invoice"`) + } + return nil +} + +func (biluo *BillingInvoiceLineUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceLine, err error) { + if err := biluo.check(); err != nil { + return _node, err + } + _spec := sqlgraph.NewUpdateSpec(billinginvoiceline.Table, billinginvoiceline.Columns, sqlgraph.NewFieldSpec(billinginvoiceline.FieldID, field.TypeString)) + id, ok := biluo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceLine.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := biluo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, billinginvoiceline.FieldID) + for _, f := range fields { + if !billinginvoiceline.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} + } + if f != billinginvoiceline.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := biluo.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := biluo.mutation.Metadata(); ok { + _spec.SetField(billinginvoiceline.FieldMetadata, field.TypeJSON, value) + } + if biluo.mutation.MetadataCleared() { + _spec.ClearField(billinginvoiceline.FieldMetadata, field.TypeJSON) + } + if value, ok := biluo.mutation.UpdatedAt(); ok { + _spec.SetField(billinginvoiceline.FieldUpdatedAt, field.TypeTime, value) + } + if value, ok := biluo.mutation.DeletedAt(); ok { + _spec.SetField(billinginvoiceline.FieldDeletedAt, field.TypeTime, value) + } + if biluo.mutation.DeletedAtCleared() { + _spec.ClearField(billinginvoiceline.FieldDeletedAt, field.TypeTime) + } + if value, ok := biluo.mutation.Name(); ok { + _spec.SetField(billinginvoiceline.FieldName, field.TypeString, value) + } + if value, ok := biluo.mutation.Description(); ok { + _spec.SetField(billinginvoiceline.FieldDescription, field.TypeString, value) + } + if biluo.mutation.DescriptionCleared() { + _spec.ClearField(billinginvoiceline.FieldDescription, field.TypeString) + } + if value, ok := biluo.mutation.PeriodStart(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodStart, field.TypeTime, value) + } + if value, ok := biluo.mutation.PeriodEnd(); ok { + _spec.SetField(billinginvoiceline.FieldPeriodEnd, field.TypeTime, value) + } + if value, ok := biluo.mutation.InvoiceAt(); ok { + _spec.SetField(billinginvoiceline.FieldInvoiceAt, field.TypeTime, value) + } + if value, ok := biluo.mutation.GetType(); ok { + _spec.SetField(billinginvoiceline.FieldType, field.TypeEnum, value) + } + if value, ok := biluo.mutation.Status(); ok { + _spec.SetField(billinginvoiceline.FieldStatus, field.TypeEnum, value) + } + if value, ok := biluo.mutation.Quantity(); ok { + _spec.SetField(billinginvoiceline.FieldQuantity, field.TypeOther, value) + } + if biluo.mutation.QuantityCleared() { + _spec.ClearField(billinginvoiceline.FieldQuantity, field.TypeOther) + } + if value, ok := biluo.mutation.TaxOverrides(); ok { + _spec.SetField(billinginvoiceline.FieldTaxOverrides, field.TypeJSON, value) + } + if biluo.mutation.TaxOverridesCleared() { + _spec.ClearField(billinginvoiceline.FieldTaxOverrides, field.TypeJSON) + } + if biluo.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoiceline.BillingInvoiceTable, + Columns: []string{billinginvoiceline.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := biluo.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: true, + Table: billinginvoiceline.BillingInvoiceTable, + Columns: []string{billinginvoiceline.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + if biluo.mutation.BillingInvoiceManualLinesCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: billinginvoiceline.BillingInvoiceManualLinesTable, + Columns: []string{billinginvoiceline.BillingInvoiceManualLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := biluo.mutation.BillingInvoiceManualLinesIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.M2O, + Inverse: false, + Table: billinginvoiceline.BillingInvoiceManualLinesTable, + Columns: []string{billinginvoiceline.BillingInvoiceManualLinesColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } + _node = &BillingInvoiceLine{config: biluo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, biluo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{billinginvoiceline.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + biluo.mutation.done = true + return _node, nil +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig.go b/openmeter/ent/db/billinginvoicemanuallineconfig.go new file mode 100644 index 000000000..c561320fb --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig.go @@ -0,0 +1,115 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "fmt" + "strings" + + "entgo.io/ent" + "entgo.io/ent/dialect/sql" + "github.com/alpacahq/alpacadecimal" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" +) + +// BillingInvoiceManualLineConfig is the model entity for the BillingInvoiceManualLineConfig schema. +type BillingInvoiceManualLineConfig struct { + config `json:"-"` + // ID of the ent. + ID string `json:"id,omitempty"` + // Namespace holds the value of the "namespace" field. + Namespace string `json:"namespace,omitempty"` + // UnitPrice holds the value of the "unit_price" field. + UnitPrice alpacadecimal.Decimal `json:"unit_price,omitempty"` + selectValues sql.SelectValues +} + +// scanValues returns the types for scanning values from sql.Rows. +func (*BillingInvoiceManualLineConfig) scanValues(columns []string) ([]any, error) { + values := make([]any, len(columns)) + for i := range columns { + switch columns[i] { + case billinginvoicemanuallineconfig.FieldUnitPrice: + values[i] = new(alpacadecimal.Decimal) + case billinginvoicemanuallineconfig.FieldID, billinginvoicemanuallineconfig.FieldNamespace: + values[i] = new(sql.NullString) + default: + values[i] = new(sql.UnknownType) + } + } + return values, nil +} + +// assignValues assigns the values that were returned from sql.Rows (after scanning) +// to the BillingInvoiceManualLineConfig fields. +func (bimlc *BillingInvoiceManualLineConfig) assignValues(columns []string, values []any) error { + if m, n := len(values), len(columns); m < n { + return fmt.Errorf("mismatch number of scan values: %d != %d", m, n) + } + for i := range columns { + switch columns[i] { + case billinginvoicemanuallineconfig.FieldID: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field id", values[i]) + } else if value.Valid { + bimlc.ID = value.String + } + case billinginvoicemanuallineconfig.FieldNamespace: + if value, ok := values[i].(*sql.NullString); !ok { + return fmt.Errorf("unexpected type %T for field namespace", values[i]) + } else if value.Valid { + bimlc.Namespace = value.String + } + case billinginvoicemanuallineconfig.FieldUnitPrice: + if value, ok := values[i].(*alpacadecimal.Decimal); !ok { + return fmt.Errorf("unexpected type %T for field unit_price", values[i]) + } else if value != nil { + bimlc.UnitPrice = *value + } + default: + bimlc.selectValues.Set(columns[i], values[i]) + } + } + return nil +} + +// Value returns the ent.Value that was dynamically selected and assigned to the BillingInvoiceManualLineConfig. +// This includes values selected through modifiers, order, etc. +func (bimlc *BillingInvoiceManualLineConfig) Value(name string) (ent.Value, error) { + return bimlc.selectValues.Get(name) +} + +// Update returns a builder for updating this BillingInvoiceManualLineConfig. +// Note that you need to call BillingInvoiceManualLineConfig.Unwrap() before calling this method if this BillingInvoiceManualLineConfig +// was returned from a transaction, and the transaction was committed or rolled back. +func (bimlc *BillingInvoiceManualLineConfig) Update() *BillingInvoiceManualLineConfigUpdateOne { + return NewBillingInvoiceManualLineConfigClient(bimlc.config).UpdateOne(bimlc) +} + +// Unwrap unwraps the BillingInvoiceManualLineConfig entity that was returned from a transaction after it was closed, +// so that all future queries will be executed through the driver which created the transaction. +func (bimlc *BillingInvoiceManualLineConfig) Unwrap() *BillingInvoiceManualLineConfig { + _tx, ok := bimlc.config.driver.(*txDriver) + if !ok { + panic("db: BillingInvoiceManualLineConfig is not a transactional entity") + } + bimlc.config.driver = _tx.drv + return bimlc +} + +// String implements the fmt.Stringer. +func (bimlc *BillingInvoiceManualLineConfig) String() string { + var builder strings.Builder + builder.WriteString("BillingInvoiceManualLineConfig(") + builder.WriteString(fmt.Sprintf("id=%v, ", bimlc.ID)) + builder.WriteString("namespace=") + builder.WriteString(bimlc.Namespace) + builder.WriteString(", ") + builder.WriteString("unit_price=") + builder.WriteString(fmt.Sprintf("%v", bimlc.UnitPrice)) + builder.WriteByte(')') + return builder.String() +} + +// BillingInvoiceManualLineConfigs is a parsable slice of BillingInvoiceManualLineConfig. +type BillingInvoiceManualLineConfigs []*BillingInvoiceManualLineConfig diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig/billinginvoicemanuallineconfig.go b/openmeter/ent/db/billinginvoicemanuallineconfig/billinginvoicemanuallineconfig.go new file mode 100644 index 000000000..ebea3de00 --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig/billinginvoicemanuallineconfig.go @@ -0,0 +1,62 @@ +// Code generated by ent, DO NOT EDIT. + +package billinginvoicemanuallineconfig + +import ( + "entgo.io/ent/dialect/sql" +) + +const ( + // Label holds the string label denoting the billinginvoicemanuallineconfig type in the database. + Label = "billing_invoice_manual_line_config" + // FieldID holds the string denoting the id field in the database. + FieldID = "id" + // FieldNamespace holds the string denoting the namespace field in the database. + FieldNamespace = "namespace" + // FieldUnitPrice holds the string denoting the unit_price field in the database. + FieldUnitPrice = "unit_price" + // Table holds the table name of the billinginvoicemanuallineconfig in the database. + Table = "billing_invoice_manual_line_configs" +) + +// Columns holds all SQL columns for billinginvoicemanuallineconfig fields. +var Columns = []string{ + FieldID, + FieldNamespace, + FieldUnitPrice, +} + +// ValidColumn reports if the column name is valid (part of the table columns). +func ValidColumn(column string) bool { + for i := range Columns { + if column == Columns[i] { + return true + } + } + return false +} + +var ( + // NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + NamespaceValidator func(string) error + // DefaultID holds the default value on creation for the "id" field. + DefaultID func() string +) + +// OrderOption defines the ordering options for the BillingInvoiceManualLineConfig queries. +type OrderOption func(*sql.Selector) + +// ByID orders the results by the id field. +func ByID(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldID, opts...).ToFunc() +} + +// ByNamespace orders the results by the namespace field. +func ByNamespace(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldNamespace, opts...).ToFunc() +} + +// ByUnitPrice orders the results by the unit_price field. +func ByUnitPrice(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldUnitPrice, opts...).ToFunc() +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig/where.go b/openmeter/ent/db/billinginvoicemanuallineconfig/where.go new file mode 100644 index 000000000..f965c3aab --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig/where.go @@ -0,0 +1,194 @@ +// Code generated by ent, DO NOT EDIT. + +package billinginvoicemanuallineconfig + +import ( + "entgo.io/ent/dialect/sql" + "github.com/alpacahq/alpacadecimal" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// ID filters vertices based on their ID field. +func ID(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldID, id)) +} + +// IDEQ applies the EQ predicate on the ID field. +func IDEQ(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldID, id)) +} + +// IDNEQ applies the NEQ predicate on the ID field. +func IDNEQ(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNEQ(FieldID, id)) +} + +// IDIn applies the In predicate on the ID field. +func IDIn(ids ...string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldIn(FieldID, ids...)) +} + +// IDNotIn applies the NotIn predicate on the ID field. +func IDNotIn(ids ...string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNotIn(FieldID, ids...)) +} + +// IDGT applies the GT predicate on the ID field. +func IDGT(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGT(FieldID, id)) +} + +// IDGTE applies the GTE predicate on the ID field. +func IDGTE(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGTE(FieldID, id)) +} + +// IDLT applies the LT predicate on the ID field. +func IDLT(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLT(FieldID, id)) +} + +// IDLTE applies the LTE predicate on the ID field. +func IDLTE(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLTE(FieldID, id)) +} + +// IDEqualFold applies the EqualFold predicate on the ID field. +func IDEqualFold(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEqualFold(FieldID, id)) +} + +// IDContainsFold applies the ContainsFold predicate on the ID field. +func IDContainsFold(id string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldContainsFold(FieldID, id)) +} + +// Namespace applies equality check predicate on the "namespace" field. It's identical to NamespaceEQ. +func Namespace(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldNamespace, v)) +} + +// UnitPrice applies equality check predicate on the "unit_price" field. It's identical to UnitPriceEQ. +func UnitPrice(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldUnitPrice, v)) +} + +// NamespaceEQ applies the EQ predicate on the "namespace" field. +func NamespaceEQ(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldNamespace, v)) +} + +// NamespaceNEQ applies the NEQ predicate on the "namespace" field. +func NamespaceNEQ(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNEQ(FieldNamespace, v)) +} + +// NamespaceIn applies the In predicate on the "namespace" field. +func NamespaceIn(vs ...string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldIn(FieldNamespace, vs...)) +} + +// NamespaceNotIn applies the NotIn predicate on the "namespace" field. +func NamespaceNotIn(vs ...string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNotIn(FieldNamespace, vs...)) +} + +// NamespaceGT applies the GT predicate on the "namespace" field. +func NamespaceGT(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGT(FieldNamespace, v)) +} + +// NamespaceGTE applies the GTE predicate on the "namespace" field. +func NamespaceGTE(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGTE(FieldNamespace, v)) +} + +// NamespaceLT applies the LT predicate on the "namespace" field. +func NamespaceLT(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLT(FieldNamespace, v)) +} + +// NamespaceLTE applies the LTE predicate on the "namespace" field. +func NamespaceLTE(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLTE(FieldNamespace, v)) +} + +// NamespaceContains applies the Contains predicate on the "namespace" field. +func NamespaceContains(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldContains(FieldNamespace, v)) +} + +// NamespaceHasPrefix applies the HasPrefix predicate on the "namespace" field. +func NamespaceHasPrefix(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldHasPrefix(FieldNamespace, v)) +} + +// NamespaceHasSuffix applies the HasSuffix predicate on the "namespace" field. +func NamespaceHasSuffix(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldHasSuffix(FieldNamespace, v)) +} + +// NamespaceEqualFold applies the EqualFold predicate on the "namespace" field. +func NamespaceEqualFold(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEqualFold(FieldNamespace, v)) +} + +// NamespaceContainsFold applies the ContainsFold predicate on the "namespace" field. +func NamespaceContainsFold(v string) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldContainsFold(FieldNamespace, v)) +} + +// UnitPriceEQ applies the EQ predicate on the "unit_price" field. +func UnitPriceEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldEQ(FieldUnitPrice, v)) +} + +// UnitPriceNEQ applies the NEQ predicate on the "unit_price" field. +func UnitPriceNEQ(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNEQ(FieldUnitPrice, v)) +} + +// UnitPriceIn applies the In predicate on the "unit_price" field. +func UnitPriceIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldIn(FieldUnitPrice, vs...)) +} + +// UnitPriceNotIn applies the NotIn predicate on the "unit_price" field. +func UnitPriceNotIn(vs ...alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldNotIn(FieldUnitPrice, vs...)) +} + +// UnitPriceGT applies the GT predicate on the "unit_price" field. +func UnitPriceGT(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGT(FieldUnitPrice, v)) +} + +// UnitPriceGTE applies the GTE predicate on the "unit_price" field. +func UnitPriceGTE(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldGTE(FieldUnitPrice, v)) +} + +// UnitPriceLT applies the LT predicate on the "unit_price" field. +func UnitPriceLT(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLT(FieldUnitPrice, v)) +} + +// UnitPriceLTE applies the LTE predicate on the "unit_price" field. +func UnitPriceLTE(v alpacadecimal.Decimal) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.FieldLTE(FieldUnitPrice, v)) +} + +// And groups predicates with the AND operator between them. +func And(predicates ...predicate.BillingInvoiceManualLineConfig) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.AndPredicates(predicates...)) +} + +// Or groups predicates with the OR operator between them. +func Or(predicates ...predicate.BillingInvoiceManualLineConfig) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.OrPredicates(predicates...)) +} + +// Not applies the not operator on the given predicate. +func Not(p predicate.BillingInvoiceManualLineConfig) predicate.BillingInvoiceManualLineConfig { + return predicate.BillingInvoiceManualLineConfig(sql.NotPredicates(p)) +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig_create.go b/openmeter/ent/db/billinginvoicemanuallineconfig_create.go new file mode 100644 index 000000000..3d2a3d9bb --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig_create.go @@ -0,0 +1,532 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "errors" + "fmt" + + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/alpacahq/alpacadecimal" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" +) + +// BillingInvoiceManualLineConfigCreate is the builder for creating a BillingInvoiceManualLineConfig entity. +type BillingInvoiceManualLineConfigCreate struct { + config + mutation *BillingInvoiceManualLineConfigMutation + hooks []Hook + conflict []sql.ConflictOption +} + +// SetNamespace sets the "namespace" field. +func (bimlcc *BillingInvoiceManualLineConfigCreate) SetNamespace(s string) *BillingInvoiceManualLineConfigCreate { + bimlcc.mutation.SetNamespace(s) + return bimlcc +} + +// SetUnitPrice sets the "unit_price" field. +func (bimlcc *BillingInvoiceManualLineConfigCreate) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceManualLineConfigCreate { + bimlcc.mutation.SetUnitPrice(a) + return bimlcc +} + +// SetID sets the "id" field. +func (bimlcc *BillingInvoiceManualLineConfigCreate) SetID(s string) *BillingInvoiceManualLineConfigCreate { + bimlcc.mutation.SetID(s) + return bimlcc +} + +// SetNillableID sets the "id" field if the given value is not nil. +func (bimlcc *BillingInvoiceManualLineConfigCreate) SetNillableID(s *string) *BillingInvoiceManualLineConfigCreate { + if s != nil { + bimlcc.SetID(*s) + } + return bimlcc +} + +// Mutation returns the BillingInvoiceManualLineConfigMutation object of the builder. +func (bimlcc *BillingInvoiceManualLineConfigCreate) Mutation() *BillingInvoiceManualLineConfigMutation { + return bimlcc.mutation +} + +// Save creates the BillingInvoiceManualLineConfig in the database. +func (bimlcc *BillingInvoiceManualLineConfigCreate) Save(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + bimlcc.defaults() + return withHooks(ctx, bimlcc.sqlSave, bimlcc.mutation, bimlcc.hooks) +} + +// SaveX calls Save and panics if Save returns an error. +func (bimlcc *BillingInvoiceManualLineConfigCreate) SaveX(ctx context.Context) *BillingInvoiceManualLineConfig { + v, err := bimlcc.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bimlcc *BillingInvoiceManualLineConfigCreate) Exec(ctx context.Context) error { + _, err := bimlcc.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlcc *BillingInvoiceManualLineConfigCreate) ExecX(ctx context.Context) { + if err := bimlcc.Exec(ctx); err != nil { + panic(err) + } +} + +// defaults sets the default values of the builder before save. +func (bimlcc *BillingInvoiceManualLineConfigCreate) defaults() { + if _, ok := bimlcc.mutation.ID(); !ok { + v := billinginvoicemanuallineconfig.DefaultID() + bimlcc.mutation.SetID(v) + } +} + +// check runs all checks and user-defined validators on the builder. +func (bimlcc *BillingInvoiceManualLineConfigCreate) check() error { + if _, ok := bimlcc.mutation.Namespace(); !ok { + return &ValidationError{Name: "namespace", err: errors.New(`db: missing required field "BillingInvoiceManualLineConfig.namespace"`)} + } + if v, ok := bimlcc.mutation.Namespace(); ok { + if err := billinginvoicemanuallineconfig.NamespaceValidator(v); err != nil { + return &ValidationError{Name: "namespace", err: fmt.Errorf(`db: validator failed for field "BillingInvoiceManualLineConfig.namespace": %w`, err)} + } + } + if _, ok := bimlcc.mutation.UnitPrice(); !ok { + return &ValidationError{Name: "unit_price", err: errors.New(`db: missing required field "BillingInvoiceManualLineConfig.unit_price"`)} + } + return nil +} + +func (bimlcc *BillingInvoiceManualLineConfigCreate) sqlSave(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + if err := bimlcc.check(); err != nil { + return nil, err + } + _node, _spec := bimlcc.createSpec() + if err := sqlgraph.CreateNode(ctx, bimlcc.driver, _spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + if _spec.ID.Value != nil { + if id, ok := _spec.ID.Value.(string); ok { + _node.ID = id + } else { + return nil, fmt.Errorf("unexpected BillingInvoiceManualLineConfig.ID type: %T", _spec.ID.Value) + } + } + bimlcc.mutation.id = &_node.ID + bimlcc.mutation.done = true + return _node, nil +} + +func (bimlcc *BillingInvoiceManualLineConfigCreate) createSpec() (*BillingInvoiceManualLineConfig, *sqlgraph.CreateSpec) { + var ( + _node = &BillingInvoiceManualLineConfig{config: bimlcc.config} + _spec = sqlgraph.NewCreateSpec(billinginvoicemanuallineconfig.Table, sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString)) + ) + _spec.OnConflict = bimlcc.conflict + if id, ok := bimlcc.mutation.ID(); ok { + _node.ID = id + _spec.ID.Value = id + } + if value, ok := bimlcc.mutation.Namespace(); ok { + _spec.SetField(billinginvoicemanuallineconfig.FieldNamespace, field.TypeString, value) + _node.Namespace = value + } + if value, ok := bimlcc.mutation.UnitPrice(); ok { + _spec.SetField(billinginvoicemanuallineconfig.FieldUnitPrice, field.TypeOther, value) + _node.UnitPrice = value + } + return _node, _spec +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoiceManualLineConfig.Create(). +// SetNamespace(v). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceManualLineConfigUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bimlcc *BillingInvoiceManualLineConfigCreate) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceManualLineConfigUpsertOne { + bimlcc.conflict = opts + return &BillingInvoiceManualLineConfigUpsertOne{ + create: bimlcc, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (bimlcc *BillingInvoiceManualLineConfigCreate) OnConflictColumns(columns ...string) *BillingInvoiceManualLineConfigUpsertOne { + bimlcc.conflict = append(bimlcc.conflict, sql.ConflictColumns(columns...)) + return &BillingInvoiceManualLineConfigUpsertOne{ + create: bimlcc, + } +} + +type ( + // BillingInvoiceManualLineConfigUpsertOne is the builder for "upsert"-ing + // one BillingInvoiceManualLineConfig node. + BillingInvoiceManualLineConfigUpsertOne struct { + create *BillingInvoiceManualLineConfigCreate + } + + // BillingInvoiceManualLineConfigUpsert is the "OnConflict" setter. + BillingInvoiceManualLineConfigUpsert struct { + *sql.UpdateSet + } +) + +// SetUnitPrice sets the "unit_price" field. +func (u *BillingInvoiceManualLineConfigUpsert) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpsert { + u.Set(billinginvoicemanuallineconfig.FieldUnitPrice, v) + return u +} + +// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. +func (u *BillingInvoiceManualLineConfigUpsert) UpdateUnitPrice() *BillingInvoiceManualLineConfigUpsert { + u.SetExcluded(billinginvoicemanuallineconfig.FieldUnitPrice) + return u +} + +// UpdateNewValues updates the mutable fields using the new values that were set on create except the ID field. +// Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// sql.ResolveWith(func(u *sql.UpdateSet) { +// u.SetIgnore(billinginvoicemanuallineconfig.FieldID) +// }), +// ). +// Exec(ctx) +func (u *BillingInvoiceManualLineConfigUpsertOne) UpdateNewValues() *BillingInvoiceManualLineConfigUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + if _, exists := u.create.mutation.ID(); exists { + s.SetIgnore(billinginvoicemanuallineconfig.FieldID) + } + if _, exists := u.create.mutation.Namespace(); exists { + s.SetIgnore(billinginvoicemanuallineconfig.FieldNamespace) + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceManualLineConfigUpsertOne) Ignore() *BillingInvoiceManualLineConfigUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BillingInvoiceManualLineConfigUpsertOne) DoNothing() *BillingInvoiceManualLineConfigUpsertOne { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceManualLineConfigCreate.OnConflict +// documentation for more info. +func (u *BillingInvoiceManualLineConfigUpsertOne) Update(set func(*BillingInvoiceManualLineConfigUpsert)) *BillingInvoiceManualLineConfigUpsertOne { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BillingInvoiceManualLineConfigUpsert{UpdateSet: update}) + })) + return u +} + +// SetUnitPrice sets the "unit_price" field. +func (u *BillingInvoiceManualLineConfigUpsertOne) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpsertOne { + return u.Update(func(s *BillingInvoiceManualLineConfigUpsert) { + s.SetUnitPrice(v) + }) +} + +// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. +func (u *BillingInvoiceManualLineConfigUpsertOne) UpdateUnitPrice() *BillingInvoiceManualLineConfigUpsertOne { + return u.Update(func(s *BillingInvoiceManualLineConfigUpsert) { + s.UpdateUnitPrice() + }) +} + +// Exec executes the query. +func (u *BillingInvoiceManualLineConfigUpsertOne) Exec(ctx context.Context) error { + if len(u.create.conflict) == 0 { + return errors.New("db: missing options for BillingInvoiceManualLineConfigCreate.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BillingInvoiceManualLineConfigUpsertOne) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} + +// Exec executes the UPSERT query and returns the inserted/updated ID. +func (u *BillingInvoiceManualLineConfigUpsertOne) ID(ctx context.Context) (id string, err error) { + if u.create.driver.Dialect() == dialect.MySQL { + // In case of "ON CONFLICT", there is no way to get back non-numeric ID + // fields from the database since MySQL does not support the RETURNING clause. + return id, errors.New("db: BillingInvoiceManualLineConfigUpsertOne.ID is not supported by MySQL driver. Use BillingInvoiceManualLineConfigUpsertOne.Exec instead") + } + node, err := u.create.Save(ctx) + if err != nil { + return id, err + } + return node.ID, nil +} + +// IDX is like ID, but panics if an error occurs. +func (u *BillingInvoiceManualLineConfigUpsertOne) IDX(ctx context.Context) string { + id, err := u.ID(ctx) + if err != nil { + panic(err) + } + return id +} + +// BillingInvoiceManualLineConfigCreateBulk is the builder for creating many BillingInvoiceManualLineConfig entities in bulk. +type BillingInvoiceManualLineConfigCreateBulk struct { + config + err error + builders []*BillingInvoiceManualLineConfigCreate + conflict []sql.ConflictOption +} + +// Save creates the BillingInvoiceManualLineConfig entities in the database. +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) Save(ctx context.Context) ([]*BillingInvoiceManualLineConfig, error) { + if bimlccb.err != nil { + return nil, bimlccb.err + } + specs := make([]*sqlgraph.CreateSpec, len(bimlccb.builders)) + nodes := make([]*BillingInvoiceManualLineConfig, len(bimlccb.builders)) + mutators := make([]Mutator, len(bimlccb.builders)) + for i := range bimlccb.builders { + func(i int, root context.Context) { + builder := bimlccb.builders[i] + builder.defaults() + var mut Mutator = MutateFunc(func(ctx context.Context, m Mutation) (Value, error) { + mutation, ok := m.(*BillingInvoiceManualLineConfigMutation) + if !ok { + return nil, fmt.Errorf("unexpected mutation type %T", m) + } + if err := builder.check(); err != nil { + return nil, err + } + builder.mutation = mutation + var err error + nodes[i], specs[i] = builder.createSpec() + if i < len(mutators)-1 { + _, err = mutators[i+1].Mutate(root, bimlccb.builders[i+1].mutation) + } else { + spec := &sqlgraph.BatchCreateSpec{Nodes: specs} + spec.OnConflict = bimlccb.conflict + // Invoke the actual operation on the latest mutation in the chain. + if err = sqlgraph.BatchCreate(ctx, bimlccb.driver, spec); err != nil { + if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + } + } + if err != nil { + return nil, err + } + mutation.id = &nodes[i].ID + mutation.done = true + return nodes[i], nil + }) + for i := len(builder.hooks) - 1; i >= 0; i-- { + mut = builder.hooks[i](mut) + } + mutators[i] = mut + }(i, ctx) + } + if len(mutators) > 0 { + if _, err := mutators[0].Mutate(ctx, bimlccb.builders[0].mutation); err != nil { + return nil, err + } + } + return nodes, nil +} + +// SaveX is like Save, but panics if an error occurs. +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) SaveX(ctx context.Context) []*BillingInvoiceManualLineConfig { + v, err := bimlccb.Save(ctx) + if err != nil { + panic(err) + } + return v +} + +// Exec executes the query. +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) Exec(ctx context.Context) error { + _, err := bimlccb.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) ExecX(ctx context.Context) { + if err := bimlccb.Exec(ctx); err != nil { + panic(err) + } +} + +// OnConflict allows configuring the `ON CONFLICT` / `ON DUPLICATE KEY` clause +// of the `INSERT` statement. For example: +// +// client.BillingInvoiceManualLineConfig.CreateBulk(builders...). +// OnConflict( +// // Update the row with the new values +// // the was proposed for insertion. +// sql.ResolveWithNewValues(), +// ). +// // Override some of the fields with custom +// // update values. +// Update(func(u *ent.BillingInvoiceManualLineConfigUpsert) { +// SetNamespace(v+v). +// }). +// Exec(ctx) +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) OnConflict(opts ...sql.ConflictOption) *BillingInvoiceManualLineConfigUpsertBulk { + bimlccb.conflict = opts + return &BillingInvoiceManualLineConfigUpsertBulk{ + create: bimlccb, + } +} + +// OnConflictColumns calls `OnConflict` and configures the columns +// as conflict target. Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict(sql.ConflictColumns(columns...)). +// Exec(ctx) +func (bimlccb *BillingInvoiceManualLineConfigCreateBulk) OnConflictColumns(columns ...string) *BillingInvoiceManualLineConfigUpsertBulk { + bimlccb.conflict = append(bimlccb.conflict, sql.ConflictColumns(columns...)) + return &BillingInvoiceManualLineConfigUpsertBulk{ + create: bimlccb, + } +} + +// BillingInvoiceManualLineConfigUpsertBulk is the builder for "upsert"-ing +// a bulk of BillingInvoiceManualLineConfig nodes. +type BillingInvoiceManualLineConfigUpsertBulk struct { + create *BillingInvoiceManualLineConfigCreateBulk +} + +// UpdateNewValues updates the mutable fields using the new values that +// were set on create. Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict( +// sql.ResolveWithNewValues(), +// sql.ResolveWith(func(u *sql.UpdateSet) { +// u.SetIgnore(billinginvoicemanuallineconfig.FieldID) +// }), +// ). +// Exec(ctx) +func (u *BillingInvoiceManualLineConfigUpsertBulk) UpdateNewValues() *BillingInvoiceManualLineConfigUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithNewValues()) + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(s *sql.UpdateSet) { + for _, b := range u.create.builders { + if _, exists := b.mutation.ID(); exists { + s.SetIgnore(billinginvoicemanuallineconfig.FieldID) + } + if _, exists := b.mutation.Namespace(); exists { + s.SetIgnore(billinginvoicemanuallineconfig.FieldNamespace) + } + } + })) + return u +} + +// Ignore sets each column to itself in case of conflict. +// Using this option is equivalent to using: +// +// client.BillingInvoiceManualLineConfig.Create(). +// OnConflict(sql.ResolveWithIgnore()). +// Exec(ctx) +func (u *BillingInvoiceManualLineConfigUpsertBulk) Ignore() *BillingInvoiceManualLineConfigUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWithIgnore()) + return u +} + +// DoNothing configures the conflict_action to `DO NOTHING`. +// Supported only by SQLite and PostgreSQL. +func (u *BillingInvoiceManualLineConfigUpsertBulk) DoNothing() *BillingInvoiceManualLineConfigUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.DoNothing()) + return u +} + +// Update allows overriding fields `UPDATE` values. See the BillingInvoiceManualLineConfigCreateBulk.OnConflict +// documentation for more info. +func (u *BillingInvoiceManualLineConfigUpsertBulk) Update(set func(*BillingInvoiceManualLineConfigUpsert)) *BillingInvoiceManualLineConfigUpsertBulk { + u.create.conflict = append(u.create.conflict, sql.ResolveWith(func(update *sql.UpdateSet) { + set(&BillingInvoiceManualLineConfigUpsert{UpdateSet: update}) + })) + return u +} + +// SetUnitPrice sets the "unit_price" field. +func (u *BillingInvoiceManualLineConfigUpsertBulk) SetUnitPrice(v alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpsertBulk { + return u.Update(func(s *BillingInvoiceManualLineConfigUpsert) { + s.SetUnitPrice(v) + }) +} + +// UpdateUnitPrice sets the "unit_price" field to the value that was provided on create. +func (u *BillingInvoiceManualLineConfigUpsertBulk) UpdateUnitPrice() *BillingInvoiceManualLineConfigUpsertBulk { + return u.Update(func(s *BillingInvoiceManualLineConfigUpsert) { + s.UpdateUnitPrice() + }) +} + +// Exec executes the query. +func (u *BillingInvoiceManualLineConfigUpsertBulk) Exec(ctx context.Context) error { + if u.create.err != nil { + return u.create.err + } + for i, b := range u.create.builders { + if len(b.conflict) != 0 { + return fmt.Errorf("db: OnConflict was set for builder %d. Set it on the BillingInvoiceManualLineConfigCreateBulk instead", i) + } + } + if len(u.create.conflict) == 0 { + return errors.New("db: missing options for BillingInvoiceManualLineConfigCreateBulk.OnConflict") + } + return u.create.Exec(ctx) +} + +// ExecX is like Exec, but panics if an error occurs. +func (u *BillingInvoiceManualLineConfigUpsertBulk) ExecX(ctx context.Context) { + if err := u.create.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig_delete.go b/openmeter/ent/db/billinginvoicemanuallineconfig_delete.go new file mode 100644 index 000000000..9d4aaf1d7 --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig_delete.go @@ -0,0 +1,88 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceManualLineConfigDelete is the builder for deleting a BillingInvoiceManualLineConfig entity. +type BillingInvoiceManualLineConfigDelete struct { + config + hooks []Hook + mutation *BillingInvoiceManualLineConfigMutation +} + +// Where appends a list predicates to the BillingInvoiceManualLineConfigDelete builder. +func (bimlcd *BillingInvoiceManualLineConfigDelete) Where(ps ...predicate.BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigDelete { + bimlcd.mutation.Where(ps...) + return bimlcd +} + +// Exec executes the deletion query and returns how many vertices were deleted. +func (bimlcd *BillingInvoiceManualLineConfigDelete) Exec(ctx context.Context) (int, error) { + return withHooks(ctx, bimlcd.sqlExec, bimlcd.mutation, bimlcd.hooks) +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlcd *BillingInvoiceManualLineConfigDelete) ExecX(ctx context.Context) int { + n, err := bimlcd.Exec(ctx) + if err != nil { + panic(err) + } + return n +} + +func (bimlcd *BillingInvoiceManualLineConfigDelete) sqlExec(ctx context.Context) (int, error) { + _spec := sqlgraph.NewDeleteSpec(billinginvoicemanuallineconfig.Table, sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString)) + if ps := bimlcd.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + affected, err := sqlgraph.DeleteNodes(ctx, bimlcd.driver, _spec) + if err != nil && sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + bimlcd.mutation.done = true + return affected, err +} + +// BillingInvoiceManualLineConfigDeleteOne is the builder for deleting a single BillingInvoiceManualLineConfig entity. +type BillingInvoiceManualLineConfigDeleteOne struct { + bimlcd *BillingInvoiceManualLineConfigDelete +} + +// Where appends a list predicates to the BillingInvoiceManualLineConfigDelete builder. +func (bimlcdo *BillingInvoiceManualLineConfigDeleteOne) Where(ps ...predicate.BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigDeleteOne { + bimlcdo.bimlcd.mutation.Where(ps...) + return bimlcdo +} + +// Exec executes the deletion query. +func (bimlcdo *BillingInvoiceManualLineConfigDeleteOne) Exec(ctx context.Context) error { + n, err := bimlcdo.bimlcd.Exec(ctx) + switch { + case err != nil: + return err + case n == 0: + return &NotFoundError{billinginvoicemanuallineconfig.Label} + default: + return nil + } +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlcdo *BillingInvoiceManualLineConfigDeleteOne) ExecX(ctx context.Context) { + if err := bimlcdo.Exec(ctx); err != nil { + panic(err) + } +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig_query.go b/openmeter/ent/db/billinginvoicemanuallineconfig_query.go new file mode 100644 index 000000000..393d6efd2 --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig_query.go @@ -0,0 +1,564 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "fmt" + "math" + + "entgo.io/ent" + "entgo.io/ent/dialect" + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceManualLineConfigQuery is the builder for querying BillingInvoiceManualLineConfig entities. +type BillingInvoiceManualLineConfigQuery struct { + config + ctx *QueryContext + order []billinginvoicemanuallineconfig.OrderOption + inters []Interceptor + predicates []predicate.BillingInvoiceManualLineConfig + modifiers []func(*sql.Selector) + // intermediate query (i.e. traversal path). + sql *sql.Selector + path func(context.Context) (*sql.Selector, error) +} + +// Where adds a new predicate for the BillingInvoiceManualLineConfigQuery builder. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Where(ps ...predicate.BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigQuery { + bimlcq.predicates = append(bimlcq.predicates, ps...) + return bimlcq +} + +// Limit the number of records to be returned by this query. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Limit(limit int) *BillingInvoiceManualLineConfigQuery { + bimlcq.ctx.Limit = &limit + return bimlcq +} + +// Offset to start from. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Offset(offset int) *BillingInvoiceManualLineConfigQuery { + bimlcq.ctx.Offset = &offset + return bimlcq +} + +// Unique configures the query builder to filter duplicate records on query. +// By default, unique is set to true, and can be disabled using this method. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Unique(unique bool) *BillingInvoiceManualLineConfigQuery { + bimlcq.ctx.Unique = &unique + return bimlcq +} + +// Order specifies how the records should be ordered. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Order(o ...billinginvoicemanuallineconfig.OrderOption) *BillingInvoiceManualLineConfigQuery { + bimlcq.order = append(bimlcq.order, o...) + return bimlcq +} + +// First returns the first BillingInvoiceManualLineConfig entity from the query. +// Returns a *NotFoundError when no BillingInvoiceManualLineConfig was found. +func (bimlcq *BillingInvoiceManualLineConfigQuery) First(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + nodes, err := bimlcq.Limit(1).All(setContextOp(ctx, bimlcq.ctx, ent.OpQueryFirst)) + if err != nil { + return nil, err + } + if len(nodes) == 0 { + return nil, &NotFoundError{billinginvoicemanuallineconfig.Label} + } + return nodes[0], nil +} + +// FirstX is like First, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) FirstX(ctx context.Context) *BillingInvoiceManualLineConfig { + node, err := bimlcq.First(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return node +} + +// FirstID returns the first BillingInvoiceManualLineConfig ID from the query. +// Returns a *NotFoundError when no BillingInvoiceManualLineConfig ID was found. +func (bimlcq *BillingInvoiceManualLineConfigQuery) FirstID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bimlcq.Limit(1).IDs(setContextOp(ctx, bimlcq.ctx, ent.OpQueryFirstID)); err != nil { + return + } + if len(ids) == 0 { + err = &NotFoundError{billinginvoicemanuallineconfig.Label} + return + } + return ids[0], nil +} + +// FirstIDX is like FirstID, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) FirstIDX(ctx context.Context) string { + id, err := bimlcq.FirstID(ctx) + if err != nil && !IsNotFound(err) { + panic(err) + } + return id +} + +// Only returns a single BillingInvoiceManualLineConfig entity found by the query, ensuring it only returns one. +// Returns a *NotSingularError when more than one BillingInvoiceManualLineConfig entity is found. +// Returns a *NotFoundError when no BillingInvoiceManualLineConfig entities are found. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Only(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + nodes, err := bimlcq.Limit(2).All(setContextOp(ctx, bimlcq.ctx, ent.OpQueryOnly)) + if err != nil { + return nil, err + } + switch len(nodes) { + case 1: + return nodes[0], nil + case 0: + return nil, &NotFoundError{billinginvoicemanuallineconfig.Label} + default: + return nil, &NotSingularError{billinginvoicemanuallineconfig.Label} + } +} + +// OnlyX is like Only, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) OnlyX(ctx context.Context) *BillingInvoiceManualLineConfig { + node, err := bimlcq.Only(ctx) + if err != nil { + panic(err) + } + return node +} + +// OnlyID is like Only, but returns the only BillingInvoiceManualLineConfig ID in the query. +// Returns a *NotSingularError when more than one BillingInvoiceManualLineConfig ID is found. +// Returns a *NotFoundError when no entities are found. +func (bimlcq *BillingInvoiceManualLineConfigQuery) OnlyID(ctx context.Context) (id string, err error) { + var ids []string + if ids, err = bimlcq.Limit(2).IDs(setContextOp(ctx, bimlcq.ctx, ent.OpQueryOnlyID)); err != nil { + return + } + switch len(ids) { + case 1: + id = ids[0] + case 0: + err = &NotFoundError{billinginvoicemanuallineconfig.Label} + default: + err = &NotSingularError{billinginvoicemanuallineconfig.Label} + } + return +} + +// OnlyIDX is like OnlyID, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) OnlyIDX(ctx context.Context) string { + id, err := bimlcq.OnlyID(ctx) + if err != nil { + panic(err) + } + return id +} + +// All executes the query and returns a list of BillingInvoiceManualLineConfigs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) All(ctx context.Context) ([]*BillingInvoiceManualLineConfig, error) { + ctx = setContextOp(ctx, bimlcq.ctx, ent.OpQueryAll) + if err := bimlcq.prepareQuery(ctx); err != nil { + return nil, err + } + qr := querierAll[[]*BillingInvoiceManualLineConfig, *BillingInvoiceManualLineConfigQuery]() + return withInterceptors[[]*BillingInvoiceManualLineConfig](ctx, bimlcq, qr, bimlcq.inters) +} + +// AllX is like All, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) AllX(ctx context.Context) []*BillingInvoiceManualLineConfig { + nodes, err := bimlcq.All(ctx) + if err != nil { + panic(err) + } + return nodes +} + +// IDs executes the query and returns a list of BillingInvoiceManualLineConfig IDs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) IDs(ctx context.Context) (ids []string, err error) { + if bimlcq.ctx.Unique == nil && bimlcq.path != nil { + bimlcq.Unique(true) + } + ctx = setContextOp(ctx, bimlcq.ctx, ent.OpQueryIDs) + if err = bimlcq.Select(billinginvoicemanuallineconfig.FieldID).Scan(ctx, &ids); err != nil { + return nil, err + } + return ids, nil +} + +// IDsX is like IDs, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) IDsX(ctx context.Context) []string { + ids, err := bimlcq.IDs(ctx) + if err != nil { + panic(err) + } + return ids +} + +// Count returns the count of the given query. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Count(ctx context.Context) (int, error) { + ctx = setContextOp(ctx, bimlcq.ctx, ent.OpQueryCount) + if err := bimlcq.prepareQuery(ctx); err != nil { + return 0, err + } + return withInterceptors[int](ctx, bimlcq, querierCount[*BillingInvoiceManualLineConfigQuery](), bimlcq.inters) +} + +// CountX is like Count, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) CountX(ctx context.Context) int { + count, err := bimlcq.Count(ctx) + if err != nil { + panic(err) + } + return count +} + +// Exist returns true if the query has elements in the graph. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Exist(ctx context.Context) (bool, error) { + ctx = setContextOp(ctx, bimlcq.ctx, ent.OpQueryExist) + switch _, err := bimlcq.FirstID(ctx); { + case IsNotFound(err): + return false, nil + case err != nil: + return false, fmt.Errorf("db: check existence: %w", err) + default: + return true, nil + } +} + +// ExistX is like Exist, but panics if an error occurs. +func (bimlcq *BillingInvoiceManualLineConfigQuery) ExistX(ctx context.Context) bool { + exist, err := bimlcq.Exist(ctx) + if err != nil { + panic(err) + } + return exist +} + +// Clone returns a duplicate of the BillingInvoiceManualLineConfigQuery builder, including all associated steps. It can be +// used to prepare common query builders and use them differently after the clone is made. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Clone() *BillingInvoiceManualLineConfigQuery { + if bimlcq == nil { + return nil + } + return &BillingInvoiceManualLineConfigQuery{ + config: bimlcq.config, + ctx: bimlcq.ctx.Clone(), + order: append([]billinginvoicemanuallineconfig.OrderOption{}, bimlcq.order...), + inters: append([]Interceptor{}, bimlcq.inters...), + predicates: append([]predicate.BillingInvoiceManualLineConfig{}, bimlcq.predicates...), + // clone intermediate query. + sql: bimlcq.sql.Clone(), + path: bimlcq.path, + } +} + +// GroupBy is used to group vertices by one or more fields/columns. +// It is often used with aggregate functions, like: count, max, mean, min, sum. +// +// Example: +// +// var v []struct { +// Namespace string `json:"namespace,omitempty"` +// Count int `json:"count,omitempty"` +// } +// +// client.BillingInvoiceManualLineConfig.Query(). +// GroupBy(billinginvoicemanuallineconfig.FieldNamespace). +// Aggregate(db.Count()). +// Scan(ctx, &v) +func (bimlcq *BillingInvoiceManualLineConfigQuery) GroupBy(field string, fields ...string) *BillingInvoiceManualLineConfigGroupBy { + bimlcq.ctx.Fields = append([]string{field}, fields...) + grbuild := &BillingInvoiceManualLineConfigGroupBy{build: bimlcq} + grbuild.flds = &bimlcq.ctx.Fields + grbuild.label = billinginvoicemanuallineconfig.Label + grbuild.scan = grbuild.Scan + return grbuild +} + +// Select allows the selection one or more fields/columns for the given query, +// instead of selecting all fields in the entity. +// +// Example: +// +// var v []struct { +// Namespace string `json:"namespace,omitempty"` +// } +// +// client.BillingInvoiceManualLineConfig.Query(). +// Select(billinginvoicemanuallineconfig.FieldNamespace). +// Scan(ctx, &v) +func (bimlcq *BillingInvoiceManualLineConfigQuery) Select(fields ...string) *BillingInvoiceManualLineConfigSelect { + bimlcq.ctx.Fields = append(bimlcq.ctx.Fields, fields...) + sbuild := &BillingInvoiceManualLineConfigSelect{BillingInvoiceManualLineConfigQuery: bimlcq} + sbuild.label = billinginvoicemanuallineconfig.Label + sbuild.flds, sbuild.scan = &bimlcq.ctx.Fields, sbuild.Scan + return sbuild +} + +// Aggregate returns a BillingInvoiceManualLineConfigSelect configured with the given aggregations. +func (bimlcq *BillingInvoiceManualLineConfigQuery) Aggregate(fns ...AggregateFunc) *BillingInvoiceManualLineConfigSelect { + return bimlcq.Select().Aggregate(fns...) +} + +func (bimlcq *BillingInvoiceManualLineConfigQuery) prepareQuery(ctx context.Context) error { + for _, inter := range bimlcq.inters { + if inter == nil { + return fmt.Errorf("db: uninitialized interceptor (forgotten import db/runtime?)") + } + if trv, ok := inter.(Traverser); ok { + if err := trv.Traverse(ctx, bimlcq); err != nil { + return err + } + } + } + for _, f := range bimlcq.ctx.Fields { + if !billinginvoicemanuallineconfig.ValidColumn(f) { + return &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} + } + } + if bimlcq.path != nil { + prev, err := bimlcq.path(ctx) + if err != nil { + return err + } + bimlcq.sql = prev + } + return nil +} + +func (bimlcq *BillingInvoiceManualLineConfigQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*BillingInvoiceManualLineConfig, error) { + var ( + nodes = []*BillingInvoiceManualLineConfig{} + _spec = bimlcq.querySpec() + ) + _spec.ScanValues = func(columns []string) ([]any, error) { + return (*BillingInvoiceManualLineConfig).scanValues(nil, columns) + } + _spec.Assign = func(columns []string, values []any) error { + node := &BillingInvoiceManualLineConfig{config: bimlcq.config} + nodes = append(nodes, node) + return node.assignValues(columns, values) + } + if len(bimlcq.modifiers) > 0 { + _spec.Modifiers = bimlcq.modifiers + } + for i := range hooks { + hooks[i](ctx, _spec) + } + if err := sqlgraph.QueryNodes(ctx, bimlcq.driver, _spec); err != nil { + return nil, err + } + if len(nodes) == 0 { + return nodes, nil + } + return nodes, nil +} + +func (bimlcq *BillingInvoiceManualLineConfigQuery) sqlCount(ctx context.Context) (int, error) { + _spec := bimlcq.querySpec() + if len(bimlcq.modifiers) > 0 { + _spec.Modifiers = bimlcq.modifiers + } + _spec.Node.Columns = bimlcq.ctx.Fields + if len(bimlcq.ctx.Fields) > 0 { + _spec.Unique = bimlcq.ctx.Unique != nil && *bimlcq.ctx.Unique + } + return sqlgraph.CountNodes(ctx, bimlcq.driver, _spec) +} + +func (bimlcq *BillingInvoiceManualLineConfigQuery) querySpec() *sqlgraph.QuerySpec { + _spec := sqlgraph.NewQuerySpec(billinginvoicemanuallineconfig.Table, billinginvoicemanuallineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString)) + _spec.From = bimlcq.sql + if unique := bimlcq.ctx.Unique; unique != nil { + _spec.Unique = *unique + } else if bimlcq.path != nil { + _spec.Unique = true + } + if fields := bimlcq.ctx.Fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicemanuallineconfig.FieldID) + for i := range fields { + if fields[i] != billinginvoicemanuallineconfig.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, fields[i]) + } + } + } + if ps := bimlcq.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if limit := bimlcq.ctx.Limit; limit != nil { + _spec.Limit = *limit + } + if offset := bimlcq.ctx.Offset; offset != nil { + _spec.Offset = *offset + } + if ps := bimlcq.order; len(ps) > 0 { + _spec.Order = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + return _spec +} + +func (bimlcq *BillingInvoiceManualLineConfigQuery) sqlQuery(ctx context.Context) *sql.Selector { + builder := sql.Dialect(bimlcq.driver.Dialect()) + t1 := builder.Table(billinginvoicemanuallineconfig.Table) + columns := bimlcq.ctx.Fields + if len(columns) == 0 { + columns = billinginvoicemanuallineconfig.Columns + } + selector := builder.Select(t1.Columns(columns...)...).From(t1) + if bimlcq.sql != nil { + selector = bimlcq.sql + selector.Select(selector.Columns(columns...)...) + } + if bimlcq.ctx.Unique != nil && *bimlcq.ctx.Unique { + selector.Distinct() + } + for _, m := range bimlcq.modifiers { + m(selector) + } + for _, p := range bimlcq.predicates { + p(selector) + } + for _, p := range bimlcq.order { + p(selector) + } + if offset := bimlcq.ctx.Offset; offset != nil { + // limit is mandatory for offset clause. We start + // with default value, and override it below if needed. + selector.Offset(*offset).Limit(math.MaxInt32) + } + if limit := bimlcq.ctx.Limit; limit != nil { + selector.Limit(*limit) + } + return selector +} + +// ForUpdate locks the selected rows against concurrent updates, and prevent them from being +// updated, deleted or "selected ... for update" by other sessions, until the transaction is +// either committed or rolled-back. +func (bimlcq *BillingInvoiceManualLineConfigQuery) ForUpdate(opts ...sql.LockOption) *BillingInvoiceManualLineConfigQuery { + if bimlcq.driver.Dialect() == dialect.Postgres { + bimlcq.Unique(false) + } + bimlcq.modifiers = append(bimlcq.modifiers, func(s *sql.Selector) { + s.ForUpdate(opts...) + }) + return bimlcq +} + +// ForShare behaves similarly to ForUpdate, except that it acquires a shared mode lock +// on any rows that are read. Other sessions can read the rows, but cannot modify them +// until your transaction commits. +func (bimlcq *BillingInvoiceManualLineConfigQuery) ForShare(opts ...sql.LockOption) *BillingInvoiceManualLineConfigQuery { + if bimlcq.driver.Dialect() == dialect.Postgres { + bimlcq.Unique(false) + } + bimlcq.modifiers = append(bimlcq.modifiers, func(s *sql.Selector) { + s.ForShare(opts...) + }) + return bimlcq +} + +// BillingInvoiceManualLineConfigGroupBy is the group-by builder for BillingInvoiceManualLineConfig entities. +type BillingInvoiceManualLineConfigGroupBy struct { + selector + build *BillingInvoiceManualLineConfigQuery +} + +// Aggregate adds the given aggregation functions to the group-by query. +func (bimlcgb *BillingInvoiceManualLineConfigGroupBy) Aggregate(fns ...AggregateFunc) *BillingInvoiceManualLineConfigGroupBy { + bimlcgb.fns = append(bimlcgb.fns, fns...) + return bimlcgb +} + +// Scan applies the selector query and scans the result into the given value. +func (bimlcgb *BillingInvoiceManualLineConfigGroupBy) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bimlcgb.build.ctx, ent.OpQueryGroupBy) + if err := bimlcgb.build.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BillingInvoiceManualLineConfigQuery, *BillingInvoiceManualLineConfigGroupBy](ctx, bimlcgb.build, bimlcgb, bimlcgb.build.inters, v) +} + +func (bimlcgb *BillingInvoiceManualLineConfigGroupBy) sqlScan(ctx context.Context, root *BillingInvoiceManualLineConfigQuery, v any) error { + selector := root.sqlQuery(ctx).Select() + aggregation := make([]string, 0, len(bimlcgb.fns)) + for _, fn := range bimlcgb.fns { + aggregation = append(aggregation, fn(selector)) + } + if len(selector.SelectedColumns()) == 0 { + columns := make([]string, 0, len(*bimlcgb.flds)+len(bimlcgb.fns)) + for _, f := range *bimlcgb.flds { + columns = append(columns, selector.C(f)) + } + columns = append(columns, aggregation...) + selector.Select(columns...) + } + selector.GroupBy(selector.Columns(*bimlcgb.flds...)...) + if err := selector.Err(); err != nil { + return err + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bimlcgb.build.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} + +// BillingInvoiceManualLineConfigSelect is the builder for selecting fields of BillingInvoiceManualLineConfig entities. +type BillingInvoiceManualLineConfigSelect struct { + *BillingInvoiceManualLineConfigQuery + selector +} + +// Aggregate adds the given aggregation functions to the selector query. +func (bimlcs *BillingInvoiceManualLineConfigSelect) Aggregate(fns ...AggregateFunc) *BillingInvoiceManualLineConfigSelect { + bimlcs.fns = append(bimlcs.fns, fns...) + return bimlcs +} + +// Scan applies the selector query and scans the result into the given value. +func (bimlcs *BillingInvoiceManualLineConfigSelect) Scan(ctx context.Context, v any) error { + ctx = setContextOp(ctx, bimlcs.ctx, ent.OpQuerySelect) + if err := bimlcs.prepareQuery(ctx); err != nil { + return err + } + return scanWithInterceptors[*BillingInvoiceManualLineConfigQuery, *BillingInvoiceManualLineConfigSelect](ctx, bimlcs.BillingInvoiceManualLineConfigQuery, bimlcs, bimlcs.inters, v) +} + +func (bimlcs *BillingInvoiceManualLineConfigSelect) sqlScan(ctx context.Context, root *BillingInvoiceManualLineConfigQuery, v any) error { + selector := root.sqlQuery(ctx) + aggregation := make([]string, 0, len(bimlcs.fns)) + for _, fn := range bimlcs.fns { + aggregation = append(aggregation, fn(selector)) + } + switch n := len(*bimlcs.selector.flds); { + case n == 0 && len(aggregation) > 0: + selector.Select(aggregation...) + case n != 0 && len(aggregation) > 0: + selector.AppendSelect(aggregation...) + } + rows := &sql.Rows{} + query, args := selector.Query() + if err := bimlcs.driver.Query(ctx, query, args, rows); err != nil { + return err + } + defer rows.Close() + return sql.ScanSlice(rows, v) +} diff --git a/openmeter/ent/db/billinginvoicemanuallineconfig_update.go b/openmeter/ent/db/billinginvoicemanuallineconfig_update.go new file mode 100644 index 000000000..3bafcdaa8 --- /dev/null +++ b/openmeter/ent/db/billinginvoicemanuallineconfig_update.go @@ -0,0 +1,210 @@ +// Code generated by ent, DO NOT EDIT. + +package db + +import ( + "context" + "errors" + "fmt" + + "entgo.io/ent/dialect/sql" + "entgo.io/ent/dialect/sql/sqlgraph" + "entgo.io/ent/schema/field" + "github.com/alpacahq/alpacadecimal" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" + "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" +) + +// BillingInvoiceManualLineConfigUpdate is the builder for updating BillingInvoiceManualLineConfig entities. +type BillingInvoiceManualLineConfigUpdate struct { + config + hooks []Hook + mutation *BillingInvoiceManualLineConfigMutation +} + +// Where appends a list predicates to the BillingInvoiceManualLineConfigUpdate builder. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) Where(ps ...predicate.BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigUpdate { + bimlcu.mutation.Where(ps...) + return bimlcu +} + +// SetUnitPrice sets the "unit_price" field. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpdate { + bimlcu.mutation.SetUnitPrice(a) + return bimlcu +} + +// SetNillableUnitPrice sets the "unit_price" field if the given value is not nil. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) SetNillableUnitPrice(a *alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpdate { + if a != nil { + bimlcu.SetUnitPrice(*a) + } + return bimlcu +} + +// Mutation returns the BillingInvoiceManualLineConfigMutation object of the builder. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) Mutation() *BillingInvoiceManualLineConfigMutation { + return bimlcu.mutation +} + +// Save executes the query and returns the number of nodes affected by the update operation. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) Save(ctx context.Context) (int, error) { + return withHooks(ctx, bimlcu.sqlSave, bimlcu.mutation, bimlcu.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) SaveX(ctx context.Context) int { + affected, err := bimlcu.Save(ctx) + if err != nil { + panic(err) + } + return affected +} + +// Exec executes the query. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) Exec(ctx context.Context) error { + _, err := bimlcu.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlcu *BillingInvoiceManualLineConfigUpdate) ExecX(ctx context.Context) { + if err := bimlcu.Exec(ctx); err != nil { + panic(err) + } +} + +func (bimlcu *BillingInvoiceManualLineConfigUpdate) sqlSave(ctx context.Context) (n int, err error) { + _spec := sqlgraph.NewUpdateSpec(billinginvoicemanuallineconfig.Table, billinginvoicemanuallineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString)) + if ps := bimlcu.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := bimlcu.mutation.UnitPrice(); ok { + _spec.SetField(billinginvoicemanuallineconfig.FieldUnitPrice, field.TypeOther, value) + } + if n, err = sqlgraph.UpdateNodes(ctx, bimlcu.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{billinginvoicemanuallineconfig.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return 0, err + } + bimlcu.mutation.done = true + return n, nil +} + +// BillingInvoiceManualLineConfigUpdateOne is the builder for updating a single BillingInvoiceManualLineConfig entity. +type BillingInvoiceManualLineConfigUpdateOne struct { + config + fields []string + hooks []Hook + mutation *BillingInvoiceManualLineConfigMutation +} + +// SetUnitPrice sets the "unit_price" field. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) SetUnitPrice(a alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpdateOne { + bimlcuo.mutation.SetUnitPrice(a) + return bimlcuo +} + +// SetNillableUnitPrice sets the "unit_price" field if the given value is not nil. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) SetNillableUnitPrice(a *alpacadecimal.Decimal) *BillingInvoiceManualLineConfigUpdateOne { + if a != nil { + bimlcuo.SetUnitPrice(*a) + } + return bimlcuo +} + +// Mutation returns the BillingInvoiceManualLineConfigMutation object of the builder. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) Mutation() *BillingInvoiceManualLineConfigMutation { + return bimlcuo.mutation +} + +// Where appends a list predicates to the BillingInvoiceManualLineConfigUpdate builder. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) Where(ps ...predicate.BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigUpdateOne { + bimlcuo.mutation.Where(ps...) + return bimlcuo +} + +// Select allows selecting one or more fields (columns) of the returned entity. +// The default is selecting all fields defined in the entity schema. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) Select(field string, fields ...string) *BillingInvoiceManualLineConfigUpdateOne { + bimlcuo.fields = append([]string{field}, fields...) + return bimlcuo +} + +// Save executes the query and returns the updated BillingInvoiceManualLineConfig entity. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) Save(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + return withHooks(ctx, bimlcuo.sqlSave, bimlcuo.mutation, bimlcuo.hooks) +} + +// SaveX is like Save, but panics if an error occurs. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) SaveX(ctx context.Context) *BillingInvoiceManualLineConfig { + node, err := bimlcuo.Save(ctx) + if err != nil { + panic(err) + } + return node +} + +// Exec executes the query on the entity. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) Exec(ctx context.Context) error { + _, err := bimlcuo.Save(ctx) + return err +} + +// ExecX is like Exec, but panics if an error occurs. +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) ExecX(ctx context.Context) { + if err := bimlcuo.Exec(ctx); err != nil { + panic(err) + } +} + +func (bimlcuo *BillingInvoiceManualLineConfigUpdateOne) sqlSave(ctx context.Context) (_node *BillingInvoiceManualLineConfig, err error) { + _spec := sqlgraph.NewUpdateSpec(billinginvoicemanuallineconfig.Table, billinginvoicemanuallineconfig.Columns, sqlgraph.NewFieldSpec(billinginvoicemanuallineconfig.FieldID, field.TypeString)) + id, ok := bimlcuo.mutation.ID() + if !ok { + return nil, &ValidationError{Name: "id", err: errors.New(`db: missing "BillingInvoiceManualLineConfig.id" for update`)} + } + _spec.Node.ID.Value = id + if fields := bimlcuo.fields; len(fields) > 0 { + _spec.Node.Columns = make([]string, 0, len(fields)) + _spec.Node.Columns = append(_spec.Node.Columns, billinginvoicemanuallineconfig.FieldID) + for _, f := range fields { + if !billinginvoicemanuallineconfig.ValidColumn(f) { + return nil, &ValidationError{Name: f, err: fmt.Errorf("db: invalid field %q for query", f)} + } + if f != billinginvoicemanuallineconfig.FieldID { + _spec.Node.Columns = append(_spec.Node.Columns, f) + } + } + } + if ps := bimlcuo.mutation.predicates; len(ps) > 0 { + _spec.Predicate = func(selector *sql.Selector) { + for i := range ps { + ps[i](selector) + } + } + } + if value, ok := bimlcuo.mutation.UnitPrice(); ok { + _spec.SetField(billinginvoicemanuallineconfig.FieldUnitPrice, field.TypeOther, value) + } + _node = &BillingInvoiceManualLineConfig{config: bimlcuo.config} + _spec.Assign = _node.assignValues + _spec.ScanValues = _node.scanValues + if err = sqlgraph.UpdateNode(ctx, bimlcuo.driver, _spec); err != nil { + if _, ok := err.(*sqlgraph.NotFoundError); ok { + err = &NotFoundError{billinginvoicemanuallineconfig.Label} + } else if sqlgraph.IsConstraintError(err) { + err = &ConstraintError{msg: err.Error(), wrap: err} + } + return nil, err + } + bimlcuo.mutation.done = true + return _node, nil +} diff --git a/openmeter/ent/db/billingprofile/billingprofile.go b/openmeter/ent/db/billingprofile/billingprofile.go index 71bfc51e2..e2a893897 100644 --- a/openmeter/ent/db/billingprofile/billingprofile.go +++ b/openmeter/ent/db/billingprofile/billingprofile.go @@ -76,7 +76,7 @@ const ( // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. BillingInvoicesInverseTable = "billing_invoices" // BillingInvoicesColumn is the table column denoting the billing_invoices relation/edge. - BillingInvoicesColumn = "billing_profile_id" + BillingInvoicesColumn = "source_billing_profile_id" // BillingCustomerOverrideTable is the table that holds the billing_customer_override relation/edge. BillingCustomerOverrideTable = "billing_customer_overrides" // BillingCustomerOverrideInverseTable is the table name for the BillingCustomerOverride entity. diff --git a/openmeter/ent/db/billingprofile_query.go b/openmeter/ent/db/billingprofile_query.go index 34656287d..c796f6e54 100644 --- a/openmeter/ent/db/billingprofile_query.go +++ b/openmeter/ent/db/billingprofile_query.go @@ -637,7 +637,7 @@ func (bpq *BillingProfileQuery) loadBillingInvoices(ctx context.Context, query * } } if len(query.ctx.Fields) > 0 { - query.ctx.AppendFieldOnce(billinginvoice.FieldBillingProfileID) + query.ctx.AppendFieldOnce(billinginvoice.FieldSourceBillingProfileID) } query.Where(predicate.BillingInvoice(func(s *sql.Selector) { s.Where(sql.InValues(s.C(billingprofile.BillingInvoicesColumn), fks...)) @@ -647,10 +647,10 @@ func (bpq *BillingProfileQuery) loadBillingInvoices(ctx context.Context, query * return err } for _, n := range neighbors { - fk := n.BillingProfileID + fk := n.SourceBillingProfileID node, ok := nodeids[fk] if !ok { - return fmt.Errorf(`unexpected referenced foreign-key "billing_profile_id" returned %v for node %v`, fk, n.ID) + return fmt.Errorf(`unexpected referenced foreign-key "source_billing_profile_id" returned %v for node %v`, fk, n.ID) } assign(node, n) } diff --git a/openmeter/ent/db/billingworkflowconfig.go b/openmeter/ent/db/billingworkflowconfig.go index 0737a0ec9..61dce59d8 100644 --- a/openmeter/ent/db/billingworkflowconfig.go +++ b/openmeter/ent/db/billingworkflowconfig.go @@ -31,8 +31,8 @@ type BillingWorkflowConfig struct { DeletedAt *time.Time `json:"deleted_at,omitempty"` // CollectionAlignment holds the value of the "collection_alignment" field. CollectionAlignment billingentity.AlignmentKind `json:"collection_alignment,omitempty"` - // ItemCollectionPeriod holds the value of the "item_collection_period" field. - ItemCollectionPeriod datex.ISOString `json:"item_collection_period,omitempty"` + // LineCollectionPeriod holds the value of the "line_collection_period" field. + LineCollectionPeriod datex.ISOString `json:"line_collection_period,omitempty"` // InvoiceAutoAdvance holds the value of the "invoice_auto_advance" field. InvoiceAutoAdvance bool `json:"invoice_auto_advance,omitempty"` // InvoiceDraftPeriod holds the value of the "invoice_draft_period" field. @@ -87,7 +87,7 @@ func (*BillingWorkflowConfig) scanValues(columns []string) ([]any, error) { switch columns[i] { case billingworkflowconfig.FieldInvoiceAutoAdvance: values[i] = new(sql.NullBool) - case billingworkflowconfig.FieldID, billingworkflowconfig.FieldNamespace, billingworkflowconfig.FieldCollectionAlignment, billingworkflowconfig.FieldItemCollectionPeriod, billingworkflowconfig.FieldInvoiceDraftPeriod, billingworkflowconfig.FieldInvoiceDueAfter, billingworkflowconfig.FieldInvoiceCollectionMethod: + case billingworkflowconfig.FieldID, billingworkflowconfig.FieldNamespace, billingworkflowconfig.FieldCollectionAlignment, billingworkflowconfig.FieldLineCollectionPeriod, billingworkflowconfig.FieldInvoiceDraftPeriod, billingworkflowconfig.FieldInvoiceDueAfter, billingworkflowconfig.FieldInvoiceCollectionMethod: values[i] = new(sql.NullString) case billingworkflowconfig.FieldCreatedAt, billingworkflowconfig.FieldUpdatedAt, billingworkflowconfig.FieldDeletedAt: values[i] = new(sql.NullTime) @@ -143,11 +143,11 @@ func (bwc *BillingWorkflowConfig) assignValues(columns []string, values []any) e } else if value.Valid { bwc.CollectionAlignment = billingentity.AlignmentKind(value.String) } - case billingworkflowconfig.FieldItemCollectionPeriod: + case billingworkflowconfig.FieldLineCollectionPeriod: if value, ok := values[i].(*sql.NullString); !ok { - return fmt.Errorf("unexpected type %T for field item_collection_period", values[i]) + return fmt.Errorf("unexpected type %T for field line_collection_period", values[i]) } else if value.Valid { - bwc.ItemCollectionPeriod = datex.ISOString(value.String) + bwc.LineCollectionPeriod = datex.ISOString(value.String) } case billingworkflowconfig.FieldInvoiceAutoAdvance: if value, ok := values[i].(*sql.NullBool); !ok { @@ -236,8 +236,8 @@ func (bwc *BillingWorkflowConfig) String() string { builder.WriteString("collection_alignment=") builder.WriteString(fmt.Sprintf("%v", bwc.CollectionAlignment)) builder.WriteString(", ") - builder.WriteString("item_collection_period=") - builder.WriteString(fmt.Sprintf("%v", bwc.ItemCollectionPeriod)) + builder.WriteString("line_collection_period=") + builder.WriteString(fmt.Sprintf("%v", bwc.LineCollectionPeriod)) builder.WriteString(", ") builder.WriteString("invoice_auto_advance=") builder.WriteString(fmt.Sprintf("%v", bwc.InvoiceAutoAdvance)) diff --git a/openmeter/ent/db/billingworkflowconfig/billingworkflowconfig.go b/openmeter/ent/db/billingworkflowconfig/billingworkflowconfig.go index 7ce96804b..8ebc96d96 100644 --- a/openmeter/ent/db/billingworkflowconfig/billingworkflowconfig.go +++ b/openmeter/ent/db/billingworkflowconfig/billingworkflowconfig.go @@ -26,8 +26,8 @@ const ( FieldDeletedAt = "deleted_at" // FieldCollectionAlignment holds the string denoting the collection_alignment field in the database. FieldCollectionAlignment = "collection_alignment" - // FieldItemCollectionPeriod holds the string denoting the item_collection_period field in the database. - FieldItemCollectionPeriod = "item_collection_period" + // FieldLineCollectionPeriod holds the string denoting the line_collection_period field in the database. + FieldLineCollectionPeriod = "line_collection_period" // FieldInvoiceAutoAdvance holds the string denoting the invoice_auto_advance field in the database. FieldInvoiceAutoAdvance = "invoice_auto_advance" // FieldInvoiceDraftPeriod holds the string denoting the invoice_draft_period field in the database. @@ -66,7 +66,7 @@ var Columns = []string{ FieldUpdatedAt, FieldDeletedAt, FieldCollectionAlignment, - FieldItemCollectionPeriod, + FieldLineCollectionPeriod, FieldInvoiceAutoAdvance, FieldInvoiceDraftPeriod, FieldInvoiceDueAfter, @@ -149,9 +149,9 @@ func ByCollectionAlignment(opts ...sql.OrderTermOption) OrderOption { return sql.OrderByField(FieldCollectionAlignment, opts...).ToFunc() } -// ByItemCollectionPeriod orders the results by the item_collection_period field. -func ByItemCollectionPeriod(opts ...sql.OrderTermOption) OrderOption { - return sql.OrderByField(FieldItemCollectionPeriod, opts...).ToFunc() +// ByLineCollectionPeriod orders the results by the line_collection_period field. +func ByLineCollectionPeriod(opts ...sql.OrderTermOption) OrderOption { + return sql.OrderByField(FieldLineCollectionPeriod, opts...).ToFunc() } // ByInvoiceAutoAdvance orders the results by the invoice_auto_advance field. diff --git a/openmeter/ent/db/billingworkflowconfig/where.go b/openmeter/ent/db/billingworkflowconfig/where.go index 9bbc56361..3b892b336 100644 --- a/openmeter/ent/db/billingworkflowconfig/where.go +++ b/openmeter/ent/db/billingworkflowconfig/where.go @@ -87,10 +87,10 @@ func DeletedAt(v time.Time) predicate.BillingWorkflowConfig { return predicate.BillingWorkflowConfig(sql.FieldEQ(FieldDeletedAt, v)) } -// ItemCollectionPeriod applies equality check predicate on the "item_collection_period" field. It's identical to ItemCollectionPeriodEQ. -func ItemCollectionPeriod(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriod applies equality check predicate on the "line_collection_period" field. It's identical to LineCollectionPeriodEQ. +func LineCollectionPeriod(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldEQ(FieldLineCollectionPeriod, vc)) } // InvoiceAutoAdvance applies equality check predicate on the "invoice_auto_advance" field. It's identical to InvoiceAutoAdvanceEQ. @@ -335,88 +335,88 @@ func CollectionAlignmentNotIn(vs ...billingentity.AlignmentKind) predicate.Billi return predicate.BillingWorkflowConfig(sql.FieldNotIn(FieldCollectionAlignment, v...)) } -// ItemCollectionPeriodEQ applies the EQ predicate on the "item_collection_period" field. -func ItemCollectionPeriodEQ(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodEQ applies the EQ predicate on the "line_collection_period" field. +func LineCollectionPeriodEQ(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldEQ(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodNEQ applies the NEQ predicate on the "item_collection_period" field. -func ItemCollectionPeriodNEQ(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodNEQ applies the NEQ predicate on the "line_collection_period" field. +func LineCollectionPeriodNEQ(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldNEQ(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldNEQ(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodIn applies the In predicate on the "item_collection_period" field. -func ItemCollectionPeriodIn(vs ...datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodIn applies the In predicate on the "line_collection_period" field. +func LineCollectionPeriodIn(vs ...datex.ISOString) predicate.BillingWorkflowConfig { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } - return predicate.BillingWorkflowConfig(sql.FieldIn(FieldItemCollectionPeriod, v...)) + return predicate.BillingWorkflowConfig(sql.FieldIn(FieldLineCollectionPeriod, v...)) } -// ItemCollectionPeriodNotIn applies the NotIn predicate on the "item_collection_period" field. -func ItemCollectionPeriodNotIn(vs ...datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodNotIn applies the NotIn predicate on the "line_collection_period" field. +func LineCollectionPeriodNotIn(vs ...datex.ISOString) predicate.BillingWorkflowConfig { v := make([]any, len(vs)) for i := range v { v[i] = string(vs[i]) } - return predicate.BillingWorkflowConfig(sql.FieldNotIn(FieldItemCollectionPeriod, v...)) + return predicate.BillingWorkflowConfig(sql.FieldNotIn(FieldLineCollectionPeriod, v...)) } -// ItemCollectionPeriodGT applies the GT predicate on the "item_collection_period" field. -func ItemCollectionPeriodGT(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodGT applies the GT predicate on the "line_collection_period" field. +func LineCollectionPeriodGT(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldGT(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldGT(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodGTE applies the GTE predicate on the "item_collection_period" field. -func ItemCollectionPeriodGTE(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodGTE applies the GTE predicate on the "line_collection_period" field. +func LineCollectionPeriodGTE(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldGTE(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldGTE(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodLT applies the LT predicate on the "item_collection_period" field. -func ItemCollectionPeriodLT(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodLT applies the LT predicate on the "line_collection_period" field. +func LineCollectionPeriodLT(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldLT(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldLT(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodLTE applies the LTE predicate on the "item_collection_period" field. -func ItemCollectionPeriodLTE(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodLTE applies the LTE predicate on the "line_collection_period" field. +func LineCollectionPeriodLTE(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldLTE(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldLTE(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodContains applies the Contains predicate on the "item_collection_period" field. -func ItemCollectionPeriodContains(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodContains applies the Contains predicate on the "line_collection_period" field. +func LineCollectionPeriodContains(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldContains(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldContains(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodHasPrefix applies the HasPrefix predicate on the "item_collection_period" field. -func ItemCollectionPeriodHasPrefix(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodHasPrefix applies the HasPrefix predicate on the "line_collection_period" field. +func LineCollectionPeriodHasPrefix(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldHasPrefix(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldHasPrefix(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodHasSuffix applies the HasSuffix predicate on the "item_collection_period" field. -func ItemCollectionPeriodHasSuffix(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodHasSuffix applies the HasSuffix predicate on the "line_collection_period" field. +func LineCollectionPeriodHasSuffix(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldHasSuffix(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldHasSuffix(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodEqualFold applies the EqualFold predicate on the "item_collection_period" field. -func ItemCollectionPeriodEqualFold(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodEqualFold applies the EqualFold predicate on the "line_collection_period" field. +func LineCollectionPeriodEqualFold(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldEqualFold(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldEqualFold(FieldLineCollectionPeriod, vc)) } -// ItemCollectionPeriodContainsFold applies the ContainsFold predicate on the "item_collection_period" field. -func ItemCollectionPeriodContainsFold(v datex.ISOString) predicate.BillingWorkflowConfig { +// LineCollectionPeriodContainsFold applies the ContainsFold predicate on the "line_collection_period" field. +func LineCollectionPeriodContainsFold(v datex.ISOString) predicate.BillingWorkflowConfig { vc := string(v) - return predicate.BillingWorkflowConfig(sql.FieldContainsFold(FieldItemCollectionPeriod, vc)) + return predicate.BillingWorkflowConfig(sql.FieldContainsFold(FieldLineCollectionPeriod, vc)) } // InvoiceAutoAdvanceEQ applies the EQ predicate on the "invoice_auto_advance" field. diff --git a/openmeter/ent/db/billingworkflowconfig_create.go b/openmeter/ent/db/billingworkflowconfig_create.go index a17d7970b..53c2892c8 100644 --- a/openmeter/ent/db/billingworkflowconfig_create.go +++ b/openmeter/ent/db/billingworkflowconfig_create.go @@ -81,9 +81,9 @@ func (bwcc *BillingWorkflowConfigCreate) SetCollectionAlignment(bk billingentity return bwcc } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bwcc *BillingWorkflowConfigCreate) SetItemCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigCreate { - bwcc.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bwcc *BillingWorkflowConfigCreate) SetLineCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigCreate { + bwcc.mutation.SetLineCollectionPeriod(ds) return bwcc } @@ -236,8 +236,8 @@ func (bwcc *BillingWorkflowConfigCreate) check() error { return &ValidationError{Name: "collection_alignment", err: fmt.Errorf(`db: validator failed for field "BillingWorkflowConfig.collection_alignment": %w`, err)} } } - if _, ok := bwcc.mutation.ItemCollectionPeriod(); !ok { - return &ValidationError{Name: "item_collection_period", err: errors.New(`db: missing required field "BillingWorkflowConfig.item_collection_period"`)} + if _, ok := bwcc.mutation.LineCollectionPeriod(); !ok { + return &ValidationError{Name: "line_collection_period", err: errors.New(`db: missing required field "BillingWorkflowConfig.line_collection_period"`)} } if _, ok := bwcc.mutation.InvoiceAutoAdvance(); !ok { return &ValidationError{Name: "invoice_auto_advance", err: errors.New(`db: missing required field "BillingWorkflowConfig.invoice_auto_advance"`)} @@ -312,9 +312,9 @@ func (bwcc *BillingWorkflowConfigCreate) createSpec() (*BillingWorkflowConfig, * _spec.SetField(billingworkflowconfig.FieldCollectionAlignment, field.TypeEnum, value) _node.CollectionAlignment = value } - if value, ok := bwcc.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingworkflowconfig.FieldItemCollectionPeriod, field.TypeString, value) - _node.ItemCollectionPeriod = value + if value, ok := bwcc.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingworkflowconfig.FieldLineCollectionPeriod, field.TypeString, value) + _node.LineCollectionPeriod = value } if value, ok := bwcc.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingworkflowconfig.FieldInvoiceAutoAdvance, field.TypeBool, value) @@ -458,15 +458,15 @@ func (u *BillingWorkflowConfigUpsert) UpdateCollectionAlignment() *BillingWorkfl return u } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingWorkflowConfigUpsert) SetItemCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsert { - u.Set(billingworkflowconfig.FieldItemCollectionPeriod, v) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingWorkflowConfigUpsert) SetLineCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsert { + u.Set(billingworkflowconfig.FieldLineCollectionPeriod, v) return u } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingWorkflowConfigUpsert) UpdateItemCollectionPeriod() *BillingWorkflowConfigUpsert { - u.SetExcluded(billingworkflowconfig.FieldItemCollectionPeriod) +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingWorkflowConfigUpsert) UpdateLineCollectionPeriod() *BillingWorkflowConfigUpsert { + u.SetExcluded(billingworkflowconfig.FieldLineCollectionPeriod) return u } @@ -621,17 +621,17 @@ func (u *BillingWorkflowConfigUpsertOne) UpdateCollectionAlignment() *BillingWor }) } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingWorkflowConfigUpsertOne) SetItemCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsertOne { +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingWorkflowConfigUpsertOne) SetLineCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsertOne { return u.Update(func(s *BillingWorkflowConfigUpsert) { - s.SetItemCollectionPeriod(v) + s.SetLineCollectionPeriod(v) }) } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingWorkflowConfigUpsertOne) UpdateItemCollectionPeriod() *BillingWorkflowConfigUpsertOne { +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingWorkflowConfigUpsertOne) UpdateLineCollectionPeriod() *BillingWorkflowConfigUpsertOne { return u.Update(func(s *BillingWorkflowConfigUpsert) { - s.UpdateItemCollectionPeriod() + s.UpdateLineCollectionPeriod() }) } @@ -961,17 +961,17 @@ func (u *BillingWorkflowConfigUpsertBulk) UpdateCollectionAlignment() *BillingWo }) } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (u *BillingWorkflowConfigUpsertBulk) SetItemCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsertBulk { +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (u *BillingWorkflowConfigUpsertBulk) SetLineCollectionPeriod(v datex.ISOString) *BillingWorkflowConfigUpsertBulk { return u.Update(func(s *BillingWorkflowConfigUpsert) { - s.SetItemCollectionPeriod(v) + s.SetLineCollectionPeriod(v) }) } -// UpdateItemCollectionPeriod sets the "item_collection_period" field to the value that was provided on create. -func (u *BillingWorkflowConfigUpsertBulk) UpdateItemCollectionPeriod() *BillingWorkflowConfigUpsertBulk { +// UpdateLineCollectionPeriod sets the "line_collection_period" field to the value that was provided on create. +func (u *BillingWorkflowConfigUpsertBulk) UpdateLineCollectionPeriod() *BillingWorkflowConfigUpsertBulk { return u.Update(func(s *BillingWorkflowConfigUpsert) { - s.UpdateItemCollectionPeriod() + s.UpdateLineCollectionPeriod() }) } diff --git a/openmeter/ent/db/billingworkflowconfig_update.go b/openmeter/ent/db/billingworkflowconfig_update.go index a1f0b04ef..a7c684915 100644 --- a/openmeter/ent/db/billingworkflowconfig_update.go +++ b/openmeter/ent/db/billingworkflowconfig_update.go @@ -72,16 +72,16 @@ func (bwcu *BillingWorkflowConfigUpdate) SetNillableCollectionAlignment(bk *bill return bwcu } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bwcu *BillingWorkflowConfigUpdate) SetItemCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigUpdate { - bwcu.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bwcu *BillingWorkflowConfigUpdate) SetLineCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigUpdate { + bwcu.mutation.SetLineCollectionPeriod(ds) return bwcu } -// SetNillableItemCollectionPeriod sets the "item_collection_period" field if the given value is not nil. -func (bwcu *BillingWorkflowConfigUpdate) SetNillableItemCollectionPeriod(ds *datex.ISOString) *BillingWorkflowConfigUpdate { +// SetNillableLineCollectionPeriod sets the "line_collection_period" field if the given value is not nil. +func (bwcu *BillingWorkflowConfigUpdate) SetNillableLineCollectionPeriod(ds *datex.ISOString) *BillingWorkflowConfigUpdate { if ds != nil { - bwcu.SetItemCollectionPeriod(*ds) + bwcu.SetLineCollectionPeriod(*ds) } return bwcu } @@ -272,8 +272,8 @@ func (bwcu *BillingWorkflowConfigUpdate) sqlSave(ctx context.Context) (n int, er if value, ok := bwcu.mutation.CollectionAlignment(); ok { _spec.SetField(billingworkflowconfig.FieldCollectionAlignment, field.TypeEnum, value) } - if value, ok := bwcu.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingworkflowconfig.FieldItemCollectionPeriod, field.TypeString, value) + if value, ok := bwcu.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingworkflowconfig.FieldLineCollectionPeriod, field.TypeString, value) } if value, ok := bwcu.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingworkflowconfig.FieldInvoiceAutoAdvance, field.TypeBool, value) @@ -405,16 +405,16 @@ func (bwcuo *BillingWorkflowConfigUpdateOne) SetNillableCollectionAlignment(bk * return bwcuo } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (bwcuo *BillingWorkflowConfigUpdateOne) SetItemCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigUpdateOne { - bwcuo.mutation.SetItemCollectionPeriod(ds) +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (bwcuo *BillingWorkflowConfigUpdateOne) SetLineCollectionPeriod(ds datex.ISOString) *BillingWorkflowConfigUpdateOne { + bwcuo.mutation.SetLineCollectionPeriod(ds) return bwcuo } -// SetNillableItemCollectionPeriod sets the "item_collection_period" field if the given value is not nil. -func (bwcuo *BillingWorkflowConfigUpdateOne) SetNillableItemCollectionPeriod(ds *datex.ISOString) *BillingWorkflowConfigUpdateOne { +// SetNillableLineCollectionPeriod sets the "line_collection_period" field if the given value is not nil. +func (bwcuo *BillingWorkflowConfigUpdateOne) SetNillableLineCollectionPeriod(ds *datex.ISOString) *BillingWorkflowConfigUpdateOne { if ds != nil { - bwcuo.SetItemCollectionPeriod(*ds) + bwcuo.SetLineCollectionPeriod(*ds) } return bwcuo } @@ -635,8 +635,8 @@ func (bwcuo *BillingWorkflowConfigUpdateOne) sqlSave(ctx context.Context) (_node if value, ok := bwcuo.mutation.CollectionAlignment(); ok { _spec.SetField(billingworkflowconfig.FieldCollectionAlignment, field.TypeEnum, value) } - if value, ok := bwcuo.mutation.ItemCollectionPeriod(); ok { - _spec.SetField(billingworkflowconfig.FieldItemCollectionPeriod, field.TypeString, value) + if value, ok := bwcuo.mutation.LineCollectionPeriod(); ok { + _spec.SetField(billingworkflowconfig.FieldLineCollectionPeriod, field.TypeString, value) } if value, ok := bwcuo.mutation.InvoiceAutoAdvance(); ok { _spec.SetField(billingworkflowconfig.FieldInvoiceAutoAdvance, field.TypeBool, value) diff --git a/openmeter/ent/db/client.go b/openmeter/ent/db/client.go index 95b5dbe69..a9f286880 100644 --- a/openmeter/ent/db/client.go +++ b/openmeter/ent/db/client.go @@ -22,7 +22,8 @@ import ( "github.com/openmeterio/openmeter/openmeter/ent/db/balancesnapshot" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" @@ -58,8 +59,10 @@ type Client struct { BillingCustomerOverride *BillingCustomerOverrideClient // BillingInvoice is the client for interacting with the BillingInvoice builders. BillingInvoice *BillingInvoiceClient - // BillingInvoiceItem is the client for interacting with the BillingInvoiceItem builders. - BillingInvoiceItem *BillingInvoiceItemClient + // BillingInvoiceLine is the client for interacting with the BillingInvoiceLine builders. + BillingInvoiceLine *BillingInvoiceLineClient + // BillingInvoiceManualLineConfig is the client for interacting with the BillingInvoiceManualLineConfig builders. + BillingInvoiceManualLineConfig *BillingInvoiceManualLineConfigClient // BillingProfile is the client for interacting with the BillingProfile builders. BillingProfile *BillingProfileClient // BillingWorkflowConfig is the client for interacting with the BillingWorkflowConfig builders. @@ -102,7 +105,8 @@ func (c *Client) init() { c.BalanceSnapshot = NewBalanceSnapshotClient(c.config) c.BillingCustomerOverride = NewBillingCustomerOverrideClient(c.config) c.BillingInvoice = NewBillingInvoiceClient(c.config) - c.BillingInvoiceItem = NewBillingInvoiceItemClient(c.config) + c.BillingInvoiceLine = NewBillingInvoiceLineClient(c.config) + c.BillingInvoiceManualLineConfig = NewBillingInvoiceManualLineConfigClient(c.config) c.BillingProfile = NewBillingProfileClient(c.config) c.BillingWorkflowConfig = NewBillingWorkflowConfigClient(c.config) c.Customer = NewCustomerClient(c.config) @@ -214,7 +218,8 @@ func (c *Client) Tx(ctx context.Context) (*Tx, error) { BalanceSnapshot: NewBalanceSnapshotClient(cfg), BillingCustomerOverride: NewBillingCustomerOverrideClient(cfg), BillingInvoice: NewBillingInvoiceClient(cfg), - BillingInvoiceItem: NewBillingInvoiceItemClient(cfg), + BillingInvoiceLine: NewBillingInvoiceLineClient(cfg), + BillingInvoiceManualLineConfig: NewBillingInvoiceManualLineConfigClient(cfg), BillingProfile: NewBillingProfileClient(cfg), BillingWorkflowConfig: NewBillingWorkflowConfigClient(cfg), Customer: NewCustomerClient(cfg), @@ -253,7 +258,8 @@ func (c *Client) BeginTx(ctx context.Context, opts *sql.TxOptions) (*Tx, error) BalanceSnapshot: NewBalanceSnapshotClient(cfg), BillingCustomerOverride: NewBillingCustomerOverrideClient(cfg), BillingInvoice: NewBillingInvoiceClient(cfg), - BillingInvoiceItem: NewBillingInvoiceItemClient(cfg), + BillingInvoiceLine: NewBillingInvoiceLineClient(cfg), + BillingInvoiceManualLineConfig: NewBillingInvoiceManualLineConfigClient(cfg), BillingProfile: NewBillingProfileClient(cfg), BillingWorkflowConfig: NewBillingWorkflowConfigClient(cfg), Customer: NewCustomerClient(cfg), @@ -296,10 +302,11 @@ func (c *Client) Close() error { func (c *Client) Use(hooks ...Hook) { for _, n := range []interface{ Use(...Hook) }{ c.App, c.AppCustomer, c.AppStripe, c.AppStripeCustomer, c.BalanceSnapshot, - c.BillingCustomerOverride, c.BillingInvoice, c.BillingInvoiceItem, - c.BillingProfile, c.BillingWorkflowConfig, c.Customer, c.CustomerSubjects, - c.Entitlement, c.Feature, c.Grant, c.NotificationChannel, c.NotificationEvent, - c.NotificationEventDeliveryStatus, c.NotificationRule, c.UsageReset, + c.BillingCustomerOverride, c.BillingInvoice, c.BillingInvoiceLine, + c.BillingInvoiceManualLineConfig, c.BillingProfile, c.BillingWorkflowConfig, + c.Customer, c.CustomerSubjects, c.Entitlement, c.Feature, c.Grant, + c.NotificationChannel, c.NotificationEvent, c.NotificationEventDeliveryStatus, + c.NotificationRule, c.UsageReset, } { n.Use(hooks...) } @@ -310,10 +317,11 @@ func (c *Client) Use(hooks ...Hook) { func (c *Client) Intercept(interceptors ...Interceptor) { for _, n := range []interface{ Intercept(...Interceptor) }{ c.App, c.AppCustomer, c.AppStripe, c.AppStripeCustomer, c.BalanceSnapshot, - c.BillingCustomerOverride, c.BillingInvoice, c.BillingInvoiceItem, - c.BillingProfile, c.BillingWorkflowConfig, c.Customer, c.CustomerSubjects, - c.Entitlement, c.Feature, c.Grant, c.NotificationChannel, c.NotificationEvent, - c.NotificationEventDeliveryStatus, c.NotificationRule, c.UsageReset, + c.BillingCustomerOverride, c.BillingInvoice, c.BillingInvoiceLine, + c.BillingInvoiceManualLineConfig, c.BillingProfile, c.BillingWorkflowConfig, + c.Customer, c.CustomerSubjects, c.Entitlement, c.Feature, c.Grant, + c.NotificationChannel, c.NotificationEvent, c.NotificationEventDeliveryStatus, + c.NotificationRule, c.UsageReset, } { n.Intercept(interceptors...) } @@ -336,8 +344,10 @@ func (c *Client) Mutate(ctx context.Context, m Mutation) (Value, error) { return c.BillingCustomerOverride.mutate(ctx, m) case *BillingInvoiceMutation: return c.BillingInvoice.mutate(ctx, m) - case *BillingInvoiceItemMutation: - return c.BillingInvoiceItem.mutate(ctx, m) + case *BillingInvoiceLineMutation: + return c.BillingInvoiceLine.mutate(ctx, m) + case *BillingInvoiceManualLineConfigMutation: + return c.BillingInvoiceManualLineConfig.mutate(ctx, m) case *BillingProfileMutation: return c.BillingProfile.mutate(ctx, m) case *BillingWorkflowConfigMutation: @@ -491,15 +501,15 @@ func (c *AppClient) QueryCustomerApps(a *App) *AppCustomerQuery { return query } -// QueryTaxApp queries the tax_app edge of a App. -func (c *AppClient) QueryTaxApp(a *App) *BillingProfileQuery { +// QueryBillingProfileTaxApp queries the billing_profile_tax_app edge of a App. +func (c *AppClient) QueryBillingProfileTaxApp(a *App) *BillingProfileQuery { query := (&BillingProfileClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, id), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.TaxAppTable, app.TaxAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfileTaxAppTable, app.BillingProfileTaxAppColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil @@ -507,15 +517,15 @@ func (c *AppClient) QueryTaxApp(a *App) *BillingProfileQuery { return query } -// QueryInvoicingApp queries the invoicing_app edge of a App. -func (c *AppClient) QueryInvoicingApp(a *App) *BillingProfileQuery { +// QueryBillingProfileInvoicingApp queries the billing_profile_invoicing_app edge of a App. +func (c *AppClient) QueryBillingProfileInvoicingApp(a *App) *BillingProfileQuery { query := (&BillingProfileClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, id), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.InvoicingAppTable, app.InvoicingAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfileInvoicingAppTable, app.BillingProfileInvoicingAppColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil @@ -523,15 +533,63 @@ func (c *AppClient) QueryInvoicingApp(a *App) *BillingProfileQuery { return query } -// QueryPaymentApp queries the payment_app edge of a App. -func (c *AppClient) QueryPaymentApp(a *App) *BillingProfileQuery { +// QueryBillingProfilePaymentApp queries the billing_profile_payment_app edge of a App. +func (c *AppClient) QueryBillingProfilePaymentApp(a *App) *BillingProfileQuery { query := (&BillingProfileClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := a.ID step := sqlgraph.NewStep( sqlgraph.From(app.Table, app.FieldID, id), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, app.PaymentAppTable, app.PaymentAppColumn), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingProfilePaymentAppTable, app.BillingProfilePaymentAppColumn), + ) + fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryBillingInvoiceTaxApp queries the billing_invoice_tax_app edge of a App. +func (c *AppClient) QueryBillingInvoiceTaxApp(a *App) *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := a.ID + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, id), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoiceTaxAppTable, app.BillingInvoiceTaxAppColumn), + ) + fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryBillingInvoiceInvoicingApp queries the billing_invoice_invoicing_app edge of a App. +func (c *AppClient) QueryBillingInvoiceInvoicingApp(a *App) *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := a.ID + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, id), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoiceInvoicingAppTable, app.BillingInvoiceInvoicingAppColumn), + ) + fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryBillingInvoicePaymentApp queries the billing_invoice_payment_app edge of a App. +func (c *AppClient) QueryBillingInvoicePaymentApp(a *App) *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := a.ID + step := sqlgraph.NewStep( + sqlgraph.From(app.Table, app.FieldID, id), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, app.BillingInvoicePaymentAppTable, app.BillingInvoicePaymentAppColumn), ) fromV = sqlgraph.Neighbors(a.driver.Dialect(), step) return fromV, nil @@ -1481,15 +1539,15 @@ func (c *BillingInvoiceClient) GetX(ctx context.Context, id string) *BillingInvo return obj } -// QueryBillingProfile queries the billing_profile edge of a BillingInvoice. -func (c *BillingInvoiceClient) QueryBillingProfile(bi *BillingInvoice) *BillingProfileQuery { +// QuerySourceBillingProfile queries the source_billing_profile edge of a BillingInvoice. +func (c *BillingInvoiceClient) QuerySourceBillingProfile(bi *BillingInvoice) *BillingProfileQuery { query := (&BillingProfileClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := bi.ID step := sqlgraph.NewStep( sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), sqlgraph.To(billingprofile.Table, billingprofile.FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.BillingProfileTable, billinginvoice.BillingProfileColumn), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.SourceBillingProfileTable, billinginvoice.SourceBillingProfileColumn), ) fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) return fromV, nil @@ -1513,15 +1571,79 @@ func (c *BillingInvoiceClient) QueryBillingWorkflowConfig(bi *BillingInvoice) *B return query } -// QueryBillingInvoiceItems queries the billing_invoice_items edge of a BillingInvoice. -func (c *BillingInvoiceClient) QueryBillingInvoiceItems(bi *BillingInvoice) *BillingInvoiceItemQuery { - query := (&BillingInvoiceItemClient{config: c.config}).Query() +// QueryBillingInvoiceLines queries the billing_invoice_lines edge of a BillingInvoice. +func (c *BillingInvoiceClient) QueryBillingInvoiceLines(bi *BillingInvoice) *BillingInvoiceLineQuery { + query := (&BillingInvoiceLineClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { id := bi.ID step := sqlgraph.NewStep( sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), - sqlgraph.To(billinginvoiceitem.Table, billinginvoiceitem.FieldID), - sqlgraph.Edge(sqlgraph.O2M, false, billinginvoice.BillingInvoiceItemsTable, billinginvoice.BillingInvoiceItemsColumn), + sqlgraph.To(billinginvoiceline.Table, billinginvoiceline.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, billinginvoice.BillingInvoiceLinesTable, billinginvoice.BillingInvoiceLinesColumn), + ) + fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryBillingInvoiceCustomer queries the billing_invoice_customer edge of a BillingInvoice. +func (c *BillingInvoiceClient) QueryBillingInvoiceCustomer(bi *BillingInvoice) *CustomerQuery { + query := (&CustomerClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bi.ID + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), + sqlgraph.To(customer.Table, customer.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.BillingInvoiceCustomerTable, billinginvoice.BillingInvoiceCustomerColumn), + ) + fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryTaxApp queries the tax_app edge of a BillingInvoice. +func (c *BillingInvoiceClient) QueryTaxApp(bi *BillingInvoice) *AppQuery { + query := (&AppClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bi.ID + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.TaxAppTable, billinginvoice.TaxAppColumn), + ) + fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryInvoicingApp queries the invoicing_app edge of a BillingInvoice. +func (c *BillingInvoiceClient) QueryInvoicingApp(bi *BillingInvoice) *AppQuery { + query := (&AppClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bi.ID + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.InvoicingAppTable, billinginvoice.InvoicingAppColumn), + ) + fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryPaymentApp queries the payment_app edge of a BillingInvoice. +func (c *BillingInvoiceClient) QueryPaymentApp(bi *BillingInvoice) *AppQuery { + query := (&AppClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bi.ID + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoice.Table, billinginvoice.FieldID, id), + sqlgraph.To(app.Table, app.FieldID), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoice.PaymentAppTable, billinginvoice.PaymentAppColumn), ) fromV = sqlgraph.Neighbors(bi.driver.Dialect(), step) return fromV, nil @@ -1554,107 +1676,107 @@ func (c *BillingInvoiceClient) mutate(ctx context.Context, m *BillingInvoiceMuta } } -// BillingInvoiceItemClient is a client for the BillingInvoiceItem schema. -type BillingInvoiceItemClient struct { +// BillingInvoiceLineClient is a client for the BillingInvoiceLine schema. +type BillingInvoiceLineClient struct { config } -// NewBillingInvoiceItemClient returns a client for the BillingInvoiceItem from the given config. -func NewBillingInvoiceItemClient(c config) *BillingInvoiceItemClient { - return &BillingInvoiceItemClient{config: c} +// NewBillingInvoiceLineClient returns a client for the BillingInvoiceLine from the given config. +func NewBillingInvoiceLineClient(c config) *BillingInvoiceLineClient { + return &BillingInvoiceLineClient{config: c} } // Use adds a list of mutation hooks to the hooks stack. -// A call to `Use(f, g, h)` equals to `billinginvoiceitem.Hooks(f(g(h())))`. -func (c *BillingInvoiceItemClient) Use(hooks ...Hook) { - c.hooks.BillingInvoiceItem = append(c.hooks.BillingInvoiceItem, hooks...) +// A call to `Use(f, g, h)` equals to `billinginvoiceline.Hooks(f(g(h())))`. +func (c *BillingInvoiceLineClient) Use(hooks ...Hook) { + c.hooks.BillingInvoiceLine = append(c.hooks.BillingInvoiceLine, hooks...) } // Intercept adds a list of query interceptors to the interceptors stack. -// A call to `Intercept(f, g, h)` equals to `billinginvoiceitem.Intercept(f(g(h())))`. -func (c *BillingInvoiceItemClient) Intercept(interceptors ...Interceptor) { - c.inters.BillingInvoiceItem = append(c.inters.BillingInvoiceItem, interceptors...) +// A call to `Intercept(f, g, h)` equals to `billinginvoiceline.Intercept(f(g(h())))`. +func (c *BillingInvoiceLineClient) Intercept(interceptors ...Interceptor) { + c.inters.BillingInvoiceLine = append(c.inters.BillingInvoiceLine, interceptors...) } -// Create returns a builder for creating a BillingInvoiceItem entity. -func (c *BillingInvoiceItemClient) Create() *BillingInvoiceItemCreate { - mutation := newBillingInvoiceItemMutation(c.config, OpCreate) - return &BillingInvoiceItemCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +// Create returns a builder for creating a BillingInvoiceLine entity. +func (c *BillingInvoiceLineClient) Create() *BillingInvoiceLineCreate { + mutation := newBillingInvoiceLineMutation(c.config, OpCreate) + return &BillingInvoiceLineCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// CreateBulk returns a builder for creating a bulk of BillingInvoiceItem entities. -func (c *BillingInvoiceItemClient) CreateBulk(builders ...*BillingInvoiceItemCreate) *BillingInvoiceItemCreateBulk { - return &BillingInvoiceItemCreateBulk{config: c.config, builders: builders} +// CreateBulk returns a builder for creating a bulk of BillingInvoiceLine entities. +func (c *BillingInvoiceLineClient) CreateBulk(builders ...*BillingInvoiceLineCreate) *BillingInvoiceLineCreateBulk { + return &BillingInvoiceLineCreateBulk{config: c.config, builders: builders} } // MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates // a builder and applies setFunc on it. -func (c *BillingInvoiceItemClient) MapCreateBulk(slice any, setFunc func(*BillingInvoiceItemCreate, int)) *BillingInvoiceItemCreateBulk { +func (c *BillingInvoiceLineClient) MapCreateBulk(slice any, setFunc func(*BillingInvoiceLineCreate, int)) *BillingInvoiceLineCreateBulk { rv := reflect.ValueOf(slice) if rv.Kind() != reflect.Slice { - return &BillingInvoiceItemCreateBulk{err: fmt.Errorf("calling to BillingInvoiceItemClient.MapCreateBulk with wrong type %T, need slice", slice)} + return &BillingInvoiceLineCreateBulk{err: fmt.Errorf("calling to BillingInvoiceLineClient.MapCreateBulk with wrong type %T, need slice", slice)} } - builders := make([]*BillingInvoiceItemCreate, rv.Len()) + builders := make([]*BillingInvoiceLineCreate, rv.Len()) for i := 0; i < rv.Len(); i++ { builders[i] = c.Create() setFunc(builders[i], i) } - return &BillingInvoiceItemCreateBulk{config: c.config, builders: builders} + return &BillingInvoiceLineCreateBulk{config: c.config, builders: builders} } -// Update returns an update builder for BillingInvoiceItem. -func (c *BillingInvoiceItemClient) Update() *BillingInvoiceItemUpdate { - mutation := newBillingInvoiceItemMutation(c.config, OpUpdate) - return &BillingInvoiceItemUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +// Update returns an update builder for BillingInvoiceLine. +func (c *BillingInvoiceLineClient) Update() *BillingInvoiceLineUpdate { + mutation := newBillingInvoiceLineMutation(c.config, OpUpdate) + return &BillingInvoiceLineUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOne returns an update builder for the given entity. -func (c *BillingInvoiceItemClient) UpdateOne(bii *BillingInvoiceItem) *BillingInvoiceItemUpdateOne { - mutation := newBillingInvoiceItemMutation(c.config, OpUpdateOne, withBillingInvoiceItem(bii)) - return &BillingInvoiceItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +func (c *BillingInvoiceLineClient) UpdateOne(bil *BillingInvoiceLine) *BillingInvoiceLineUpdateOne { + mutation := newBillingInvoiceLineMutation(c.config, OpUpdateOne, withBillingInvoiceLine(bil)) + return &BillingInvoiceLineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } // UpdateOneID returns an update builder for the given id. -func (c *BillingInvoiceItemClient) UpdateOneID(id string) *BillingInvoiceItemUpdateOne { - mutation := newBillingInvoiceItemMutation(c.config, OpUpdateOne, withBillingInvoiceItemID(id)) - return &BillingInvoiceItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +func (c *BillingInvoiceLineClient) UpdateOneID(id string) *BillingInvoiceLineUpdateOne { + mutation := newBillingInvoiceLineMutation(c.config, OpUpdateOne, withBillingInvoiceLineID(id)) + return &BillingInvoiceLineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} } -// Delete returns a delete builder for BillingInvoiceItem. -func (c *BillingInvoiceItemClient) Delete() *BillingInvoiceItemDelete { - mutation := newBillingInvoiceItemMutation(c.config, OpDelete) - return &BillingInvoiceItemDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +// Delete returns a delete builder for BillingInvoiceLine. +func (c *BillingInvoiceLineClient) Delete() *BillingInvoiceLineDelete { + mutation := newBillingInvoiceLineMutation(c.config, OpDelete) + return &BillingInvoiceLineDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} } // DeleteOne returns a builder for deleting the given entity. -func (c *BillingInvoiceItemClient) DeleteOne(bii *BillingInvoiceItem) *BillingInvoiceItemDeleteOne { - return c.DeleteOneID(bii.ID) +func (c *BillingInvoiceLineClient) DeleteOne(bil *BillingInvoiceLine) *BillingInvoiceLineDeleteOne { + return c.DeleteOneID(bil.ID) } // DeleteOneID returns a builder for deleting the given entity by its id. -func (c *BillingInvoiceItemClient) DeleteOneID(id string) *BillingInvoiceItemDeleteOne { - builder := c.Delete().Where(billinginvoiceitem.ID(id)) +func (c *BillingInvoiceLineClient) DeleteOneID(id string) *BillingInvoiceLineDeleteOne { + builder := c.Delete().Where(billinginvoiceline.ID(id)) builder.mutation.id = &id builder.mutation.op = OpDeleteOne - return &BillingInvoiceItemDeleteOne{builder} + return &BillingInvoiceLineDeleteOne{builder} } -// Query returns a query builder for BillingInvoiceItem. -func (c *BillingInvoiceItemClient) Query() *BillingInvoiceItemQuery { - return &BillingInvoiceItemQuery{ +// Query returns a query builder for BillingInvoiceLine. +func (c *BillingInvoiceLineClient) Query() *BillingInvoiceLineQuery { + return &BillingInvoiceLineQuery{ config: c.config, - ctx: &QueryContext{Type: TypeBillingInvoiceItem}, + ctx: &QueryContext{Type: TypeBillingInvoiceLine}, inters: c.Interceptors(), } } -// Get returns a BillingInvoiceItem entity by its id. -func (c *BillingInvoiceItemClient) Get(ctx context.Context, id string) (*BillingInvoiceItem, error) { - return c.Query().Where(billinginvoiceitem.ID(id)).Only(ctx) +// Get returns a BillingInvoiceLine entity by its id. +func (c *BillingInvoiceLineClient) Get(ctx context.Context, id string) (*BillingInvoiceLine, error) { + return c.Query().Where(billinginvoiceline.ID(id)).Only(ctx) } // GetX is like Get, but panics if an error occurs. -func (c *BillingInvoiceItemClient) GetX(ctx context.Context, id string) *BillingInvoiceItem { +func (c *BillingInvoiceLineClient) GetX(ctx context.Context, id string) *BillingInvoiceLine { obj, err := c.Get(ctx, id) if err != nil { panic(err) @@ -1662,44 +1784,193 @@ func (c *BillingInvoiceItemClient) GetX(ctx context.Context, id string) *Billing return obj } -// QueryBillingInvoice queries the billing_invoice edge of a BillingInvoiceItem. -func (c *BillingInvoiceItemClient) QueryBillingInvoice(bii *BillingInvoiceItem) *BillingInvoiceQuery { +// QueryBillingInvoice queries the billing_invoice edge of a BillingInvoiceLine. +func (c *BillingInvoiceLineClient) QueryBillingInvoice(bil *BillingInvoiceLine) *BillingInvoiceQuery { query := (&BillingInvoiceClient{config: c.config}).Query() query.path = func(context.Context) (fromV *sql.Selector, _ error) { - id := bii.ID + id := bil.ID step := sqlgraph.NewStep( - sqlgraph.From(billinginvoiceitem.Table, billinginvoiceitem.FieldID, id), + sqlgraph.From(billinginvoiceline.Table, billinginvoiceline.FieldID, id), sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), - sqlgraph.Edge(sqlgraph.M2O, true, billinginvoiceitem.BillingInvoiceTable, billinginvoiceitem.BillingInvoiceColumn), + sqlgraph.Edge(sqlgraph.M2O, true, billinginvoiceline.BillingInvoiceTable, billinginvoiceline.BillingInvoiceColumn), + ) + fromV = sqlgraph.Neighbors(bil.driver.Dialect(), step) + return fromV, nil + } + return query +} + +// QueryBillingInvoiceManualLines queries the billing_invoice_manual_lines edge of a BillingInvoiceLine. +func (c *BillingInvoiceLineClient) QueryBillingInvoiceManualLines(bil *BillingInvoiceLine) *BillingInvoiceManualLineConfigQuery { + query := (&BillingInvoiceManualLineConfigClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := bil.ID + step := sqlgraph.NewStep( + sqlgraph.From(billinginvoiceline.Table, billinginvoiceline.FieldID, id), + sqlgraph.To(billinginvoicemanuallineconfig.Table, billinginvoicemanuallineconfig.FieldID), + sqlgraph.Edge(sqlgraph.M2O, false, billinginvoiceline.BillingInvoiceManualLinesTable, billinginvoiceline.BillingInvoiceManualLinesColumn), ) - fromV = sqlgraph.Neighbors(bii.driver.Dialect(), step) + fromV = sqlgraph.Neighbors(bil.driver.Dialect(), step) return fromV, nil } return query } // Hooks returns the client hooks. -func (c *BillingInvoiceItemClient) Hooks() []Hook { - return c.hooks.BillingInvoiceItem +func (c *BillingInvoiceLineClient) Hooks() []Hook { + return c.hooks.BillingInvoiceLine } // Interceptors returns the client interceptors. -func (c *BillingInvoiceItemClient) Interceptors() []Interceptor { - return c.inters.BillingInvoiceItem +func (c *BillingInvoiceLineClient) Interceptors() []Interceptor { + return c.inters.BillingInvoiceLine } -func (c *BillingInvoiceItemClient) mutate(ctx context.Context, m *BillingInvoiceItemMutation) (Value, error) { +func (c *BillingInvoiceLineClient) mutate(ctx context.Context, m *BillingInvoiceLineMutation) (Value, error) { switch m.Op() { case OpCreate: - return (&BillingInvoiceItemCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + return (&BillingInvoiceLineCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdate: - return (&BillingInvoiceItemUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + return (&BillingInvoiceLineUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpUpdateOne: - return (&BillingInvoiceItemUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + return (&BillingInvoiceLineUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) case OpDelete, OpDeleteOne: - return (&BillingInvoiceItemDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + return (&BillingInvoiceLineDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) default: - return nil, fmt.Errorf("db: unknown BillingInvoiceItem mutation op: %q", m.Op()) + return nil, fmt.Errorf("db: unknown BillingInvoiceLine mutation op: %q", m.Op()) + } +} + +// BillingInvoiceManualLineConfigClient is a client for the BillingInvoiceManualLineConfig schema. +type BillingInvoiceManualLineConfigClient struct { + config +} + +// NewBillingInvoiceManualLineConfigClient returns a client for the BillingInvoiceManualLineConfig from the given config. +func NewBillingInvoiceManualLineConfigClient(c config) *BillingInvoiceManualLineConfigClient { + return &BillingInvoiceManualLineConfigClient{config: c} +} + +// Use adds a list of mutation hooks to the hooks stack. +// A call to `Use(f, g, h)` equals to `billinginvoicemanuallineconfig.Hooks(f(g(h())))`. +func (c *BillingInvoiceManualLineConfigClient) Use(hooks ...Hook) { + c.hooks.BillingInvoiceManualLineConfig = append(c.hooks.BillingInvoiceManualLineConfig, hooks...) +} + +// Intercept adds a list of query interceptors to the interceptors stack. +// A call to `Intercept(f, g, h)` equals to `billinginvoicemanuallineconfig.Intercept(f(g(h())))`. +func (c *BillingInvoiceManualLineConfigClient) Intercept(interceptors ...Interceptor) { + c.inters.BillingInvoiceManualLineConfig = append(c.inters.BillingInvoiceManualLineConfig, interceptors...) +} + +// Create returns a builder for creating a BillingInvoiceManualLineConfig entity. +func (c *BillingInvoiceManualLineConfigClient) Create() *BillingInvoiceManualLineConfigCreate { + mutation := newBillingInvoiceManualLineConfigMutation(c.config, OpCreate) + return &BillingInvoiceManualLineConfigCreate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// CreateBulk returns a builder for creating a bulk of BillingInvoiceManualLineConfig entities. +func (c *BillingInvoiceManualLineConfigClient) CreateBulk(builders ...*BillingInvoiceManualLineConfigCreate) *BillingInvoiceManualLineConfigCreateBulk { + return &BillingInvoiceManualLineConfigCreateBulk{config: c.config, builders: builders} +} + +// MapCreateBulk creates a bulk creation builder from the given slice. For each item in the slice, the function creates +// a builder and applies setFunc on it. +func (c *BillingInvoiceManualLineConfigClient) MapCreateBulk(slice any, setFunc func(*BillingInvoiceManualLineConfigCreate, int)) *BillingInvoiceManualLineConfigCreateBulk { + rv := reflect.ValueOf(slice) + if rv.Kind() != reflect.Slice { + return &BillingInvoiceManualLineConfigCreateBulk{err: fmt.Errorf("calling to BillingInvoiceManualLineConfigClient.MapCreateBulk with wrong type %T, need slice", slice)} + } + builders := make([]*BillingInvoiceManualLineConfigCreate, rv.Len()) + for i := 0; i < rv.Len(); i++ { + builders[i] = c.Create() + setFunc(builders[i], i) + } + return &BillingInvoiceManualLineConfigCreateBulk{config: c.config, builders: builders} +} + +// Update returns an update builder for BillingInvoiceManualLineConfig. +func (c *BillingInvoiceManualLineConfigClient) Update() *BillingInvoiceManualLineConfigUpdate { + mutation := newBillingInvoiceManualLineConfigMutation(c.config, OpUpdate) + return &BillingInvoiceManualLineConfigUpdate{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOne returns an update builder for the given entity. +func (c *BillingInvoiceManualLineConfigClient) UpdateOne(bimlc *BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigUpdateOne { + mutation := newBillingInvoiceManualLineConfigMutation(c.config, OpUpdateOne, withBillingInvoiceManualLineConfig(bimlc)) + return &BillingInvoiceManualLineConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// UpdateOneID returns an update builder for the given id. +func (c *BillingInvoiceManualLineConfigClient) UpdateOneID(id string) *BillingInvoiceManualLineConfigUpdateOne { + mutation := newBillingInvoiceManualLineConfigMutation(c.config, OpUpdateOne, withBillingInvoiceManualLineConfigID(id)) + return &BillingInvoiceManualLineConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// Delete returns a delete builder for BillingInvoiceManualLineConfig. +func (c *BillingInvoiceManualLineConfigClient) Delete() *BillingInvoiceManualLineConfigDelete { + mutation := newBillingInvoiceManualLineConfigMutation(c.config, OpDelete) + return &BillingInvoiceManualLineConfigDelete{config: c.config, hooks: c.Hooks(), mutation: mutation} +} + +// DeleteOne returns a builder for deleting the given entity. +func (c *BillingInvoiceManualLineConfigClient) DeleteOne(bimlc *BillingInvoiceManualLineConfig) *BillingInvoiceManualLineConfigDeleteOne { + return c.DeleteOneID(bimlc.ID) +} + +// DeleteOneID returns a builder for deleting the given entity by its id. +func (c *BillingInvoiceManualLineConfigClient) DeleteOneID(id string) *BillingInvoiceManualLineConfigDeleteOne { + builder := c.Delete().Where(billinginvoicemanuallineconfig.ID(id)) + builder.mutation.id = &id + builder.mutation.op = OpDeleteOne + return &BillingInvoiceManualLineConfigDeleteOne{builder} +} + +// Query returns a query builder for BillingInvoiceManualLineConfig. +func (c *BillingInvoiceManualLineConfigClient) Query() *BillingInvoiceManualLineConfigQuery { + return &BillingInvoiceManualLineConfigQuery{ + config: c.config, + ctx: &QueryContext{Type: TypeBillingInvoiceManualLineConfig}, + inters: c.Interceptors(), + } +} + +// Get returns a BillingInvoiceManualLineConfig entity by its id. +func (c *BillingInvoiceManualLineConfigClient) Get(ctx context.Context, id string) (*BillingInvoiceManualLineConfig, error) { + return c.Query().Where(billinginvoicemanuallineconfig.ID(id)).Only(ctx) +} + +// GetX is like Get, but panics if an error occurs. +func (c *BillingInvoiceManualLineConfigClient) GetX(ctx context.Context, id string) *BillingInvoiceManualLineConfig { + obj, err := c.Get(ctx, id) + if err != nil { + panic(err) + } + return obj +} + +// Hooks returns the client hooks. +func (c *BillingInvoiceManualLineConfigClient) Hooks() []Hook { + return c.hooks.BillingInvoiceManualLineConfig +} + +// Interceptors returns the client interceptors. +func (c *BillingInvoiceManualLineConfigClient) Interceptors() []Interceptor { + return c.inters.BillingInvoiceManualLineConfig +} + +func (c *BillingInvoiceManualLineConfigClient) mutate(ctx context.Context, m *BillingInvoiceManualLineConfigMutation) (Value, error) { + switch m.Op() { + case OpCreate: + return (&BillingInvoiceManualLineConfigCreate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdate: + return (&BillingInvoiceManualLineConfigUpdate{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpUpdateOne: + return (&BillingInvoiceManualLineConfigUpdateOne{config: c.config, hooks: c.Hooks(), mutation: m}).Save(ctx) + case OpDelete, OpDeleteOne: + return (&BillingInvoiceManualLineConfigDelete{config: c.config, hooks: c.Hooks(), mutation: m}).Exec(ctx) + default: + return nil, fmt.Errorf("db: unknown BillingInvoiceManualLineConfig mutation op: %q", m.Op()) } } @@ -2253,6 +2524,22 @@ func (c *CustomerClient) QueryBillingCustomerOverride(cu *Customer) *BillingCust return query } +// QueryBillingInvoice queries the billing_invoice edge of a Customer. +func (c *CustomerClient) QueryBillingInvoice(cu *Customer) *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: c.config}).Query() + query.path = func(context.Context) (fromV *sql.Selector, _ error) { + id := cu.ID + step := sqlgraph.NewStep( + sqlgraph.From(customer.Table, customer.FieldID, id), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, customer.BillingInvoiceTable, customer.BillingInvoiceColumn), + ) + fromV = sqlgraph.Neighbors(cu.driver.Dialect(), step) + return fromV, nil + } + return query +} + // Hooks returns the client hooks. func (c *CustomerClient) Hooks() []Hook { return c.hooks.Customer @@ -3703,17 +3990,19 @@ func (c *UsageResetClient) mutate(ctx context.Context, m *UsageResetMutation) (V type ( hooks struct { App, AppCustomer, AppStripe, AppStripeCustomer, BalanceSnapshot, - BillingCustomerOverride, BillingInvoice, BillingInvoiceItem, BillingProfile, - BillingWorkflowConfig, Customer, CustomerSubjects, Entitlement, Feature, Grant, - NotificationChannel, NotificationEvent, NotificationEventDeliveryStatus, - NotificationRule, UsageReset []ent.Hook + BillingCustomerOverride, BillingInvoice, BillingInvoiceLine, + BillingInvoiceManualLineConfig, BillingProfile, BillingWorkflowConfig, + Customer, CustomerSubjects, Entitlement, Feature, Grant, NotificationChannel, + NotificationEvent, NotificationEventDeliveryStatus, NotificationRule, + UsageReset []ent.Hook } inters struct { App, AppCustomer, AppStripe, AppStripeCustomer, BalanceSnapshot, - BillingCustomerOverride, BillingInvoice, BillingInvoiceItem, BillingProfile, - BillingWorkflowConfig, Customer, CustomerSubjects, Entitlement, Feature, Grant, - NotificationChannel, NotificationEvent, NotificationEventDeliveryStatus, - NotificationRule, UsageReset []ent.Interceptor + BillingCustomerOverride, BillingInvoice, BillingInvoiceLine, + BillingInvoiceManualLineConfig, BillingProfile, BillingWorkflowConfig, + Customer, CustomerSubjects, Entitlement, Feature, Grant, NotificationChannel, + NotificationEvent, NotificationEventDeliveryStatus, NotificationRule, + UsageReset []ent.Interceptor } ) diff --git a/openmeter/ent/db/customer.go b/openmeter/ent/db/customer.go index dde5ab1c0..815e71bcc 100644 --- a/openmeter/ent/db/customer.go +++ b/openmeter/ent/db/customer.go @@ -70,9 +70,11 @@ type CustomerEdges struct { Subjects []*CustomerSubjects `json:"subjects,omitempty"` // BillingCustomerOverride holds the value of the billing_customer_override edge. BillingCustomerOverride *BillingCustomerOverride `json:"billing_customer_override,omitempty"` + // BillingInvoice holds the value of the billing_invoice edge. + BillingInvoice []*BillingInvoice `json:"billing_invoice,omitempty"` // loadedTypes holds the information for reporting if a // type was loaded (or requested) in eager-loading or not. - loadedTypes [3]bool + loadedTypes [4]bool } // AppsOrErr returns the Apps value or an error if the edge @@ -104,6 +106,15 @@ func (e CustomerEdges) BillingCustomerOverrideOrErr() (*BillingCustomerOverride, return nil, &NotLoadedError{edge: "billing_customer_override"} } +// BillingInvoiceOrErr returns the BillingInvoice value or an error if the edge +// was not loaded in eager-loading. +func (e CustomerEdges) BillingInvoiceOrErr() ([]*BillingInvoice, error) { + if e.loadedTypes[3] { + return e.BillingInvoice, nil + } + return nil, &NotLoadedError{edge: "billing_invoice"} +} + // scanValues returns the types for scanning values from sql.Rows. func (*Customer) scanValues(columns []string) ([]any, error) { values := make([]any, len(columns)) @@ -280,6 +291,11 @@ func (c *Customer) QueryBillingCustomerOverride() *BillingCustomerOverrideQuery return NewCustomerClient(c.config).QueryBillingCustomerOverride(c) } +// QueryBillingInvoice queries the "billing_invoice" edge of the Customer entity. +func (c *Customer) QueryBillingInvoice() *BillingInvoiceQuery { + return NewCustomerClient(c.config).QueryBillingInvoice(c) +} + // Update returns a builder for updating this Customer. // Note that you need to call Customer.Unwrap() before calling this method if this Customer // was returned from a transaction, and the transaction was committed or rolled back. diff --git a/openmeter/ent/db/customer/customer.go b/openmeter/ent/db/customer/customer.go index 622c32941..7a16c095b 100644 --- a/openmeter/ent/db/customer/customer.go +++ b/openmeter/ent/db/customer/customer.go @@ -54,6 +54,8 @@ const ( EdgeSubjects = "subjects" // EdgeBillingCustomerOverride holds the string denoting the billing_customer_override edge name in mutations. EdgeBillingCustomerOverride = "billing_customer_override" + // EdgeBillingInvoice holds the string denoting the billing_invoice edge name in mutations. + EdgeBillingInvoice = "billing_invoice" // Table holds the table name of the customer in the database. Table = "customers" // AppsTable is the table that holds the apps relation/edge. @@ -77,6 +79,13 @@ const ( BillingCustomerOverrideInverseTable = "billing_customer_overrides" // BillingCustomerOverrideColumn is the table column denoting the billing_customer_override relation/edge. BillingCustomerOverrideColumn = "customer_id" + // BillingInvoiceTable is the table that holds the billing_invoice relation/edge. + BillingInvoiceTable = "billing_invoices" + // BillingInvoiceInverseTable is the table name for the BillingInvoice entity. + // It exists in this package in order to avoid circular dependency with the "billinginvoice" package. + BillingInvoiceInverseTable = "billing_invoices" + // BillingInvoiceColumn is the table column denoting the billing_invoice relation/edge. + BillingInvoiceColumn = "customer_id" ) // Columns holds all SQL columns for customer fields. @@ -250,6 +259,20 @@ func ByBillingCustomerOverrideField(field string, opts ...sql.OrderTermOption) O sqlgraph.OrderByNeighborTerms(s, newBillingCustomerOverrideStep(), sql.OrderByField(field, opts...)) } } + +// ByBillingInvoiceCount orders the results by billing_invoice count. +func ByBillingInvoiceCount(opts ...sql.OrderTermOption) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborsCount(s, newBillingInvoiceStep(), opts...) + } +} + +// ByBillingInvoice orders the results by billing_invoice terms. +func ByBillingInvoice(term sql.OrderTerm, terms ...sql.OrderTerm) OrderOption { + return func(s *sql.Selector) { + sqlgraph.OrderByNeighborTerms(s, newBillingInvoiceStep(), append([]sql.OrderTerm{term}, terms...)...) + } +} func newAppsStep() *sqlgraph.Step { return sqlgraph.NewStep( sqlgraph.From(Table, FieldID), @@ -271,3 +294,10 @@ func newBillingCustomerOverrideStep() *sqlgraph.Step { sqlgraph.Edge(sqlgraph.O2O, false, BillingCustomerOverrideTable, BillingCustomerOverrideColumn), ) } +func newBillingInvoiceStep() *sqlgraph.Step { + return sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.To(BillingInvoiceInverseTable, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceTable, BillingInvoiceColumn), + ) +} diff --git a/openmeter/ent/db/customer/where.go b/openmeter/ent/db/customer/where.go index 1d9595d62..56711029e 100644 --- a/openmeter/ent/db/customer/where.go +++ b/openmeter/ent/db/customer/where.go @@ -1372,6 +1372,29 @@ func HasBillingCustomerOverrideWith(preds ...predicate.BillingCustomerOverride) }) } +// HasBillingInvoice applies the HasEdge predicate on the "billing_invoice" edge. +func HasBillingInvoice() predicate.Customer { + return predicate.Customer(func(s *sql.Selector) { + step := sqlgraph.NewStep( + sqlgraph.From(Table, FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, BillingInvoiceTable, BillingInvoiceColumn), + ) + sqlgraph.HasNeighbors(s, step) + }) +} + +// HasBillingInvoiceWith applies the HasEdge predicate on the "billing_invoice" edge with a given conditions (other predicates). +func HasBillingInvoiceWith(preds ...predicate.BillingInvoice) predicate.Customer { + return predicate.Customer(func(s *sql.Selector) { + step := newBillingInvoiceStep() + sqlgraph.HasNeighborsWith(s, step, func(s *sql.Selector) { + for _, p := range preds { + p(s) + } + }) + }) +} + // And groups predicates with the AND operator between them. func And(predicates ...predicate.Customer) predicate.Customer { return predicate.Customer(sql.AndPredicates(predicates...)) diff --git a/openmeter/ent/db/customer_create.go b/openmeter/ent/db/customer_create.go index e1091bfa9..a4a484877 100644 --- a/openmeter/ent/db/customer_create.go +++ b/openmeter/ent/db/customer_create.go @@ -14,6 +14,7 @@ import ( "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" "github.com/openmeterio/openmeter/openmeter/ent/db/customersubjects" "github.com/openmeterio/openmeter/pkg/currencyx" @@ -306,6 +307,21 @@ func (cc *CustomerCreate) SetBillingCustomerOverride(b *BillingCustomerOverride) return cc.SetBillingCustomerOverrideID(b.ID) } +// AddBillingInvoiceIDs adds the "billing_invoice" edge to the BillingInvoice entity by IDs. +func (cc *CustomerCreate) AddBillingInvoiceIDs(ids ...string) *CustomerCreate { + cc.mutation.AddBillingInvoiceIDs(ids...) + return cc +} + +// AddBillingInvoice adds the "billing_invoice" edges to the BillingInvoice entity. +func (cc *CustomerCreate) AddBillingInvoice(b ...*BillingInvoice) *CustomerCreate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return cc.AddBillingInvoiceIDs(ids...) +} + // Mutation returns the CustomerMutation object of the builder. func (cc *CustomerCreate) Mutation() *CustomerMutation { return cc.mutation @@ -379,6 +395,11 @@ func (cc *CustomerCreate) check() error { return &ValidationError{Name: "billing_address_country", err: fmt.Errorf(`db: validator failed for field "Customer.billing_address_country": %w`, err)} } } + if v, ok := cc.mutation.Timezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "timezone", err: fmt.Errorf(`db: validator failed for field "Customer.timezone": %w`, err)} + } + } if v, ok := cc.mutation.Currency(); ok { if err := customer.CurrencyValidator(string(v)); err != nil { return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "Customer.currency": %w`, err)} @@ -536,6 +557,22 @@ func (cc *CustomerCreate) createSpec() (*Customer, *sqlgraph.CreateSpec) { } _spec.Edges = append(_spec.Edges, edge) } + if nodes := cc.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges = append(_spec.Edges, edge) + } return _node, _spec } diff --git a/openmeter/ent/db/customer_query.go b/openmeter/ent/db/customer_query.go index 7ff8a8d51..56edead87 100644 --- a/openmeter/ent/db/customer_query.go +++ b/openmeter/ent/db/customer_query.go @@ -15,6 +15,7 @@ import ( "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" "github.com/openmeterio/openmeter/openmeter/ent/db/customersubjects" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" @@ -30,6 +31,7 @@ type CustomerQuery struct { withApps *AppCustomerQuery withSubjects *CustomerSubjectsQuery withBillingCustomerOverride *BillingCustomerOverrideQuery + withBillingInvoice *BillingInvoiceQuery modifiers []func(*sql.Selector) // intermediate query (i.e. traversal path). sql *sql.Selector @@ -133,6 +135,28 @@ func (cq *CustomerQuery) QueryBillingCustomerOverride() *BillingCustomerOverride return query } +// QueryBillingInvoice chains the current query on the "billing_invoice" edge. +func (cq *CustomerQuery) QueryBillingInvoice() *BillingInvoiceQuery { + query := (&BillingInvoiceClient{config: cq.config}).Query() + query.path = func(ctx context.Context) (fromU *sql.Selector, err error) { + if err := cq.prepareQuery(ctx); err != nil { + return nil, err + } + selector := cq.sqlQuery(ctx) + if err := selector.Err(); err != nil { + return nil, err + } + step := sqlgraph.NewStep( + sqlgraph.From(customer.Table, customer.FieldID, selector), + sqlgraph.To(billinginvoice.Table, billinginvoice.FieldID), + sqlgraph.Edge(sqlgraph.O2M, false, customer.BillingInvoiceTable, customer.BillingInvoiceColumn), + ) + fromU = sqlgraph.SetNeighbors(cq.driver.Dialect(), step) + return fromU, nil + } + return query +} + // First returns the first Customer entity from the query. // Returns a *NotFoundError when no Customer was found. func (cq *CustomerQuery) First(ctx context.Context) (*Customer, error) { @@ -328,6 +352,7 @@ func (cq *CustomerQuery) Clone() *CustomerQuery { withApps: cq.withApps.Clone(), withSubjects: cq.withSubjects.Clone(), withBillingCustomerOverride: cq.withBillingCustomerOverride.Clone(), + withBillingInvoice: cq.withBillingInvoice.Clone(), // clone intermediate query. sql: cq.sql.Clone(), path: cq.path, @@ -367,6 +392,17 @@ func (cq *CustomerQuery) WithBillingCustomerOverride(opts ...func(*BillingCustom return cq } +// WithBillingInvoice tells the query-builder to eager-load the nodes that are connected to +// the "billing_invoice" edge. The optional arguments are used to configure the query builder of the edge. +func (cq *CustomerQuery) WithBillingInvoice(opts ...func(*BillingInvoiceQuery)) *CustomerQuery { + query := (&BillingInvoiceClient{config: cq.config}).Query() + for _, opt := range opts { + opt(query) + } + cq.withBillingInvoice = query + return cq +} + // GroupBy is used to group vertices by one or more fields/columns. // It is often used with aggregate functions, like: count, max, mean, min, sum. // @@ -445,10 +481,11 @@ func (cq *CustomerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Cus var ( nodes = []*Customer{} _spec = cq.querySpec() - loadedTypes = [3]bool{ + loadedTypes = [4]bool{ cq.withApps != nil, cq.withSubjects != nil, cq.withBillingCustomerOverride != nil, + cq.withBillingInvoice != nil, } ) _spec.ScanValues = func(columns []string) ([]any, error) { @@ -492,6 +529,13 @@ func (cq *CustomerQuery) sqlAll(ctx context.Context, hooks ...queryHook) ([]*Cus return nil, err } } + if query := cq.withBillingInvoice; query != nil { + if err := cq.loadBillingInvoice(ctx, query, nodes, + func(n *Customer) { n.Edges.BillingInvoice = []*BillingInvoice{} }, + func(n *Customer, e *BillingInvoice) { n.Edges.BillingInvoice = append(n.Edges.BillingInvoice, e) }); err != nil { + return nil, err + } + } return nodes, nil } @@ -582,6 +626,36 @@ func (cq *CustomerQuery) loadBillingCustomerOverride(ctx context.Context, query } return nil } +func (cq *CustomerQuery) loadBillingInvoice(ctx context.Context, query *BillingInvoiceQuery, nodes []*Customer, init func(*Customer), assign func(*Customer, *BillingInvoice)) error { + fks := make([]driver.Value, 0, len(nodes)) + nodeids := make(map[string]*Customer) + for i := range nodes { + fks = append(fks, nodes[i].ID) + nodeids[nodes[i].ID] = nodes[i] + if init != nil { + init(nodes[i]) + } + } + if len(query.ctx.Fields) > 0 { + query.ctx.AppendFieldOnce(billinginvoice.FieldCustomerID) + } + query.Where(predicate.BillingInvoice(func(s *sql.Selector) { + s.Where(sql.InValues(s.C(customer.BillingInvoiceColumn), fks...)) + })) + neighbors, err := query.All(ctx) + if err != nil { + return err + } + for _, n := range neighbors { + fk := n.CustomerID + node, ok := nodeids[fk] + if !ok { + return fmt.Errorf(`unexpected referenced foreign-key "customer_id" returned %v for node %v`, fk, n.ID) + } + assign(node, n) + } + return nil +} func (cq *CustomerQuery) sqlCount(ctx context.Context) (int, error) { _spec := cq.querySpec() diff --git a/openmeter/ent/db/customer_update.go b/openmeter/ent/db/customer_update.go index b60becbab..edbfbdf66 100644 --- a/openmeter/ent/db/customer_update.go +++ b/openmeter/ent/db/customer_update.go @@ -13,6 +13,7 @@ import ( "entgo.io/ent/schema/field" "github.com/openmeterio/openmeter/openmeter/ent/db/appcustomer" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" "github.com/openmeterio/openmeter/openmeter/ent/db/customersubjects" "github.com/openmeterio/openmeter/openmeter/ent/db/predicate" @@ -355,6 +356,21 @@ func (cu *CustomerUpdate) SetBillingCustomerOverride(b *BillingCustomerOverride) return cu.SetBillingCustomerOverrideID(b.ID) } +// AddBillingInvoiceIDs adds the "billing_invoice" edge to the BillingInvoice entity by IDs. +func (cu *CustomerUpdate) AddBillingInvoiceIDs(ids ...string) *CustomerUpdate { + cu.mutation.AddBillingInvoiceIDs(ids...) + return cu +} + +// AddBillingInvoice adds the "billing_invoice" edges to the BillingInvoice entity. +func (cu *CustomerUpdate) AddBillingInvoice(b ...*BillingInvoice) *CustomerUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return cu.AddBillingInvoiceIDs(ids...) +} + // Mutation returns the CustomerMutation object of the builder. func (cu *CustomerUpdate) Mutation() *CustomerMutation { return cu.mutation @@ -408,6 +424,27 @@ func (cu *CustomerUpdate) ClearBillingCustomerOverride() *CustomerUpdate { return cu } +// ClearBillingInvoice clears all "billing_invoice" edges to the BillingInvoice entity. +func (cu *CustomerUpdate) ClearBillingInvoice() *CustomerUpdate { + cu.mutation.ClearBillingInvoice() + return cu +} + +// RemoveBillingInvoiceIDs removes the "billing_invoice" edge to BillingInvoice entities by IDs. +func (cu *CustomerUpdate) RemoveBillingInvoiceIDs(ids ...string) *CustomerUpdate { + cu.mutation.RemoveBillingInvoiceIDs(ids...) + return cu +} + +// RemoveBillingInvoice removes "billing_invoice" edges to BillingInvoice entities. +func (cu *CustomerUpdate) RemoveBillingInvoice(b ...*BillingInvoice) *CustomerUpdate { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return cu.RemoveBillingInvoiceIDs(ids...) +} + // Save executes the query and returns the number of nodes affected by the update operation. func (cu *CustomerUpdate) Save(ctx context.Context) (int, error) { cu.defaults() @@ -451,6 +488,11 @@ func (cu *CustomerUpdate) check() error { return &ValidationError{Name: "billing_address_country", err: fmt.Errorf(`db: validator failed for field "Customer.billing_address_country": %w`, err)} } } + if v, ok := cu.mutation.Timezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "timezone", err: fmt.Errorf(`db: validator failed for field "Customer.timezone": %w`, err)} + } + } if v, ok := cu.mutation.Currency(); ok { if err := customer.CurrencyValidator(string(v)); err != nil { return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "Customer.currency": %w`, err)} @@ -674,6 +716,51 @@ func (cu *CustomerUpdate) sqlSave(ctx context.Context) (n int, err error) { } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if cu.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := cu.mutation.RemovedBillingInvoiceIDs(); len(nodes) > 0 && !cu.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := cu.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } if n, err = sqlgraph.UpdateNodes(ctx, cu.driver, _spec); err != nil { if _, ok := err.(*sqlgraph.NotFoundError); ok { err = &NotFoundError{customer.Label} @@ -1015,6 +1102,21 @@ func (cuo *CustomerUpdateOne) SetBillingCustomerOverride(b *BillingCustomerOverr return cuo.SetBillingCustomerOverrideID(b.ID) } +// AddBillingInvoiceIDs adds the "billing_invoice" edge to the BillingInvoice entity by IDs. +func (cuo *CustomerUpdateOne) AddBillingInvoiceIDs(ids ...string) *CustomerUpdateOne { + cuo.mutation.AddBillingInvoiceIDs(ids...) + return cuo +} + +// AddBillingInvoice adds the "billing_invoice" edges to the BillingInvoice entity. +func (cuo *CustomerUpdateOne) AddBillingInvoice(b ...*BillingInvoice) *CustomerUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return cuo.AddBillingInvoiceIDs(ids...) +} + // Mutation returns the CustomerMutation object of the builder. func (cuo *CustomerUpdateOne) Mutation() *CustomerMutation { return cuo.mutation @@ -1068,6 +1170,27 @@ func (cuo *CustomerUpdateOne) ClearBillingCustomerOverride() *CustomerUpdateOne return cuo } +// ClearBillingInvoice clears all "billing_invoice" edges to the BillingInvoice entity. +func (cuo *CustomerUpdateOne) ClearBillingInvoice() *CustomerUpdateOne { + cuo.mutation.ClearBillingInvoice() + return cuo +} + +// RemoveBillingInvoiceIDs removes the "billing_invoice" edge to BillingInvoice entities by IDs. +func (cuo *CustomerUpdateOne) RemoveBillingInvoiceIDs(ids ...string) *CustomerUpdateOne { + cuo.mutation.RemoveBillingInvoiceIDs(ids...) + return cuo +} + +// RemoveBillingInvoice removes "billing_invoice" edges to BillingInvoice entities. +func (cuo *CustomerUpdateOne) RemoveBillingInvoice(b ...*BillingInvoice) *CustomerUpdateOne { + ids := make([]string, len(b)) + for i := range b { + ids[i] = b[i].ID + } + return cuo.RemoveBillingInvoiceIDs(ids...) +} + // Where appends a list predicates to the CustomerUpdate builder. func (cuo *CustomerUpdateOne) Where(ps ...predicate.Customer) *CustomerUpdateOne { cuo.mutation.Where(ps...) @@ -1124,6 +1247,11 @@ func (cuo *CustomerUpdateOne) check() error { return &ValidationError{Name: "billing_address_country", err: fmt.Errorf(`db: validator failed for field "Customer.billing_address_country": %w`, err)} } } + if v, ok := cuo.mutation.Timezone(); ok { + if err := v.Validate(); err != nil { + return &ValidationError{Name: "timezone", err: fmt.Errorf(`db: validator failed for field "Customer.timezone": %w`, err)} + } + } if v, ok := cuo.mutation.Currency(); ok { if err := customer.CurrencyValidator(string(v)); err != nil { return &ValidationError{Name: "currency", err: fmt.Errorf(`db: validator failed for field "Customer.currency": %w`, err)} @@ -1364,6 +1492,51 @@ func (cuo *CustomerUpdateOne) sqlSave(ctx context.Context) (_node *Customer, err } _spec.Edges.Add = append(_spec.Edges.Add, edge) } + if cuo.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := cuo.mutation.RemovedBillingInvoiceIDs(); len(nodes) > 0 && !cuo.mutation.BillingInvoiceCleared() { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Clear = append(_spec.Edges.Clear, edge) + } + if nodes := cuo.mutation.BillingInvoiceIDs(); len(nodes) > 0 { + edge := &sqlgraph.EdgeSpec{ + Rel: sqlgraph.O2M, + Inverse: false, + Table: customer.BillingInvoiceTable, + Columns: []string{customer.BillingInvoiceColumn}, + Bidi: false, + Target: &sqlgraph.EdgeTarget{ + IDSpec: sqlgraph.NewFieldSpec(billinginvoice.FieldID, field.TypeString), + }, + } + for _, k := range nodes { + edge.Target.Nodes = append(edge.Target.Nodes, k) + } + _spec.Edges.Add = append(_spec.Edges.Add, edge) + } _node = &Customer{config: cuo.config} _spec.Assign = _node.assignValues _spec.ScanValues = _node.scanValues diff --git a/openmeter/ent/db/ent.go b/openmeter/ent/db/ent.go index 76ccf6f2c..e2f8a8e1e 100644 --- a/openmeter/ent/db/ent.go +++ b/openmeter/ent/db/ent.go @@ -19,7 +19,8 @@ import ( "github.com/openmeterio/openmeter/openmeter/ent/db/balancesnapshot" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" @@ -100,7 +101,8 @@ func checkColumn(table, column string) error { balancesnapshot.Table: balancesnapshot.ValidColumn, billingcustomeroverride.Table: billingcustomeroverride.ValidColumn, billinginvoice.Table: billinginvoice.ValidColumn, - billinginvoiceitem.Table: billinginvoiceitem.ValidColumn, + billinginvoiceline.Table: billinginvoiceline.ValidColumn, + billinginvoicemanuallineconfig.Table: billinginvoicemanuallineconfig.ValidColumn, billingprofile.Table: billingprofile.ValidColumn, billingworkflowconfig.Table: billingworkflowconfig.ValidColumn, customer.Table: customer.ValidColumn, diff --git a/openmeter/ent/db/expose.go b/openmeter/ent/db/expose.go index ceeee72ab..f0a099a57 100644 --- a/openmeter/ent/db/expose.go +++ b/openmeter/ent/db/expose.go @@ -103,7 +103,9 @@ func NewTxClientFromRawConfig(ctx context.Context, cfg entutils.RawEntConfig) *T BillingInvoice: NewBillingInvoiceClient(config), - BillingInvoiceItem: NewBillingInvoiceItemClient(config), + BillingInvoiceLine: NewBillingInvoiceLineClient(config), + + BillingInvoiceManualLineConfig: NewBillingInvoiceManualLineConfigClient(config), BillingProfile: NewBillingProfileClient(config), diff --git a/openmeter/ent/db/hook/hook.go b/openmeter/ent/db/hook/hook.go index e3c0561d0..dfe878ef3 100644 --- a/openmeter/ent/db/hook/hook.go +++ b/openmeter/ent/db/hook/hook.go @@ -93,16 +93,28 @@ func (f BillingInvoiceFunc) Mutate(ctx context.Context, m db.Mutation) (db.Value return nil, fmt.Errorf("unexpected mutation type %T. expect *db.BillingInvoiceMutation", m) } -// The BillingInvoiceItemFunc type is an adapter to allow the use of ordinary -// function as BillingInvoiceItem mutator. -type BillingInvoiceItemFunc func(context.Context, *db.BillingInvoiceItemMutation) (db.Value, error) +// The BillingInvoiceLineFunc type is an adapter to allow the use of ordinary +// function as BillingInvoiceLine mutator. +type BillingInvoiceLineFunc func(context.Context, *db.BillingInvoiceLineMutation) (db.Value, error) // Mutate calls f(ctx, m). -func (f BillingInvoiceItemFunc) Mutate(ctx context.Context, m db.Mutation) (db.Value, error) { - if mv, ok := m.(*db.BillingInvoiceItemMutation); ok { +func (f BillingInvoiceLineFunc) Mutate(ctx context.Context, m db.Mutation) (db.Value, error) { + if mv, ok := m.(*db.BillingInvoiceLineMutation); ok { return f(ctx, mv) } - return nil, fmt.Errorf("unexpected mutation type %T. expect *db.BillingInvoiceItemMutation", m) + return nil, fmt.Errorf("unexpected mutation type %T. expect *db.BillingInvoiceLineMutation", m) +} + +// The BillingInvoiceManualLineConfigFunc type is an adapter to allow the use of ordinary +// function as BillingInvoiceManualLineConfig mutator. +type BillingInvoiceManualLineConfigFunc func(context.Context, *db.BillingInvoiceManualLineConfigMutation) (db.Value, error) + +// Mutate calls f(ctx, m). +func (f BillingInvoiceManualLineConfigFunc) Mutate(ctx context.Context, m db.Mutation) (db.Value, error) { + if mv, ok := m.(*db.BillingInvoiceManualLineConfigMutation); ok { + return f(ctx, mv) + } + return nil, fmt.Errorf("unexpected mutation type %T. expect *db.BillingInvoiceManualLineConfigMutation", m) } // The BillingProfileFunc type is an adapter to allow the use of ordinary diff --git a/openmeter/ent/db/migrate/schema.go b/openmeter/ent/db/migrate/schema.go index 5e9de34cf..0c82b435d 100644 --- a/openmeter/ent/db/migrate/schema.go +++ b/openmeter/ent/db/migrate/schema.go @@ -246,7 +246,7 @@ var ( {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "collection_alignment", Type: field.TypeEnum, Nullable: true, Enums: []string{"subscription"}}, - {Name: "item_collection_period", Type: field.TypeString, Nullable: true}, + {Name: "line_collection_period", Type: field.TypeString, Nullable: true}, {Name: "invoice_auto_advance", Type: field.TypeBool, Nullable: true}, {Name: "invoice_draft_period", Type: field.TypeString, Nullable: true}, {Name: "invoice_due_after", Type: field.TypeString, Nullable: true}, @@ -300,21 +300,44 @@ var ( BillingInvoicesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, + {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, - {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "series", Type: field.TypeString, Nullable: true}, - {Name: "code", Type: field.TypeString, Nullable: true}, - {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "supplier_address_country", Type: field.TypeString, Nullable: true, Size: 2}, + {Name: "supplier_address_postal_code", Type: field.TypeString, Nullable: true}, + {Name: "supplier_address_state", Type: field.TypeString, Nullable: true}, + {Name: "supplier_address_city", Type: field.TypeString, Nullable: true}, + {Name: "supplier_address_line1", Type: field.TypeString, Nullable: true}, + {Name: "supplier_address_line2", Type: field.TypeString, Nullable: true}, + {Name: "supplier_address_phone_number", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_country", Type: field.TypeString, Nullable: true, Size: 2}, + {Name: "customer_address_postal_code", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_state", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_city", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_line1", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_line2", Type: field.TypeString, Nullable: true}, + {Name: "customer_address_phone_number", Type: field.TypeString, Nullable: true}, + {Name: "supplier_name", Type: field.TypeString}, + {Name: "supplier_tax_code", Type: field.TypeString, Nullable: true}, + {Name: "customer_name", Type: field.TypeString}, + {Name: "customer_timezone", Type: field.TypeString, Nullable: true}, + {Name: "number", Type: field.TypeString, Nullable: true}, + {Name: "type", Type: field.TypeEnum, Enums: []string{"standard", "credit-note"}}, + {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "voided_at", Type: field.TypeTime, Nullable: true}, + {Name: "issued_at", Type: field.TypeTime, Nullable: true}, {Name: "currency", Type: field.TypeString, SchemaType: map[string]string{"postgres": "varchar(3)"}}, - {Name: "due_date", Type: field.TypeTime}, - {Name: "status", Type: field.TypeEnum, Enums: []string{"created", "draft", "draft_sync", "draft_sync_failed", "issuing", "issued", "issuing_failed", "manual_approval_needed"}}, - {Name: "period_start", Type: field.TypeTime}, - {Name: "period_end", Type: field.TypeTime}, - {Name: "billing_profile_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "due_at", Type: field.TypeTime, Nullable: true}, + {Name: "status", Type: field.TypeEnum, Enums: []string{"gathering", "created", "draft", "draft_sync", "draft_sync_failed", "issuing", "issued", "issuing_failed", "manual_approval_needed"}}, + {Name: "period_start", Type: field.TypeTime, Nullable: true}, + {Name: "period_end", Type: field.TypeTime, Nullable: true}, + {Name: "tax_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "invoicing_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "payment_app_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "source_billing_profile_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "workflow_config_id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, } // BillingInvoicesTable holds the schema information for the "billing_invoices" table. BillingInvoicesTable = &schema.Table{ @@ -322,18 +345,42 @@ var ( Columns: BillingInvoicesColumns, PrimaryKey: []*schema.Column{BillingInvoicesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ + { + Symbol: "billing_invoices_apps_billing_invoice_tax_app", + Columns: []*schema.Column{BillingInvoicesColumns[34]}, + RefColumns: []*schema.Column{AppsColumns[0]}, + OnDelete: schema.NoAction, + }, + { + Symbol: "billing_invoices_apps_billing_invoice_invoicing_app", + Columns: []*schema.Column{BillingInvoicesColumns[35]}, + RefColumns: []*schema.Column{AppsColumns[0]}, + OnDelete: schema.NoAction, + }, + { + Symbol: "billing_invoices_apps_billing_invoice_payment_app", + Columns: []*schema.Column{BillingInvoicesColumns[36]}, + RefColumns: []*schema.Column{AppsColumns[0]}, + OnDelete: schema.NoAction, + }, { Symbol: "billing_invoices_billing_profiles_billing_invoices", - Columns: []*schema.Column{BillingInvoicesColumns[15]}, + Columns: []*schema.Column{BillingInvoicesColumns[37]}, RefColumns: []*schema.Column{BillingProfilesColumns[0]}, OnDelete: schema.NoAction, }, { Symbol: "billing_invoices_billing_workflow_configs_billing_invoices", - Columns: []*schema.Column{BillingInvoicesColumns[16]}, + Columns: []*schema.Column{BillingInvoicesColumns[38]}, RefColumns: []*schema.Column{BillingWorkflowConfigsColumns[0]}, OnDelete: schema.NoAction, }, + { + Symbol: "billing_invoices_customers_billing_invoice", + Columns: []*schema.Column{BillingInvoicesColumns[39]}, + RefColumns: []*schema.Column{CustomersColumns[0]}, + OnDelete: schema.NoAction, + }, }, Indexes: []*schema.Index{ { @@ -354,83 +401,94 @@ var ( { Name: "billinginvoice_namespace_customer_id", Unique: false, - Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[8]}, - }, - { - Name: "billinginvoice_namespace_due_date", - Unique: false, - Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[11]}, - }, - { - Name: "billinginvoice_namespace_status", - Unique: false, - Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[12]}, - }, - { - Name: "billinginvoice_namespace_customer_id_series_code", - Unique: true, - Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[8], BillingInvoicesColumns[6], BillingInvoicesColumns[7]}, + Columns: []*schema.Column{BillingInvoicesColumns[1], BillingInvoicesColumns[39]}, }, }, } - // BillingInvoiceItemsColumns holds the columns for the "billing_invoice_items" table. - BillingInvoiceItemsColumns = []*schema.Column{ + // BillingInvoiceLinesColumns holds the columns for the "billing_invoice_lines" table. + BillingInvoiceLinesColumns = []*schema.Column{ {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, {Name: "namespace", Type: field.TypeString}, + {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, {Name: "created_at", Type: field.TypeTime}, {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, - {Name: "metadata", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "customer_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "name", Type: field.TypeString}, + {Name: "description", Type: field.TypeString, Nullable: true}, {Name: "period_start", Type: field.TypeTime}, {Name: "period_end", Type: field.TypeTime}, {Name: "invoice_at", Type: field.TypeTime}, - {Name: "type", Type: field.TypeEnum, Enums: []string{"static", "usage"}}, - {Name: "name", Type: field.TypeString}, - {Name: "quantity", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "numeric"}}, - {Name: "unit_price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, + {Name: "type", Type: field.TypeEnum, Enums: []string{"manual_fee", "flat_fee", "usage_based"}}, + {Name: "status", Type: field.TypeEnum, Enums: []string{"valid", "split"}}, {Name: "currency", Type: field.TypeString, SchemaType: map[string]string{"postgres": "varchar(3)"}}, - {Name: "tax_code_override", Type: field.TypeJSON, SchemaType: map[string]string{"postgres": "jsonb"}}, - {Name: "invoice_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "quantity", Type: field.TypeOther, Nullable: true, SchemaType: map[string]string{"postgres": "numeric"}}, + {Name: "tax_overrides", Type: field.TypeJSON, Nullable: true, SchemaType: map[string]string{"postgres": "jsonb"}}, + {Name: "invoice_id", Type: field.TypeString, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "manual_line_config_id", Type: field.TypeString, Nullable: true, SchemaType: map[string]string{"postgres": "char(26)"}}, } - // BillingInvoiceItemsTable holds the schema information for the "billing_invoice_items" table. - BillingInvoiceItemsTable = &schema.Table{ - Name: "billing_invoice_items", - Columns: BillingInvoiceItemsColumns, - PrimaryKey: []*schema.Column{BillingInvoiceItemsColumns[0]}, + // BillingInvoiceLinesTable holds the schema information for the "billing_invoice_lines" table. + BillingInvoiceLinesTable = &schema.Table{ + Name: "billing_invoice_lines", + Columns: BillingInvoiceLinesColumns, + PrimaryKey: []*schema.Column{BillingInvoiceLinesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { - Symbol: "billing_invoice_items_billing_invoices_billing_invoice_items", - Columns: []*schema.Column{BillingInvoiceItemsColumns[16]}, + Symbol: "billing_invoice_lines_billing_invoices_billing_invoice_lines", + Columns: []*schema.Column{BillingInvoiceLinesColumns[16]}, RefColumns: []*schema.Column{BillingInvoicesColumns[0]}, + OnDelete: schema.NoAction, + }, + { + Symbol: "billing_invoice_lines_billing_invoice_manual_line_configs_billing_invoice_manual_lines", + Columns: []*schema.Column{BillingInvoiceLinesColumns[17]}, + RefColumns: []*schema.Column{BillingInvoiceManualLineConfigsColumns[0]}, OnDelete: schema.SetNull, }, }, Indexes: []*schema.Index{ { - Name: "billinginvoiceitem_id", + Name: "billinginvoiceline_id", Unique: true, - Columns: []*schema.Column{BillingInvoiceItemsColumns[0]}, + Columns: []*schema.Column{BillingInvoiceLinesColumns[0]}, }, { - Name: "billinginvoiceitem_namespace", + Name: "billinginvoiceline_namespace", Unique: false, - Columns: []*schema.Column{BillingInvoiceItemsColumns[1]}, + Columns: []*schema.Column{BillingInvoiceLinesColumns[1]}, }, { - Name: "billinginvoiceitem_namespace_id", - Unique: false, - Columns: []*schema.Column{BillingInvoiceItemsColumns[1], BillingInvoiceItemsColumns[0]}, + Name: "billinginvoiceline_namespace_id", + Unique: true, + Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[0]}, }, { - Name: "billinginvoiceitem_namespace_invoice_id", + Name: "billinginvoiceline_namespace_invoice_id", Unique: false, - Columns: []*schema.Column{BillingInvoiceItemsColumns[1], BillingInvoiceItemsColumns[16]}, + Columns: []*schema.Column{BillingInvoiceLinesColumns[1], BillingInvoiceLinesColumns[16]}, }, + }, + } + // BillingInvoiceManualLineConfigsColumns holds the columns for the "billing_invoice_manual_line_configs" table. + BillingInvoiceManualLineConfigsColumns = []*schema.Column{ + {Name: "id", Type: field.TypeString, Unique: true, SchemaType: map[string]string{"postgres": "char(26)"}}, + {Name: "namespace", Type: field.TypeString}, + {Name: "unit_price", Type: field.TypeOther, SchemaType: map[string]string{"postgres": "numeric"}}, + } + // BillingInvoiceManualLineConfigsTable holds the schema information for the "billing_invoice_manual_line_configs" table. + BillingInvoiceManualLineConfigsTable = &schema.Table{ + Name: "billing_invoice_manual_line_configs", + Columns: BillingInvoiceManualLineConfigsColumns, + PrimaryKey: []*schema.Column{BillingInvoiceManualLineConfigsColumns[0]}, + Indexes: []*schema.Index{ { - Name: "billinginvoiceitem_namespace_customer_id", + Name: "billinginvoicemanuallineconfig_namespace", Unique: false, - Columns: []*schema.Column{BillingInvoiceItemsColumns[1], BillingInvoiceItemsColumns[6]}, + Columns: []*schema.Column{BillingInvoiceManualLineConfigsColumns[1]}, + }, + { + Name: "billinginvoicemanuallineconfig_id", + Unique: true, + Columns: []*schema.Column{BillingInvoiceManualLineConfigsColumns[0]}, }, }, } @@ -466,19 +524,19 @@ var ( PrimaryKey: []*schema.Column{BillingProfilesColumns[0]}, ForeignKeys: []*schema.ForeignKey{ { - Symbol: "billing_profiles_apps_tax_app", + Symbol: "billing_profiles_apps_billing_profile_tax_app", Columns: []*schema.Column{BillingProfilesColumns[18]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { - Symbol: "billing_profiles_apps_invoicing_app", + Symbol: "billing_profiles_apps_billing_profile_invoicing_app", Columns: []*schema.Column{BillingProfilesColumns[19]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, }, { - Symbol: "billing_profiles_apps_payment_app", + Symbol: "billing_profiles_apps_billing_profile_payment_app", Columns: []*schema.Column{BillingProfilesColumns[20]}, RefColumns: []*schema.Column{AppsColumns[0]}, OnDelete: schema.NoAction, @@ -521,7 +579,7 @@ var ( {Name: "updated_at", Type: field.TypeTime}, {Name: "deleted_at", Type: field.TypeTime, Nullable: true}, {Name: "collection_alignment", Type: field.TypeEnum, Enums: []string{"subscription"}}, - {Name: "item_collection_period", Type: field.TypeString}, + {Name: "line_collection_period", Type: field.TypeString}, {Name: "invoice_auto_advance", Type: field.TypeBool}, {Name: "invoice_draft_period", Type: field.TypeString}, {Name: "invoice_due_after", Type: field.TypeString}, @@ -1087,7 +1145,8 @@ var ( BalanceSnapshotsTable, BillingCustomerOverridesTable, BillingInvoicesTable, - BillingInvoiceItemsTable, + BillingInvoiceLinesTable, + BillingInvoiceManualLineConfigsTable, BillingProfilesTable, BillingWorkflowConfigsTable, CustomersTable, @@ -1114,9 +1173,14 @@ func init() { BalanceSnapshotsTable.ForeignKeys[0].RefTable = EntitlementsTable BillingCustomerOverridesTable.ForeignKeys[0].RefTable = BillingProfilesTable BillingCustomerOverridesTable.ForeignKeys[1].RefTable = CustomersTable - BillingInvoicesTable.ForeignKeys[0].RefTable = BillingProfilesTable - BillingInvoicesTable.ForeignKeys[1].RefTable = BillingWorkflowConfigsTable - BillingInvoiceItemsTable.ForeignKeys[0].RefTable = BillingInvoicesTable + BillingInvoicesTable.ForeignKeys[0].RefTable = AppsTable + BillingInvoicesTable.ForeignKeys[1].RefTable = AppsTable + BillingInvoicesTable.ForeignKeys[2].RefTable = AppsTable + BillingInvoicesTable.ForeignKeys[3].RefTable = BillingProfilesTable + BillingInvoicesTable.ForeignKeys[4].RefTable = BillingWorkflowConfigsTable + BillingInvoicesTable.ForeignKeys[5].RefTable = CustomersTable + BillingInvoiceLinesTable.ForeignKeys[0].RefTable = BillingInvoicesTable + BillingInvoiceLinesTable.ForeignKeys[1].RefTable = BillingInvoiceManualLineConfigsTable BillingProfilesTable.ForeignKeys[0].RefTable = AppsTable BillingProfilesTable.ForeignKeys[1].RefTable = AppsTable BillingProfilesTable.ForeignKeys[2].RefTable = AppsTable diff --git a/openmeter/ent/db/mutation.go b/openmeter/ent/db/mutation.go index e4edb65e7..651341479 100644 --- a/openmeter/ent/db/mutation.go +++ b/openmeter/ent/db/mutation.go @@ -23,7 +23,8 @@ import ( "github.com/openmeterio/openmeter/openmeter/ent/db/balancesnapshot" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" @@ -61,7 +62,8 @@ const ( TypeBalanceSnapshot = "BalanceSnapshot" TypeBillingCustomerOverride = "BillingCustomerOverride" TypeBillingInvoice = "BillingInvoice" - TypeBillingInvoiceItem = "BillingInvoiceItem" + TypeBillingInvoiceLine = "BillingInvoiceLine" + TypeBillingInvoiceManualLineConfig = "BillingInvoiceManualLineConfig" TypeBillingProfile = "BillingProfile" TypeBillingWorkflowConfig = "BillingWorkflowConfig" TypeCustomer = "Customer" @@ -79,35 +81,44 @@ const ( // AppMutation represents an operation that mutates the App nodes in the graph. type AppMutation struct { config - op Op - typ string - id *string - namespace *string - metadata *map[string]string - created_at *time.Time - updated_at *time.Time - deleted_at *time.Time - name *string - description *string - _type *appentitybase.AppType - status *appentitybase.AppStatus - is_default *bool - clearedFields map[string]struct{} - customer_apps map[int]struct{} - removedcustomer_apps map[int]struct{} - clearedcustomer_apps bool - tax_app map[string]struct{} - removedtax_app map[string]struct{} - clearedtax_app bool - invoicing_app map[string]struct{} - removedinvoicing_app map[string]struct{} - clearedinvoicing_app bool - payment_app map[string]struct{} - removedpayment_app map[string]struct{} - clearedpayment_app bool - done bool - oldValue func(context.Context) (*App, error) - predicates []predicate.App + op Op + typ string + id *string + namespace *string + metadata *map[string]string + created_at *time.Time + updated_at *time.Time + deleted_at *time.Time + name *string + description *string + _type *appentitybase.AppType + status *appentitybase.AppStatus + is_default *bool + clearedFields map[string]struct{} + customer_apps map[int]struct{} + removedcustomer_apps map[int]struct{} + clearedcustomer_apps bool + billing_profile_tax_app map[string]struct{} + removedbilling_profile_tax_app map[string]struct{} + clearedbilling_profile_tax_app bool + billing_profile_invoicing_app map[string]struct{} + removedbilling_profile_invoicing_app map[string]struct{} + clearedbilling_profile_invoicing_app bool + billing_profile_payment_app map[string]struct{} + removedbilling_profile_payment_app map[string]struct{} + clearedbilling_profile_payment_app bool + billing_invoice_tax_app map[string]struct{} + removedbilling_invoice_tax_app map[string]struct{} + clearedbilling_invoice_tax_app bool + billing_invoice_invoicing_app map[string]struct{} + removedbilling_invoice_invoicing_app map[string]struct{} + clearedbilling_invoice_invoicing_app bool + billing_invoice_payment_app map[string]struct{} + removedbilling_invoice_payment_app map[string]struct{} + clearedbilling_invoice_payment_app bool + done bool + oldValue func(context.Context) (*App, error) + predicates []predicate.App } var _ ent.Mutation = (*AppMutation)(nil) @@ -667,166 +678,328 @@ func (m *AppMutation) ResetCustomerApps() { m.removedcustomer_apps = nil } -// AddTaxAppIDs adds the "tax_app" edge to the BillingProfile entity by ids. -func (m *AppMutation) AddTaxAppIDs(ids ...string) { - if m.tax_app == nil { - m.tax_app = make(map[string]struct{}) +// AddBillingProfileTaxAppIDs adds the "billing_profile_tax_app" edge to the BillingProfile entity by ids. +func (m *AppMutation) AddBillingProfileTaxAppIDs(ids ...string) { + if m.billing_profile_tax_app == nil { + m.billing_profile_tax_app = make(map[string]struct{}) } for i := range ids { - m.tax_app[ids[i]] = struct{}{} + m.billing_profile_tax_app[ids[i]] = struct{}{} } } -// ClearTaxApp clears the "tax_app" edge to the BillingProfile entity. -func (m *AppMutation) ClearTaxApp() { - m.clearedtax_app = true +// ClearBillingProfileTaxApp clears the "billing_profile_tax_app" edge to the BillingProfile entity. +func (m *AppMutation) ClearBillingProfileTaxApp() { + m.clearedbilling_profile_tax_app = true } -// TaxAppCleared reports if the "tax_app" edge to the BillingProfile entity was cleared. -func (m *AppMutation) TaxAppCleared() bool { - return m.clearedtax_app +// BillingProfileTaxAppCleared reports if the "billing_profile_tax_app" edge to the BillingProfile entity was cleared. +func (m *AppMutation) BillingProfileTaxAppCleared() bool { + return m.clearedbilling_profile_tax_app } -// RemoveTaxAppIDs removes the "tax_app" edge to the BillingProfile entity by IDs. -func (m *AppMutation) RemoveTaxAppIDs(ids ...string) { - if m.removedtax_app == nil { - m.removedtax_app = make(map[string]struct{}) +// RemoveBillingProfileTaxAppIDs removes the "billing_profile_tax_app" edge to the BillingProfile entity by IDs. +func (m *AppMutation) RemoveBillingProfileTaxAppIDs(ids ...string) { + if m.removedbilling_profile_tax_app == nil { + m.removedbilling_profile_tax_app = make(map[string]struct{}) } for i := range ids { - delete(m.tax_app, ids[i]) - m.removedtax_app[ids[i]] = struct{}{} + delete(m.billing_profile_tax_app, ids[i]) + m.removedbilling_profile_tax_app[ids[i]] = struct{}{} } } -// RemovedTaxApp returns the removed IDs of the "tax_app" edge to the BillingProfile entity. -func (m *AppMutation) RemovedTaxAppIDs() (ids []string) { - for id := range m.removedtax_app { +// RemovedBillingProfileTaxApp returns the removed IDs of the "billing_profile_tax_app" edge to the BillingProfile entity. +func (m *AppMutation) RemovedBillingProfileTaxAppIDs() (ids []string) { + for id := range m.removedbilling_profile_tax_app { ids = append(ids, id) } return } -// TaxAppIDs returns the "tax_app" edge IDs in the mutation. -func (m *AppMutation) TaxAppIDs() (ids []string) { - for id := range m.tax_app { +// BillingProfileTaxAppIDs returns the "billing_profile_tax_app" edge IDs in the mutation. +func (m *AppMutation) BillingProfileTaxAppIDs() (ids []string) { + for id := range m.billing_profile_tax_app { ids = append(ids, id) } return } -// ResetTaxApp resets all changes to the "tax_app" edge. -func (m *AppMutation) ResetTaxApp() { - m.tax_app = nil - m.clearedtax_app = false - m.removedtax_app = nil +// ResetBillingProfileTaxApp resets all changes to the "billing_profile_tax_app" edge. +func (m *AppMutation) ResetBillingProfileTaxApp() { + m.billing_profile_tax_app = nil + m.clearedbilling_profile_tax_app = false + m.removedbilling_profile_tax_app = nil } -// AddInvoicingAppIDs adds the "invoicing_app" edge to the BillingProfile entity by ids. -func (m *AppMutation) AddInvoicingAppIDs(ids ...string) { - if m.invoicing_app == nil { - m.invoicing_app = make(map[string]struct{}) +// AddBillingProfileInvoicingAppIDs adds the "billing_profile_invoicing_app" edge to the BillingProfile entity by ids. +func (m *AppMutation) AddBillingProfileInvoicingAppIDs(ids ...string) { + if m.billing_profile_invoicing_app == nil { + m.billing_profile_invoicing_app = make(map[string]struct{}) } for i := range ids { - m.invoicing_app[ids[i]] = struct{}{} + m.billing_profile_invoicing_app[ids[i]] = struct{}{} } } -// ClearInvoicingApp clears the "invoicing_app" edge to the BillingProfile entity. -func (m *AppMutation) ClearInvoicingApp() { - m.clearedinvoicing_app = true +// ClearBillingProfileInvoicingApp clears the "billing_profile_invoicing_app" edge to the BillingProfile entity. +func (m *AppMutation) ClearBillingProfileInvoicingApp() { + m.clearedbilling_profile_invoicing_app = true } -// InvoicingAppCleared reports if the "invoicing_app" edge to the BillingProfile entity was cleared. -func (m *AppMutation) InvoicingAppCleared() bool { - return m.clearedinvoicing_app +// BillingProfileInvoicingAppCleared reports if the "billing_profile_invoicing_app" edge to the BillingProfile entity was cleared. +func (m *AppMutation) BillingProfileInvoicingAppCleared() bool { + return m.clearedbilling_profile_invoicing_app } -// RemoveInvoicingAppIDs removes the "invoicing_app" edge to the BillingProfile entity by IDs. -func (m *AppMutation) RemoveInvoicingAppIDs(ids ...string) { - if m.removedinvoicing_app == nil { - m.removedinvoicing_app = make(map[string]struct{}) +// RemoveBillingProfileInvoicingAppIDs removes the "billing_profile_invoicing_app" edge to the BillingProfile entity by IDs. +func (m *AppMutation) RemoveBillingProfileInvoicingAppIDs(ids ...string) { + if m.removedbilling_profile_invoicing_app == nil { + m.removedbilling_profile_invoicing_app = make(map[string]struct{}) } for i := range ids { - delete(m.invoicing_app, ids[i]) - m.removedinvoicing_app[ids[i]] = struct{}{} + delete(m.billing_profile_invoicing_app, ids[i]) + m.removedbilling_profile_invoicing_app[ids[i]] = struct{}{} } } -// RemovedInvoicingApp returns the removed IDs of the "invoicing_app" edge to the BillingProfile entity. -func (m *AppMutation) RemovedInvoicingAppIDs() (ids []string) { - for id := range m.removedinvoicing_app { +// RemovedBillingProfileInvoicingApp returns the removed IDs of the "billing_profile_invoicing_app" edge to the BillingProfile entity. +func (m *AppMutation) RemovedBillingProfileInvoicingAppIDs() (ids []string) { + for id := range m.removedbilling_profile_invoicing_app { ids = append(ids, id) } return } -// InvoicingAppIDs returns the "invoicing_app" edge IDs in the mutation. -func (m *AppMutation) InvoicingAppIDs() (ids []string) { - for id := range m.invoicing_app { +// BillingProfileInvoicingAppIDs returns the "billing_profile_invoicing_app" edge IDs in the mutation. +func (m *AppMutation) BillingProfileInvoicingAppIDs() (ids []string) { + for id := range m.billing_profile_invoicing_app { ids = append(ids, id) } return } -// ResetInvoicingApp resets all changes to the "invoicing_app" edge. -func (m *AppMutation) ResetInvoicingApp() { - m.invoicing_app = nil - m.clearedinvoicing_app = false - m.removedinvoicing_app = nil +// ResetBillingProfileInvoicingApp resets all changes to the "billing_profile_invoicing_app" edge. +func (m *AppMutation) ResetBillingProfileInvoicingApp() { + m.billing_profile_invoicing_app = nil + m.clearedbilling_profile_invoicing_app = false + m.removedbilling_profile_invoicing_app = nil } -// AddPaymentAppIDs adds the "payment_app" edge to the BillingProfile entity by ids. -func (m *AppMutation) AddPaymentAppIDs(ids ...string) { - if m.payment_app == nil { - m.payment_app = make(map[string]struct{}) +// AddBillingProfilePaymentAppIDs adds the "billing_profile_payment_app" edge to the BillingProfile entity by ids. +func (m *AppMutation) AddBillingProfilePaymentAppIDs(ids ...string) { + if m.billing_profile_payment_app == nil { + m.billing_profile_payment_app = make(map[string]struct{}) } for i := range ids { - m.payment_app[ids[i]] = struct{}{} + m.billing_profile_payment_app[ids[i]] = struct{}{} } } -// ClearPaymentApp clears the "payment_app" edge to the BillingProfile entity. -func (m *AppMutation) ClearPaymentApp() { - m.clearedpayment_app = true +// ClearBillingProfilePaymentApp clears the "billing_profile_payment_app" edge to the BillingProfile entity. +func (m *AppMutation) ClearBillingProfilePaymentApp() { + m.clearedbilling_profile_payment_app = true } -// PaymentAppCleared reports if the "payment_app" edge to the BillingProfile entity was cleared. -func (m *AppMutation) PaymentAppCleared() bool { - return m.clearedpayment_app +// BillingProfilePaymentAppCleared reports if the "billing_profile_payment_app" edge to the BillingProfile entity was cleared. +func (m *AppMutation) BillingProfilePaymentAppCleared() bool { + return m.clearedbilling_profile_payment_app } -// RemovePaymentAppIDs removes the "payment_app" edge to the BillingProfile entity by IDs. -func (m *AppMutation) RemovePaymentAppIDs(ids ...string) { - if m.removedpayment_app == nil { - m.removedpayment_app = make(map[string]struct{}) +// RemoveBillingProfilePaymentAppIDs removes the "billing_profile_payment_app" edge to the BillingProfile entity by IDs. +func (m *AppMutation) RemoveBillingProfilePaymentAppIDs(ids ...string) { + if m.removedbilling_profile_payment_app == nil { + m.removedbilling_profile_payment_app = make(map[string]struct{}) } for i := range ids { - delete(m.payment_app, ids[i]) - m.removedpayment_app[ids[i]] = struct{}{} + delete(m.billing_profile_payment_app, ids[i]) + m.removedbilling_profile_payment_app[ids[i]] = struct{}{} } } -// RemovedPaymentApp returns the removed IDs of the "payment_app" edge to the BillingProfile entity. -func (m *AppMutation) RemovedPaymentAppIDs() (ids []string) { - for id := range m.removedpayment_app { +// RemovedBillingProfilePaymentApp returns the removed IDs of the "billing_profile_payment_app" edge to the BillingProfile entity. +func (m *AppMutation) RemovedBillingProfilePaymentAppIDs() (ids []string) { + for id := range m.removedbilling_profile_payment_app { ids = append(ids, id) } return } -// PaymentAppIDs returns the "payment_app" edge IDs in the mutation. -func (m *AppMutation) PaymentAppIDs() (ids []string) { - for id := range m.payment_app { +// BillingProfilePaymentAppIDs returns the "billing_profile_payment_app" edge IDs in the mutation. +func (m *AppMutation) BillingProfilePaymentAppIDs() (ids []string) { + for id := range m.billing_profile_payment_app { ids = append(ids, id) } return } -// ResetPaymentApp resets all changes to the "payment_app" edge. -func (m *AppMutation) ResetPaymentApp() { - m.payment_app = nil - m.clearedpayment_app = false - m.removedpayment_app = nil +// ResetBillingProfilePaymentApp resets all changes to the "billing_profile_payment_app" edge. +func (m *AppMutation) ResetBillingProfilePaymentApp() { + m.billing_profile_payment_app = nil + m.clearedbilling_profile_payment_app = false + m.removedbilling_profile_payment_app = nil +} + +// AddBillingInvoiceTaxAppIDs adds the "billing_invoice_tax_app" edge to the BillingInvoice entity by ids. +func (m *AppMutation) AddBillingInvoiceTaxAppIDs(ids ...string) { + if m.billing_invoice_tax_app == nil { + m.billing_invoice_tax_app = make(map[string]struct{}) + } + for i := range ids { + m.billing_invoice_tax_app[ids[i]] = struct{}{} + } +} + +// ClearBillingInvoiceTaxApp clears the "billing_invoice_tax_app" edge to the BillingInvoice entity. +func (m *AppMutation) ClearBillingInvoiceTaxApp() { + m.clearedbilling_invoice_tax_app = true +} + +// BillingInvoiceTaxAppCleared reports if the "billing_invoice_tax_app" edge to the BillingInvoice entity was cleared. +func (m *AppMutation) BillingInvoiceTaxAppCleared() bool { + return m.clearedbilling_invoice_tax_app +} + +// RemoveBillingInvoiceTaxAppIDs removes the "billing_invoice_tax_app" edge to the BillingInvoice entity by IDs. +func (m *AppMutation) RemoveBillingInvoiceTaxAppIDs(ids ...string) { + if m.removedbilling_invoice_tax_app == nil { + m.removedbilling_invoice_tax_app = make(map[string]struct{}) + } + for i := range ids { + delete(m.billing_invoice_tax_app, ids[i]) + m.removedbilling_invoice_tax_app[ids[i]] = struct{}{} + } +} + +// RemovedBillingInvoiceTaxApp returns the removed IDs of the "billing_invoice_tax_app" edge to the BillingInvoice entity. +func (m *AppMutation) RemovedBillingInvoiceTaxAppIDs() (ids []string) { + for id := range m.removedbilling_invoice_tax_app { + ids = append(ids, id) + } + return +} + +// BillingInvoiceTaxAppIDs returns the "billing_invoice_tax_app" edge IDs in the mutation. +func (m *AppMutation) BillingInvoiceTaxAppIDs() (ids []string) { + for id := range m.billing_invoice_tax_app { + ids = append(ids, id) + } + return +} + +// ResetBillingInvoiceTaxApp resets all changes to the "billing_invoice_tax_app" edge. +func (m *AppMutation) ResetBillingInvoiceTaxApp() { + m.billing_invoice_tax_app = nil + m.clearedbilling_invoice_tax_app = false + m.removedbilling_invoice_tax_app = nil +} + +// AddBillingInvoiceInvoicingAppIDs adds the "billing_invoice_invoicing_app" edge to the BillingInvoice entity by ids. +func (m *AppMutation) AddBillingInvoiceInvoicingAppIDs(ids ...string) { + if m.billing_invoice_invoicing_app == nil { + m.billing_invoice_invoicing_app = make(map[string]struct{}) + } + for i := range ids { + m.billing_invoice_invoicing_app[ids[i]] = struct{}{} + } +} + +// ClearBillingInvoiceInvoicingApp clears the "billing_invoice_invoicing_app" edge to the BillingInvoice entity. +func (m *AppMutation) ClearBillingInvoiceInvoicingApp() { + m.clearedbilling_invoice_invoicing_app = true +} + +// BillingInvoiceInvoicingAppCleared reports if the "billing_invoice_invoicing_app" edge to the BillingInvoice entity was cleared. +func (m *AppMutation) BillingInvoiceInvoicingAppCleared() bool { + return m.clearedbilling_invoice_invoicing_app +} + +// RemoveBillingInvoiceInvoicingAppIDs removes the "billing_invoice_invoicing_app" edge to the BillingInvoice entity by IDs. +func (m *AppMutation) RemoveBillingInvoiceInvoicingAppIDs(ids ...string) { + if m.removedbilling_invoice_invoicing_app == nil { + m.removedbilling_invoice_invoicing_app = make(map[string]struct{}) + } + for i := range ids { + delete(m.billing_invoice_invoicing_app, ids[i]) + m.removedbilling_invoice_invoicing_app[ids[i]] = struct{}{} + } +} + +// RemovedBillingInvoiceInvoicingApp returns the removed IDs of the "billing_invoice_invoicing_app" edge to the BillingInvoice entity. +func (m *AppMutation) RemovedBillingInvoiceInvoicingAppIDs() (ids []string) { + for id := range m.removedbilling_invoice_invoicing_app { + ids = append(ids, id) + } + return +} + +// BillingInvoiceInvoicingAppIDs returns the "billing_invoice_invoicing_app" edge IDs in the mutation. +func (m *AppMutation) BillingInvoiceInvoicingAppIDs() (ids []string) { + for id := range m.billing_invoice_invoicing_app { + ids = append(ids, id) + } + return +} + +// ResetBillingInvoiceInvoicingApp resets all changes to the "billing_invoice_invoicing_app" edge. +func (m *AppMutation) ResetBillingInvoiceInvoicingApp() { + m.billing_invoice_invoicing_app = nil + m.clearedbilling_invoice_invoicing_app = false + m.removedbilling_invoice_invoicing_app = nil +} + +// AddBillingInvoicePaymentAppIDs adds the "billing_invoice_payment_app" edge to the BillingInvoice entity by ids. +func (m *AppMutation) AddBillingInvoicePaymentAppIDs(ids ...string) { + if m.billing_invoice_payment_app == nil { + m.billing_invoice_payment_app = make(map[string]struct{}) + } + for i := range ids { + m.billing_invoice_payment_app[ids[i]] = struct{}{} + } +} + +// ClearBillingInvoicePaymentApp clears the "billing_invoice_payment_app" edge to the BillingInvoice entity. +func (m *AppMutation) ClearBillingInvoicePaymentApp() { + m.clearedbilling_invoice_payment_app = true +} + +// BillingInvoicePaymentAppCleared reports if the "billing_invoice_payment_app" edge to the BillingInvoice entity was cleared. +func (m *AppMutation) BillingInvoicePaymentAppCleared() bool { + return m.clearedbilling_invoice_payment_app +} + +// RemoveBillingInvoicePaymentAppIDs removes the "billing_invoice_payment_app" edge to the BillingInvoice entity by IDs. +func (m *AppMutation) RemoveBillingInvoicePaymentAppIDs(ids ...string) { + if m.removedbilling_invoice_payment_app == nil { + m.removedbilling_invoice_payment_app = make(map[string]struct{}) + } + for i := range ids { + delete(m.billing_invoice_payment_app, ids[i]) + m.removedbilling_invoice_payment_app[ids[i]] = struct{}{} + } +} + +// RemovedBillingInvoicePaymentApp returns the removed IDs of the "billing_invoice_payment_app" edge to the BillingInvoice entity. +func (m *AppMutation) RemovedBillingInvoicePaymentAppIDs() (ids []string) { + for id := range m.removedbilling_invoice_payment_app { + ids = append(ids, id) + } + return +} + +// BillingInvoicePaymentAppIDs returns the "billing_invoice_payment_app" edge IDs in the mutation. +func (m *AppMutation) BillingInvoicePaymentAppIDs() (ids []string) { + for id := range m.billing_invoice_payment_app { + ids = append(ids, id) + } + return +} + +// ResetBillingInvoicePaymentApp resets all changes to the "billing_invoice_payment_app" edge. +func (m *AppMutation) ResetBillingInvoicePaymentApp() { + m.billing_invoice_payment_app = nil + m.clearedbilling_invoice_payment_app = false + m.removedbilling_invoice_payment_app = nil } // Where appends a list predicates to the AppMutation builder. @@ -1136,18 +1309,27 @@ func (m *AppMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *AppMutation) AddedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 7) if m.customer_apps != nil { edges = append(edges, app.EdgeCustomerApps) } - if m.tax_app != nil { - edges = append(edges, app.EdgeTaxApp) + if m.billing_profile_tax_app != nil { + edges = append(edges, app.EdgeBillingProfileTaxApp) } - if m.invoicing_app != nil { - edges = append(edges, app.EdgeInvoicingApp) + if m.billing_profile_invoicing_app != nil { + edges = append(edges, app.EdgeBillingProfileInvoicingApp) } - if m.payment_app != nil { - edges = append(edges, app.EdgePaymentApp) + if m.billing_profile_payment_app != nil { + edges = append(edges, app.EdgeBillingProfilePaymentApp) + } + if m.billing_invoice_tax_app != nil { + edges = append(edges, app.EdgeBillingInvoiceTaxApp) + } + if m.billing_invoice_invoicing_app != nil { + edges = append(edges, app.EdgeBillingInvoiceInvoicingApp) + } + if m.billing_invoice_payment_app != nil { + edges = append(edges, app.EdgeBillingInvoicePaymentApp) } return edges } @@ -1162,21 +1344,39 @@ func (m *AppMutation) AddedIDs(name string) []ent.Value { ids = append(ids, id) } return ids - case app.EdgeTaxApp: - ids := make([]ent.Value, 0, len(m.tax_app)) - for id := range m.tax_app { + case app.EdgeBillingProfileTaxApp: + ids := make([]ent.Value, 0, len(m.billing_profile_tax_app)) + for id := range m.billing_profile_tax_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingProfileInvoicingApp: + ids := make([]ent.Value, 0, len(m.billing_profile_invoicing_app)) + for id := range m.billing_profile_invoicing_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingProfilePaymentApp: + ids := make([]ent.Value, 0, len(m.billing_profile_payment_app)) + for id := range m.billing_profile_payment_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingInvoiceTaxApp: + ids := make([]ent.Value, 0, len(m.billing_invoice_tax_app)) + for id := range m.billing_invoice_tax_app { ids = append(ids, id) } return ids - case app.EdgeInvoicingApp: - ids := make([]ent.Value, 0, len(m.invoicing_app)) - for id := range m.invoicing_app { + case app.EdgeBillingInvoiceInvoicingApp: + ids := make([]ent.Value, 0, len(m.billing_invoice_invoicing_app)) + for id := range m.billing_invoice_invoicing_app { ids = append(ids, id) } return ids - case app.EdgePaymentApp: - ids := make([]ent.Value, 0, len(m.payment_app)) - for id := range m.payment_app { + case app.EdgeBillingInvoicePaymentApp: + ids := make([]ent.Value, 0, len(m.billing_invoice_payment_app)) + for id := range m.billing_invoice_payment_app { ids = append(ids, id) } return ids @@ -1186,18 +1386,27 @@ func (m *AppMutation) AddedIDs(name string) []ent.Value { // RemovedEdges returns all edge names that were removed in this mutation. func (m *AppMutation) RemovedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 7) if m.removedcustomer_apps != nil { edges = append(edges, app.EdgeCustomerApps) } - if m.removedtax_app != nil { - edges = append(edges, app.EdgeTaxApp) + if m.removedbilling_profile_tax_app != nil { + edges = append(edges, app.EdgeBillingProfileTaxApp) + } + if m.removedbilling_profile_invoicing_app != nil { + edges = append(edges, app.EdgeBillingProfileInvoicingApp) + } + if m.removedbilling_profile_payment_app != nil { + edges = append(edges, app.EdgeBillingProfilePaymentApp) + } + if m.removedbilling_invoice_tax_app != nil { + edges = append(edges, app.EdgeBillingInvoiceTaxApp) } - if m.removedinvoicing_app != nil { - edges = append(edges, app.EdgeInvoicingApp) + if m.removedbilling_invoice_invoicing_app != nil { + edges = append(edges, app.EdgeBillingInvoiceInvoicingApp) } - if m.removedpayment_app != nil { - edges = append(edges, app.EdgePaymentApp) + if m.removedbilling_invoice_payment_app != nil { + edges = append(edges, app.EdgeBillingInvoicePaymentApp) } return edges } @@ -1212,21 +1421,39 @@ func (m *AppMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids - case app.EdgeTaxApp: - ids := make([]ent.Value, 0, len(m.removedtax_app)) - for id := range m.removedtax_app { + case app.EdgeBillingProfileTaxApp: + ids := make([]ent.Value, 0, len(m.removedbilling_profile_tax_app)) + for id := range m.removedbilling_profile_tax_app { ids = append(ids, id) } return ids - case app.EdgeInvoicingApp: - ids := make([]ent.Value, 0, len(m.removedinvoicing_app)) - for id := range m.removedinvoicing_app { + case app.EdgeBillingProfileInvoicingApp: + ids := make([]ent.Value, 0, len(m.removedbilling_profile_invoicing_app)) + for id := range m.removedbilling_profile_invoicing_app { ids = append(ids, id) } return ids - case app.EdgePaymentApp: - ids := make([]ent.Value, 0, len(m.removedpayment_app)) - for id := range m.removedpayment_app { + case app.EdgeBillingProfilePaymentApp: + ids := make([]ent.Value, 0, len(m.removedbilling_profile_payment_app)) + for id := range m.removedbilling_profile_payment_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingInvoiceTaxApp: + ids := make([]ent.Value, 0, len(m.removedbilling_invoice_tax_app)) + for id := range m.removedbilling_invoice_tax_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingInvoiceInvoicingApp: + ids := make([]ent.Value, 0, len(m.removedbilling_invoice_invoicing_app)) + for id := range m.removedbilling_invoice_invoicing_app { + ids = append(ids, id) + } + return ids + case app.EdgeBillingInvoicePaymentApp: + ids := make([]ent.Value, 0, len(m.removedbilling_invoice_payment_app)) + for id := range m.removedbilling_invoice_payment_app { ids = append(ids, id) } return ids @@ -1236,18 +1463,27 @@ func (m *AppMutation) RemovedIDs(name string) []ent.Value { // ClearedEdges returns all edge names that were cleared in this mutation. func (m *AppMutation) ClearedEdges() []string { - edges := make([]string, 0, 4) + edges := make([]string, 0, 7) if m.clearedcustomer_apps { edges = append(edges, app.EdgeCustomerApps) } - if m.clearedtax_app { - edges = append(edges, app.EdgeTaxApp) + if m.clearedbilling_profile_tax_app { + edges = append(edges, app.EdgeBillingProfileTaxApp) } - if m.clearedinvoicing_app { - edges = append(edges, app.EdgeInvoicingApp) + if m.clearedbilling_profile_invoicing_app { + edges = append(edges, app.EdgeBillingProfileInvoicingApp) } - if m.clearedpayment_app { - edges = append(edges, app.EdgePaymentApp) + if m.clearedbilling_profile_payment_app { + edges = append(edges, app.EdgeBillingProfilePaymentApp) + } + if m.clearedbilling_invoice_tax_app { + edges = append(edges, app.EdgeBillingInvoiceTaxApp) + } + if m.clearedbilling_invoice_invoicing_app { + edges = append(edges, app.EdgeBillingInvoiceInvoicingApp) + } + if m.clearedbilling_invoice_payment_app { + edges = append(edges, app.EdgeBillingInvoicePaymentApp) } return edges } @@ -1258,12 +1494,18 @@ func (m *AppMutation) EdgeCleared(name string) bool { switch name { case app.EdgeCustomerApps: return m.clearedcustomer_apps - case app.EdgeTaxApp: - return m.clearedtax_app - case app.EdgeInvoicingApp: - return m.clearedinvoicing_app - case app.EdgePaymentApp: - return m.clearedpayment_app + case app.EdgeBillingProfileTaxApp: + return m.clearedbilling_profile_tax_app + case app.EdgeBillingProfileInvoicingApp: + return m.clearedbilling_profile_invoicing_app + case app.EdgeBillingProfilePaymentApp: + return m.clearedbilling_profile_payment_app + case app.EdgeBillingInvoiceTaxApp: + return m.clearedbilling_invoice_tax_app + case app.EdgeBillingInvoiceInvoicingApp: + return m.clearedbilling_invoice_invoicing_app + case app.EdgeBillingInvoicePaymentApp: + return m.clearedbilling_invoice_payment_app } return false } @@ -1283,14 +1525,23 @@ func (m *AppMutation) ResetEdge(name string) error { case app.EdgeCustomerApps: m.ResetCustomerApps() return nil - case app.EdgeTaxApp: - m.ResetTaxApp() + case app.EdgeBillingProfileTaxApp: + m.ResetBillingProfileTaxApp() return nil - case app.EdgeInvoicingApp: - m.ResetInvoicingApp() + case app.EdgeBillingProfileInvoicingApp: + m.ResetBillingProfileInvoicingApp() return nil - case app.EdgePaymentApp: - m.ResetPaymentApp() + case app.EdgeBillingProfilePaymentApp: + m.ResetBillingProfilePaymentApp() + return nil + case app.EdgeBillingInvoiceTaxApp: + m.ResetBillingInvoiceTaxApp() + return nil + case app.EdgeBillingInvoiceInvoicingApp: + m.ResetBillingInvoiceInvoicingApp() + return nil + case app.EdgeBillingInvoicePaymentApp: + m.ResetBillingInvoicePaymentApp() return nil } return fmt.Errorf("unknown App edge %s", name) @@ -4737,7 +4988,7 @@ type BillingCustomerOverrideMutation struct { updated_at *time.Time deleted_at *time.Time collection_alignment *billingentity.AlignmentKind - item_collection_period *datex.ISOString + line_collection_period *datex.ISOString invoice_auto_advance *bool invoice_draft_period *datex.ISOString invoice_due_after *datex.ISOString @@ -5147,53 +5398,53 @@ func (m *BillingCustomerOverrideMutation) ResetCollectionAlignment() { delete(m.clearedFields, billingcustomeroverride.FieldCollectionAlignment) } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (m *BillingCustomerOverrideMutation) SetItemCollectionPeriod(ds datex.ISOString) { - m.item_collection_period = &ds +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (m *BillingCustomerOverrideMutation) SetLineCollectionPeriod(ds datex.ISOString) { + m.line_collection_period = &ds } -// ItemCollectionPeriod returns the value of the "item_collection_period" field in the mutation. -func (m *BillingCustomerOverrideMutation) ItemCollectionPeriod() (r datex.ISOString, exists bool) { - v := m.item_collection_period +// LineCollectionPeriod returns the value of the "line_collection_period" field in the mutation. +func (m *BillingCustomerOverrideMutation) LineCollectionPeriod() (r datex.ISOString, exists bool) { + v := m.line_collection_period if v == nil { return } return *v, true } -// OldItemCollectionPeriod returns the old "item_collection_period" field's value of the BillingCustomerOverride entity. +// OldLineCollectionPeriod returns the old "line_collection_period" field's value of the BillingCustomerOverride entity. // If the BillingCustomerOverride object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingCustomerOverrideMutation) OldItemCollectionPeriod(ctx context.Context) (v *datex.ISOString, err error) { +func (m *BillingCustomerOverrideMutation) OldLineCollectionPeriod(ctx context.Context) (v *datex.ISOString, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldItemCollectionPeriod is only allowed on UpdateOne operations") + return v, errors.New("OldLineCollectionPeriod is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldItemCollectionPeriod requires an ID field in the mutation") + return v, errors.New("OldLineCollectionPeriod requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldItemCollectionPeriod: %w", err) + return v, fmt.Errorf("querying old value for OldLineCollectionPeriod: %w", err) } - return oldValue.ItemCollectionPeriod, nil + return oldValue.LineCollectionPeriod, nil } -// ClearItemCollectionPeriod clears the value of the "item_collection_period" field. -func (m *BillingCustomerOverrideMutation) ClearItemCollectionPeriod() { - m.item_collection_period = nil - m.clearedFields[billingcustomeroverride.FieldItemCollectionPeriod] = struct{}{} +// ClearLineCollectionPeriod clears the value of the "line_collection_period" field. +func (m *BillingCustomerOverrideMutation) ClearLineCollectionPeriod() { + m.line_collection_period = nil + m.clearedFields[billingcustomeroverride.FieldLineCollectionPeriod] = struct{}{} } -// ItemCollectionPeriodCleared returns if the "item_collection_period" field was cleared in this mutation. -func (m *BillingCustomerOverrideMutation) ItemCollectionPeriodCleared() bool { - _, ok := m.clearedFields[billingcustomeroverride.FieldItemCollectionPeriod] +// LineCollectionPeriodCleared returns if the "line_collection_period" field was cleared in this mutation. +func (m *BillingCustomerOverrideMutation) LineCollectionPeriodCleared() bool { + _, ok := m.clearedFields[billingcustomeroverride.FieldLineCollectionPeriod] return ok } -// ResetItemCollectionPeriod resets all changes to the "item_collection_period" field. -func (m *BillingCustomerOverrideMutation) ResetItemCollectionPeriod() { - m.item_collection_period = nil - delete(m.clearedFields, billingcustomeroverride.FieldItemCollectionPeriod) +// ResetLineCollectionPeriod resets all changes to the "line_collection_period" field. +func (m *BillingCustomerOverrideMutation) ResetLineCollectionPeriod() { + m.line_collection_period = nil + delete(m.clearedFields, billingcustomeroverride.FieldLineCollectionPeriod) } // SetInvoiceAutoAdvance sets the "invoice_auto_advance" field. @@ -5502,8 +5753,8 @@ func (m *BillingCustomerOverrideMutation) Fields() []string { if m.collection_alignment != nil { fields = append(fields, billingcustomeroverride.FieldCollectionAlignment) } - if m.item_collection_period != nil { - fields = append(fields, billingcustomeroverride.FieldItemCollectionPeriod) + if m.line_collection_period != nil { + fields = append(fields, billingcustomeroverride.FieldLineCollectionPeriod) } if m.invoice_auto_advance != nil { fields = append(fields, billingcustomeroverride.FieldInvoiceAutoAdvance) @@ -5539,8 +5790,8 @@ func (m *BillingCustomerOverrideMutation) Field(name string) (ent.Value, bool) { return m.BillingProfileID() case billingcustomeroverride.FieldCollectionAlignment: return m.CollectionAlignment() - case billingcustomeroverride.FieldItemCollectionPeriod: - return m.ItemCollectionPeriod() + case billingcustomeroverride.FieldLineCollectionPeriod: + return m.LineCollectionPeriod() case billingcustomeroverride.FieldInvoiceAutoAdvance: return m.InvoiceAutoAdvance() case billingcustomeroverride.FieldInvoiceDraftPeriod: @@ -5572,8 +5823,8 @@ func (m *BillingCustomerOverrideMutation) OldField(ctx context.Context, name str return m.OldBillingProfileID(ctx) case billingcustomeroverride.FieldCollectionAlignment: return m.OldCollectionAlignment(ctx) - case billingcustomeroverride.FieldItemCollectionPeriod: - return m.OldItemCollectionPeriod(ctx) + case billingcustomeroverride.FieldLineCollectionPeriod: + return m.OldLineCollectionPeriod(ctx) case billingcustomeroverride.FieldInvoiceAutoAdvance: return m.OldInvoiceAutoAdvance(ctx) case billingcustomeroverride.FieldInvoiceDraftPeriod: @@ -5640,12 +5891,12 @@ func (m *BillingCustomerOverrideMutation) SetField(name string, value ent.Value) } m.SetCollectionAlignment(v) return nil - case billingcustomeroverride.FieldItemCollectionPeriod: + case billingcustomeroverride.FieldLineCollectionPeriod: v, ok := value.(datex.ISOString) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetItemCollectionPeriod(v) + m.SetLineCollectionPeriod(v) return nil case billingcustomeroverride.FieldInvoiceAutoAdvance: v, ok := value.(bool) @@ -5714,8 +5965,8 @@ func (m *BillingCustomerOverrideMutation) ClearedFields() []string { if m.FieldCleared(billingcustomeroverride.FieldCollectionAlignment) { fields = append(fields, billingcustomeroverride.FieldCollectionAlignment) } - if m.FieldCleared(billingcustomeroverride.FieldItemCollectionPeriod) { - fields = append(fields, billingcustomeroverride.FieldItemCollectionPeriod) + if m.FieldCleared(billingcustomeroverride.FieldLineCollectionPeriod) { + fields = append(fields, billingcustomeroverride.FieldLineCollectionPeriod) } if m.FieldCleared(billingcustomeroverride.FieldInvoiceAutoAdvance) { fields = append(fields, billingcustomeroverride.FieldInvoiceAutoAdvance) @@ -5752,8 +6003,8 @@ func (m *BillingCustomerOverrideMutation) ClearField(name string) error { case billingcustomeroverride.FieldCollectionAlignment: m.ClearCollectionAlignment() return nil - case billingcustomeroverride.FieldItemCollectionPeriod: - m.ClearItemCollectionPeriod() + case billingcustomeroverride.FieldLineCollectionPeriod: + m.ClearLineCollectionPeriod() return nil case billingcustomeroverride.FieldInvoiceAutoAdvance: m.ClearInvoiceAutoAdvance() @@ -5796,8 +6047,8 @@ func (m *BillingCustomerOverrideMutation) ResetField(name string) error { case billingcustomeroverride.FieldCollectionAlignment: m.ResetCollectionAlignment() return nil - case billingcustomeroverride.FieldItemCollectionPeriod: - m.ResetItemCollectionPeriod() + case billingcustomeroverride.FieldLineCollectionPeriod: + m.ResetLineCollectionPeriod() return nil case billingcustomeroverride.FieldInvoiceAutoAdvance: m.ResetInvoiceAutoAdvance() @@ -5910,34 +6161,61 @@ func (m *BillingCustomerOverrideMutation) ResetEdge(name string) error { // BillingInvoiceMutation represents an operation that mutates the BillingInvoice nodes in the graph. type BillingInvoiceMutation struct { config - op Op - typ string - id *string - namespace *string - created_at *time.Time - updated_at *time.Time - deleted_at *time.Time - metadata *map[string]string - series *string - code *string - customer_id *string - voided_at *time.Time - currency *string - due_date *time.Time - status *billingentity.InvoiceStatus - period_start *time.Time - period_end *time.Time - clearedFields map[string]struct{} - billing_profile *string - clearedbilling_profile bool - billing_workflow_config *string - clearedbilling_workflow_config bool - billing_invoice_items map[string]struct{} - removedbilling_invoice_items map[string]struct{} - clearedbilling_invoice_items bool - done bool - oldValue func(context.Context) (*BillingInvoice, error) - predicates []predicate.BillingInvoice + op Op + typ string + id *string + namespace *string + metadata *map[string]string + created_at *time.Time + updated_at *time.Time + deleted_at *time.Time + supplier_address_country *models.CountryCode + supplier_address_postal_code *string + supplier_address_state *string + supplier_address_city *string + supplier_address_line1 *string + supplier_address_line2 *string + supplier_address_phone_number *string + customer_address_country *models.CountryCode + customer_address_postal_code *string + customer_address_state *string + customer_address_city *string + customer_address_line1 *string + customer_address_line2 *string + customer_address_phone_number *string + supplier_name *string + supplier_tax_code *string + customer_name *string + customer_timezone *timezone.Timezone + number *string + _type *billingentity.InvoiceType + description *string + voided_at *time.Time + issued_at *time.Time + currency *currencyx.Code + due_at *time.Time + status *billingentity.InvoiceStatus + period_start *time.Time + period_end *time.Time + clearedFields map[string]struct{} + source_billing_profile *string + clearedsource_billing_profile bool + billing_workflow_config *string + clearedbilling_workflow_config bool + billing_invoice_lines map[string]struct{} + removedbilling_invoice_lines map[string]struct{} + clearedbilling_invoice_lines bool + billing_invoice_customer *string + clearedbilling_invoice_customer bool + tax_app *string + clearedtax_app bool + invoicing_app *string + clearedinvoicing_app bool + payment_app *string + clearedpayment_app bool + done bool + oldValue func(context.Context) (*BillingInvoice, error) + predicates []predicate.BillingInvoice } var _ ent.Mutation = (*BillingInvoiceMutation)(nil) @@ -6080,6 +6358,55 @@ func (m *BillingInvoiceMutation) ResetNamespace() { m.namespace = nil } +// SetMetadata sets the "metadata" field. +func (m *BillingInvoiceMutation) SetMetadata(value map[string]string) { + m.metadata = &value +} + +// Metadata returns the value of the "metadata" field in the mutation. +func (m *BillingInvoiceMutation) Metadata() (r map[string]string, exists bool) { + v := m.metadata + if v == nil { + return + } + return *v, true +} + +// OldMetadata returns the old "metadata" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldMetadata(ctx context.Context) (v map[string]string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldMetadata is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldMetadata requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldMetadata: %w", err) + } + return oldValue.Metadata, nil +} + +// ClearMetadata clears the value of the "metadata" field. +func (m *BillingInvoiceMutation) ClearMetadata() { + m.metadata = nil + m.clearedFields[billinginvoice.FieldMetadata] = struct{}{} +} + +// MetadataCleared returns if the "metadata" field was cleared in this mutation. +func (m *BillingInvoiceMutation) MetadataCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldMetadata] + return ok +} + +// ResetMetadata resets all changes to the "metadata" field. +func (m *BillingInvoiceMutation) ResetMetadata() { + m.metadata = nil + delete(m.clearedFields, billinginvoice.FieldMetadata) +} + // SetCreatedAt sets the "created_at" field. func (m *BillingInvoiceMutation) SetCreatedAt(t time.Time) { m.created_at = &t @@ -6201,1960 +6528,4458 @@ func (m *BillingInvoiceMutation) ResetDeletedAt() { delete(m.clearedFields, billinginvoice.FieldDeletedAt) } -// SetMetadata sets the "metadata" field. -func (m *BillingInvoiceMutation) SetMetadata(value map[string]string) { - m.metadata = &value +// SetSupplierAddressCountry sets the "supplier_address_country" field. +func (m *BillingInvoiceMutation) SetSupplierAddressCountry(mc models.CountryCode) { + m.supplier_address_country = &mc } -// Metadata returns the value of the "metadata" field in the mutation. -func (m *BillingInvoiceMutation) Metadata() (r map[string]string, exists bool) { - v := m.metadata +// SupplierAddressCountry returns the value of the "supplier_address_country" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressCountry() (r models.CountryCode, exists bool) { + v := m.supplier_address_country if v == nil { return } return *v, true } -// OldMetadata returns the old "metadata" field's value of the BillingInvoice entity. +// OldSupplierAddressCountry returns the old "supplier_address_country" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldMetadata(ctx context.Context) (v map[string]string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressCountry(ctx context.Context) (v *models.CountryCode, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldMetadata is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressCountry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldMetadata requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressCountry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldMetadata: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressCountry: %w", err) } - return oldValue.Metadata, nil + return oldValue.SupplierAddressCountry, nil } -// ClearMetadata clears the value of the "metadata" field. -func (m *BillingInvoiceMutation) ClearMetadata() { - m.metadata = nil - m.clearedFields[billinginvoice.FieldMetadata] = struct{}{} +// ClearSupplierAddressCountry clears the value of the "supplier_address_country" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressCountry() { + m.supplier_address_country = nil + m.clearedFields[billinginvoice.FieldSupplierAddressCountry] = struct{}{} } -// MetadataCleared returns if the "metadata" field was cleared in this mutation. -func (m *BillingInvoiceMutation) MetadataCleared() bool { - _, ok := m.clearedFields[billinginvoice.FieldMetadata] +// SupplierAddressCountryCleared returns if the "supplier_address_country" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressCountryCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressCountry] return ok } -// ResetMetadata resets all changes to the "metadata" field. -func (m *BillingInvoiceMutation) ResetMetadata() { - m.metadata = nil - delete(m.clearedFields, billinginvoice.FieldMetadata) +// ResetSupplierAddressCountry resets all changes to the "supplier_address_country" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressCountry() { + m.supplier_address_country = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressCountry) } -// SetSeries sets the "series" field. -func (m *BillingInvoiceMutation) SetSeries(s string) { - m.series = &s +// SetSupplierAddressPostalCode sets the "supplier_address_postal_code" field. +func (m *BillingInvoiceMutation) SetSupplierAddressPostalCode(s string) { + m.supplier_address_postal_code = &s } -// Series returns the value of the "series" field in the mutation. -func (m *BillingInvoiceMutation) Series() (r string, exists bool) { - v := m.series +// SupplierAddressPostalCode returns the value of the "supplier_address_postal_code" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressPostalCode() (r string, exists bool) { + v := m.supplier_address_postal_code if v == nil { return } return *v, true } -// OldSeries returns the old "series" field's value of the BillingInvoice entity. +// OldSupplierAddressPostalCode returns the old "supplier_address_postal_code" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldSeries(ctx context.Context) (v *string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressPostalCode(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldSeries is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressPostalCode is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldSeries requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressPostalCode requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldSeries: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressPostalCode: %w", err) } - return oldValue.Series, nil + return oldValue.SupplierAddressPostalCode, nil } -// ClearSeries clears the value of the "series" field. -func (m *BillingInvoiceMutation) ClearSeries() { - m.series = nil - m.clearedFields[billinginvoice.FieldSeries] = struct{}{} +// ClearSupplierAddressPostalCode clears the value of the "supplier_address_postal_code" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressPostalCode() { + m.supplier_address_postal_code = nil + m.clearedFields[billinginvoice.FieldSupplierAddressPostalCode] = struct{}{} } -// SeriesCleared returns if the "series" field was cleared in this mutation. -func (m *BillingInvoiceMutation) SeriesCleared() bool { - _, ok := m.clearedFields[billinginvoice.FieldSeries] +// SupplierAddressPostalCodeCleared returns if the "supplier_address_postal_code" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressPostalCodeCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressPostalCode] return ok } -// ResetSeries resets all changes to the "series" field. -func (m *BillingInvoiceMutation) ResetSeries() { - m.series = nil - delete(m.clearedFields, billinginvoice.FieldSeries) +// ResetSupplierAddressPostalCode resets all changes to the "supplier_address_postal_code" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressPostalCode() { + m.supplier_address_postal_code = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressPostalCode) } -// SetCode sets the "code" field. -func (m *BillingInvoiceMutation) SetCode(s string) { - m.code = &s +// SetSupplierAddressState sets the "supplier_address_state" field. +func (m *BillingInvoiceMutation) SetSupplierAddressState(s string) { + m.supplier_address_state = &s } -// Code returns the value of the "code" field in the mutation. -func (m *BillingInvoiceMutation) Code() (r string, exists bool) { - v := m.code +// SupplierAddressState returns the value of the "supplier_address_state" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressState() (r string, exists bool) { + v := m.supplier_address_state if v == nil { return } return *v, true } -// OldCode returns the old "code" field's value of the BillingInvoice entity. +// OldSupplierAddressState returns the old "supplier_address_state" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldCode(ctx context.Context) (v *string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressState(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCode is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressState is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCode requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressState requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldCode: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressState: %w", err) } - return oldValue.Code, nil + return oldValue.SupplierAddressState, nil } -// ClearCode clears the value of the "code" field. -func (m *BillingInvoiceMutation) ClearCode() { - m.code = nil - m.clearedFields[billinginvoice.FieldCode] = struct{}{} +// ClearSupplierAddressState clears the value of the "supplier_address_state" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressState() { + m.supplier_address_state = nil + m.clearedFields[billinginvoice.FieldSupplierAddressState] = struct{}{} } -// CodeCleared returns if the "code" field was cleared in this mutation. -func (m *BillingInvoiceMutation) CodeCleared() bool { - _, ok := m.clearedFields[billinginvoice.FieldCode] +// SupplierAddressStateCleared returns if the "supplier_address_state" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressStateCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressState] return ok } -// ResetCode resets all changes to the "code" field. -func (m *BillingInvoiceMutation) ResetCode() { - m.code = nil - delete(m.clearedFields, billinginvoice.FieldCode) +// ResetSupplierAddressState resets all changes to the "supplier_address_state" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressState() { + m.supplier_address_state = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressState) } -// SetCustomerID sets the "customer_id" field. -func (m *BillingInvoiceMutation) SetCustomerID(s string) { - m.customer_id = &s +// SetSupplierAddressCity sets the "supplier_address_city" field. +func (m *BillingInvoiceMutation) SetSupplierAddressCity(s string) { + m.supplier_address_city = &s } -// CustomerID returns the value of the "customer_id" field in the mutation. -func (m *BillingInvoiceMutation) CustomerID() (r string, exists bool) { - v := m.customer_id +// SupplierAddressCity returns the value of the "supplier_address_city" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressCity() (r string, exists bool) { + v := m.supplier_address_city if v == nil { return } return *v, true } -// OldCustomerID returns the old "customer_id" field's value of the BillingInvoice entity. +// OldSupplierAddressCity returns the old "supplier_address_city" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldCustomerID(ctx context.Context) (v string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressCity(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCustomerID is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressCity is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCustomerID requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressCity requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldCustomerID: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressCity: %w", err) } - return oldValue.CustomerID, nil + return oldValue.SupplierAddressCity, nil } -// ResetCustomerID resets all changes to the "customer_id" field. -func (m *BillingInvoiceMutation) ResetCustomerID() { - m.customer_id = nil +// ClearSupplierAddressCity clears the value of the "supplier_address_city" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressCity() { + m.supplier_address_city = nil + m.clearedFields[billinginvoice.FieldSupplierAddressCity] = struct{}{} } -// SetBillingProfileID sets the "billing_profile_id" field. -func (m *BillingInvoiceMutation) SetBillingProfileID(s string) { - m.billing_profile = &s +// SupplierAddressCityCleared returns if the "supplier_address_city" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressCityCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressCity] + return ok } -// BillingProfileID returns the value of the "billing_profile_id" field in the mutation. -func (m *BillingInvoiceMutation) BillingProfileID() (r string, exists bool) { - v := m.billing_profile +// ResetSupplierAddressCity resets all changes to the "supplier_address_city" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressCity() { + m.supplier_address_city = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressCity) +} + +// SetSupplierAddressLine1 sets the "supplier_address_line1" field. +func (m *BillingInvoiceMutation) SetSupplierAddressLine1(s string) { + m.supplier_address_line1 = &s +} + +// SupplierAddressLine1 returns the value of the "supplier_address_line1" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressLine1() (r string, exists bool) { + v := m.supplier_address_line1 if v == nil { return } return *v, true } -// OldBillingProfileID returns the old "billing_profile_id" field's value of the BillingInvoice entity. +// OldSupplierAddressLine1 returns the old "supplier_address_line1" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldBillingProfileID(ctx context.Context) (v string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressLine1(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldBillingProfileID is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressLine1 is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldBillingProfileID requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressLine1 requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldBillingProfileID: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressLine1: %w", err) } - return oldValue.BillingProfileID, nil + return oldValue.SupplierAddressLine1, nil } -// ResetBillingProfileID resets all changes to the "billing_profile_id" field. -func (m *BillingInvoiceMutation) ResetBillingProfileID() { - m.billing_profile = nil +// ClearSupplierAddressLine1 clears the value of the "supplier_address_line1" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressLine1() { + m.supplier_address_line1 = nil + m.clearedFields[billinginvoice.FieldSupplierAddressLine1] = struct{}{} } -// SetVoidedAt sets the "voided_at" field. -func (m *BillingInvoiceMutation) SetVoidedAt(t time.Time) { - m.voided_at = &t +// SupplierAddressLine1Cleared returns if the "supplier_address_line1" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressLine1Cleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressLine1] + return ok } -// VoidedAt returns the value of the "voided_at" field in the mutation. -func (m *BillingInvoiceMutation) VoidedAt() (r time.Time, exists bool) { - v := m.voided_at +// ResetSupplierAddressLine1 resets all changes to the "supplier_address_line1" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressLine1() { + m.supplier_address_line1 = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressLine1) +} + +// SetSupplierAddressLine2 sets the "supplier_address_line2" field. +func (m *BillingInvoiceMutation) SetSupplierAddressLine2(s string) { + m.supplier_address_line2 = &s +} + +// SupplierAddressLine2 returns the value of the "supplier_address_line2" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressLine2() (r string, exists bool) { + v := m.supplier_address_line2 if v == nil { return } return *v, true } -// OldVoidedAt returns the old "voided_at" field's value of the BillingInvoice entity. +// OldSupplierAddressLine2 returns the old "supplier_address_line2" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldVoidedAt(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressLine2(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldVoidedAt is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressLine2 is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldVoidedAt requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressLine2 requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldVoidedAt: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressLine2: %w", err) } - return oldValue.VoidedAt, nil + return oldValue.SupplierAddressLine2, nil } -// ClearVoidedAt clears the value of the "voided_at" field. -func (m *BillingInvoiceMutation) ClearVoidedAt() { - m.voided_at = nil - m.clearedFields[billinginvoice.FieldVoidedAt] = struct{}{} +// ClearSupplierAddressLine2 clears the value of the "supplier_address_line2" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressLine2() { + m.supplier_address_line2 = nil + m.clearedFields[billinginvoice.FieldSupplierAddressLine2] = struct{}{} } -// VoidedAtCleared returns if the "voided_at" field was cleared in this mutation. -func (m *BillingInvoiceMutation) VoidedAtCleared() bool { - _, ok := m.clearedFields[billinginvoice.FieldVoidedAt] +// SupplierAddressLine2Cleared returns if the "supplier_address_line2" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressLine2Cleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressLine2] return ok } -// ResetVoidedAt resets all changes to the "voided_at" field. -func (m *BillingInvoiceMutation) ResetVoidedAt() { - m.voided_at = nil - delete(m.clearedFields, billinginvoice.FieldVoidedAt) +// ResetSupplierAddressLine2 resets all changes to the "supplier_address_line2" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressLine2() { + m.supplier_address_line2 = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressLine2) } -// SetCurrency sets the "currency" field. -func (m *BillingInvoiceMutation) SetCurrency(s string) { - m.currency = &s +// SetSupplierAddressPhoneNumber sets the "supplier_address_phone_number" field. +func (m *BillingInvoiceMutation) SetSupplierAddressPhoneNumber(s string) { + m.supplier_address_phone_number = &s } -// Currency returns the value of the "currency" field in the mutation. -func (m *BillingInvoiceMutation) Currency() (r string, exists bool) { - v := m.currency +// SupplierAddressPhoneNumber returns the value of the "supplier_address_phone_number" field in the mutation. +func (m *BillingInvoiceMutation) SupplierAddressPhoneNumber() (r string, exists bool) { + v := m.supplier_address_phone_number if v == nil { return } return *v, true } -// OldCurrency returns the old "currency" field's value of the BillingInvoice entity. +// OldSupplierAddressPhoneNumber returns the old "supplier_address_phone_number" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldCurrency(ctx context.Context) (v string, err error) { +func (m *BillingInvoiceMutation) OldSupplierAddressPhoneNumber(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCurrency is only allowed on UpdateOne operations") + return v, errors.New("OldSupplierAddressPhoneNumber is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCurrency requires an ID field in the mutation") + return v, errors.New("OldSupplierAddressPhoneNumber requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldCurrency: %w", err) + return v, fmt.Errorf("querying old value for OldSupplierAddressPhoneNumber: %w", err) } - return oldValue.Currency, nil + return oldValue.SupplierAddressPhoneNumber, nil } -// ResetCurrency resets all changes to the "currency" field. -func (m *BillingInvoiceMutation) ResetCurrency() { - m.currency = nil +// ClearSupplierAddressPhoneNumber clears the value of the "supplier_address_phone_number" field. +func (m *BillingInvoiceMutation) ClearSupplierAddressPhoneNumber() { + m.supplier_address_phone_number = nil + m.clearedFields[billinginvoice.FieldSupplierAddressPhoneNumber] = struct{}{} +} + +// SupplierAddressPhoneNumberCleared returns if the "supplier_address_phone_number" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierAddressPhoneNumberCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierAddressPhoneNumber] + return ok +} + +// ResetSupplierAddressPhoneNumber resets all changes to the "supplier_address_phone_number" field. +func (m *BillingInvoiceMutation) ResetSupplierAddressPhoneNumber() { + m.supplier_address_phone_number = nil + delete(m.clearedFields, billinginvoice.FieldSupplierAddressPhoneNumber) } -// SetDueDate sets the "due_date" field. -func (m *BillingInvoiceMutation) SetDueDate(t time.Time) { - m.due_date = &t +// SetCustomerAddressCountry sets the "customer_address_country" field. +func (m *BillingInvoiceMutation) SetCustomerAddressCountry(mc models.CountryCode) { + m.customer_address_country = &mc } -// DueDate returns the value of the "due_date" field in the mutation. -func (m *BillingInvoiceMutation) DueDate() (r time.Time, exists bool) { - v := m.due_date +// CustomerAddressCountry returns the value of the "customer_address_country" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressCountry() (r models.CountryCode, exists bool) { + v := m.customer_address_country if v == nil { return } return *v, true } -// OldDueDate returns the old "due_date" field's value of the BillingInvoice entity. +// OldCustomerAddressCountry returns the old "customer_address_country" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldDueDate(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceMutation) OldCustomerAddressCountry(ctx context.Context) (v *models.CountryCode, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDueDate is only allowed on UpdateOne operations") + return v, errors.New("OldCustomerAddressCountry is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDueDate requires an ID field in the mutation") + return v, errors.New("OldCustomerAddressCountry requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldDueDate: %w", err) + return v, fmt.Errorf("querying old value for OldCustomerAddressCountry: %w", err) } - return oldValue.DueDate, nil + return oldValue.CustomerAddressCountry, nil } -// ResetDueDate resets all changes to the "due_date" field. -func (m *BillingInvoiceMutation) ResetDueDate() { - m.due_date = nil +// ClearCustomerAddressCountry clears the value of the "customer_address_country" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressCountry() { + m.customer_address_country = nil + m.clearedFields[billinginvoice.FieldCustomerAddressCountry] = struct{}{} } -// SetStatus sets the "status" field. -func (m *BillingInvoiceMutation) SetStatus(bs billingentity.InvoiceStatus) { - m.status = &bs +// CustomerAddressCountryCleared returns if the "customer_address_country" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressCountryCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressCountry] + return ok } -// Status returns the value of the "status" field in the mutation. -func (m *BillingInvoiceMutation) Status() (r billingentity.InvoiceStatus, exists bool) { - v := m.status +// ResetCustomerAddressCountry resets all changes to the "customer_address_country" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressCountry() { + m.customer_address_country = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressCountry) +} + +// SetCustomerAddressPostalCode sets the "customer_address_postal_code" field. +func (m *BillingInvoiceMutation) SetCustomerAddressPostalCode(s string) { + m.customer_address_postal_code = &s +} + +// CustomerAddressPostalCode returns the value of the "customer_address_postal_code" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressPostalCode() (r string, exists bool) { + v := m.customer_address_postal_code if v == nil { return } return *v, true } -// OldStatus returns the old "status" field's value of the BillingInvoice entity. +// OldCustomerAddressPostalCode returns the old "customer_address_postal_code" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldStatus(ctx context.Context) (v billingentity.InvoiceStatus, err error) { +func (m *BillingInvoiceMutation) OldCustomerAddressPostalCode(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldStatus is only allowed on UpdateOne operations") + return v, errors.New("OldCustomerAddressPostalCode is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldStatus requires an ID field in the mutation") + return v, errors.New("OldCustomerAddressPostalCode requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldStatus: %w", err) + return v, fmt.Errorf("querying old value for OldCustomerAddressPostalCode: %w", err) } - return oldValue.Status, nil + return oldValue.CustomerAddressPostalCode, nil } -// ResetStatus resets all changes to the "status" field. -func (m *BillingInvoiceMutation) ResetStatus() { - m.status = nil +// ClearCustomerAddressPostalCode clears the value of the "customer_address_postal_code" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressPostalCode() { + m.customer_address_postal_code = nil + m.clearedFields[billinginvoice.FieldCustomerAddressPostalCode] = struct{}{} } -// SetWorkflowConfigID sets the "workflow_config_id" field. -func (m *BillingInvoiceMutation) SetWorkflowConfigID(s string) { - m.billing_workflow_config = &s +// CustomerAddressPostalCodeCleared returns if the "customer_address_postal_code" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressPostalCodeCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressPostalCode] + return ok } -// WorkflowConfigID returns the value of the "workflow_config_id" field in the mutation. -func (m *BillingInvoiceMutation) WorkflowConfigID() (r string, exists bool) { - v := m.billing_workflow_config +// ResetCustomerAddressPostalCode resets all changes to the "customer_address_postal_code" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressPostalCode() { + m.customer_address_postal_code = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressPostalCode) +} + +// SetCustomerAddressState sets the "customer_address_state" field. +func (m *BillingInvoiceMutation) SetCustomerAddressState(s string) { + m.customer_address_state = &s +} + +// CustomerAddressState returns the value of the "customer_address_state" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressState() (r string, exists bool) { + v := m.customer_address_state if v == nil { return } return *v, true } -// OldWorkflowConfigID returns the old "workflow_config_id" field's value of the BillingInvoice entity. +// OldCustomerAddressState returns the old "customer_address_state" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldWorkflowConfigID(ctx context.Context) (v string, err error) { +func (m *BillingInvoiceMutation) OldCustomerAddressState(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldWorkflowConfigID is only allowed on UpdateOne operations") + return v, errors.New("OldCustomerAddressState is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldWorkflowConfigID requires an ID field in the mutation") + return v, errors.New("OldCustomerAddressState requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldWorkflowConfigID: %w", err) + return v, fmt.Errorf("querying old value for OldCustomerAddressState: %w", err) } - return oldValue.WorkflowConfigID, nil + return oldValue.CustomerAddressState, nil } -// ResetWorkflowConfigID resets all changes to the "workflow_config_id" field. -func (m *BillingInvoiceMutation) ResetWorkflowConfigID() { - m.billing_workflow_config = nil +// ClearCustomerAddressState clears the value of the "customer_address_state" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressState() { + m.customer_address_state = nil + m.clearedFields[billinginvoice.FieldCustomerAddressState] = struct{}{} } -// SetPeriodStart sets the "period_start" field. -func (m *BillingInvoiceMutation) SetPeriodStart(t time.Time) { - m.period_start = &t +// CustomerAddressStateCleared returns if the "customer_address_state" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressStateCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressState] + return ok } -// PeriodStart returns the value of the "period_start" field in the mutation. -func (m *BillingInvoiceMutation) PeriodStart() (r time.Time, exists bool) { - v := m.period_start +// ResetCustomerAddressState resets all changes to the "customer_address_state" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressState() { + m.customer_address_state = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressState) +} + +// SetCustomerAddressCity sets the "customer_address_city" field. +func (m *BillingInvoiceMutation) SetCustomerAddressCity(s string) { + m.customer_address_city = &s +} + +// CustomerAddressCity returns the value of the "customer_address_city" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressCity() (r string, exists bool) { + v := m.customer_address_city if v == nil { return } return *v, true } -// OldPeriodStart returns the old "period_start" field's value of the BillingInvoice entity. +// OldCustomerAddressCity returns the old "customer_address_city" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldPeriodStart(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceMutation) OldCustomerAddressCity(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldPeriodStart is only allowed on UpdateOne operations") + return v, errors.New("OldCustomerAddressCity is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldPeriodStart requires an ID field in the mutation") + return v, errors.New("OldCustomerAddressCity requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldPeriodStart: %w", err) + return v, fmt.Errorf("querying old value for OldCustomerAddressCity: %w", err) } - return oldValue.PeriodStart, nil + return oldValue.CustomerAddressCity, nil } -// ResetPeriodStart resets all changes to the "period_start" field. -func (m *BillingInvoiceMutation) ResetPeriodStart() { - m.period_start = nil +// ClearCustomerAddressCity clears the value of the "customer_address_city" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressCity() { + m.customer_address_city = nil + m.clearedFields[billinginvoice.FieldCustomerAddressCity] = struct{}{} } -// SetPeriodEnd sets the "period_end" field. -func (m *BillingInvoiceMutation) SetPeriodEnd(t time.Time) { - m.period_end = &t +// CustomerAddressCityCleared returns if the "customer_address_city" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressCityCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressCity] + return ok } -// PeriodEnd returns the value of the "period_end" field in the mutation. -func (m *BillingInvoiceMutation) PeriodEnd() (r time.Time, exists bool) { - v := m.period_end +// ResetCustomerAddressCity resets all changes to the "customer_address_city" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressCity() { + m.customer_address_city = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressCity) +} + +// SetCustomerAddressLine1 sets the "customer_address_line1" field. +func (m *BillingInvoiceMutation) SetCustomerAddressLine1(s string) { + m.customer_address_line1 = &s +} + +// CustomerAddressLine1 returns the value of the "customer_address_line1" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressLine1() (r string, exists bool) { + v := m.customer_address_line1 if v == nil { return } return *v, true } -// OldPeriodEnd returns the old "period_end" field's value of the BillingInvoice entity. +// OldCustomerAddressLine1 returns the old "customer_address_line1" field's value of the BillingInvoice entity. // If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceMutation) OldPeriodEnd(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceMutation) OldCustomerAddressLine1(ctx context.Context) (v *string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldPeriodEnd is only allowed on UpdateOne operations") + return v, errors.New("OldCustomerAddressLine1 is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldPeriodEnd requires an ID field in the mutation") + return v, errors.New("OldCustomerAddressLine1 requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldPeriodEnd: %w", err) + return v, fmt.Errorf("querying old value for OldCustomerAddressLine1: %w", err) } - return oldValue.PeriodEnd, nil + return oldValue.CustomerAddressLine1, nil } -// ResetPeriodEnd resets all changes to the "period_end" field. -func (m *BillingInvoiceMutation) ResetPeriodEnd() { - m.period_end = nil +// ClearCustomerAddressLine1 clears the value of the "customer_address_line1" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressLine1() { + m.customer_address_line1 = nil + m.clearedFields[billinginvoice.FieldCustomerAddressLine1] = struct{}{} } -// ClearBillingProfile clears the "billing_profile" edge to the BillingProfile entity. -func (m *BillingInvoiceMutation) ClearBillingProfile() { - m.clearedbilling_profile = true - m.clearedFields[billinginvoice.FieldBillingProfileID] = struct{}{} +// CustomerAddressLine1Cleared returns if the "customer_address_line1" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressLine1Cleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressLine1] + return ok } -// BillingProfileCleared reports if the "billing_profile" edge to the BillingProfile entity was cleared. -func (m *BillingInvoiceMutation) BillingProfileCleared() bool { - return m.clearedbilling_profile +// ResetCustomerAddressLine1 resets all changes to the "customer_address_line1" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressLine1() { + m.customer_address_line1 = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressLine1) } -// BillingProfileIDs returns the "billing_profile" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// BillingProfileID instead. It exists only for internal usage by the builders. -func (m *BillingInvoiceMutation) BillingProfileIDs() (ids []string) { - if id := m.billing_profile; id != nil { - ids = append(ids, *id) +// SetCustomerAddressLine2 sets the "customer_address_line2" field. +func (m *BillingInvoiceMutation) SetCustomerAddressLine2(s string) { + m.customer_address_line2 = &s +} + +// CustomerAddressLine2 returns the value of the "customer_address_line2" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressLine2() (r string, exists bool) { + v := m.customer_address_line2 + if v == nil { + return } - return + return *v, true } -// ResetBillingProfile resets all changes to the "billing_profile" edge. -func (m *BillingInvoiceMutation) ResetBillingProfile() { - m.billing_profile = nil - m.clearedbilling_profile = false +// OldCustomerAddressLine2 returns the old "customer_address_line2" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCustomerAddressLine2(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCustomerAddressLine2 is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCustomerAddressLine2 requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCustomerAddressLine2: %w", err) + } + return oldValue.CustomerAddressLine2, nil } -// SetBillingWorkflowConfigID sets the "billing_workflow_config" edge to the BillingWorkflowConfig entity by id. -func (m *BillingInvoiceMutation) SetBillingWorkflowConfigID(id string) { - m.billing_workflow_config = &id +// ClearCustomerAddressLine2 clears the value of the "customer_address_line2" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressLine2() { + m.customer_address_line2 = nil + m.clearedFields[billinginvoice.FieldCustomerAddressLine2] = struct{}{} } -// ClearBillingWorkflowConfig clears the "billing_workflow_config" edge to the BillingWorkflowConfig entity. -func (m *BillingInvoiceMutation) ClearBillingWorkflowConfig() { - m.clearedbilling_workflow_config = true - m.clearedFields[billinginvoice.FieldWorkflowConfigID] = struct{}{} +// CustomerAddressLine2Cleared returns if the "customer_address_line2" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressLine2Cleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressLine2] + return ok } -// BillingWorkflowConfigCleared reports if the "billing_workflow_config" edge to the BillingWorkflowConfig entity was cleared. -func (m *BillingInvoiceMutation) BillingWorkflowConfigCleared() bool { - return m.clearedbilling_workflow_config +// ResetCustomerAddressLine2 resets all changes to the "customer_address_line2" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressLine2() { + m.customer_address_line2 = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressLine2) } -// BillingWorkflowConfigID returns the "billing_workflow_config" edge ID in the mutation. -func (m *BillingInvoiceMutation) BillingWorkflowConfigID() (id string, exists bool) { - if m.billing_workflow_config != nil { - return *m.billing_workflow_config, true - } - return +// SetCustomerAddressPhoneNumber sets the "customer_address_phone_number" field. +func (m *BillingInvoiceMutation) SetCustomerAddressPhoneNumber(s string) { + m.customer_address_phone_number = &s } -// BillingWorkflowConfigIDs returns the "billing_workflow_config" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// BillingWorkflowConfigID instead. It exists only for internal usage by the builders. -func (m *BillingInvoiceMutation) BillingWorkflowConfigIDs() (ids []string) { - if id := m.billing_workflow_config; id != nil { - ids = append(ids, *id) +// CustomerAddressPhoneNumber returns the value of the "customer_address_phone_number" field in the mutation. +func (m *BillingInvoiceMutation) CustomerAddressPhoneNumber() (r string, exists bool) { + v := m.customer_address_phone_number + if v == nil { + return } - return -} - -// ResetBillingWorkflowConfig resets all changes to the "billing_workflow_config" edge. -func (m *BillingInvoiceMutation) ResetBillingWorkflowConfig() { - m.billing_workflow_config = nil - m.clearedbilling_workflow_config = false + return *v, true } -// AddBillingInvoiceItemIDs adds the "billing_invoice_items" edge to the BillingInvoiceItem entity by ids. -func (m *BillingInvoiceMutation) AddBillingInvoiceItemIDs(ids ...string) { - if m.billing_invoice_items == nil { - m.billing_invoice_items = make(map[string]struct{}) +// OldCustomerAddressPhoneNumber returns the old "customer_address_phone_number" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCustomerAddressPhoneNumber(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCustomerAddressPhoneNumber is only allowed on UpdateOne operations") } - for i := range ids { - m.billing_invoice_items[ids[i]] = struct{}{} + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCustomerAddressPhoneNumber requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCustomerAddressPhoneNumber: %w", err) } + return oldValue.CustomerAddressPhoneNumber, nil } -// ClearBillingInvoiceItems clears the "billing_invoice_items" edge to the BillingInvoiceItem entity. -func (m *BillingInvoiceMutation) ClearBillingInvoiceItems() { - m.clearedbilling_invoice_items = true +// ClearCustomerAddressPhoneNumber clears the value of the "customer_address_phone_number" field. +func (m *BillingInvoiceMutation) ClearCustomerAddressPhoneNumber() { + m.customer_address_phone_number = nil + m.clearedFields[billinginvoice.FieldCustomerAddressPhoneNumber] = struct{}{} } -// BillingInvoiceItemsCleared reports if the "billing_invoice_items" edge to the BillingInvoiceItem entity was cleared. -func (m *BillingInvoiceMutation) BillingInvoiceItemsCleared() bool { - return m.clearedbilling_invoice_items +// CustomerAddressPhoneNumberCleared returns if the "customer_address_phone_number" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerAddressPhoneNumberCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerAddressPhoneNumber] + return ok } -// RemoveBillingInvoiceItemIDs removes the "billing_invoice_items" edge to the BillingInvoiceItem entity by IDs. -func (m *BillingInvoiceMutation) RemoveBillingInvoiceItemIDs(ids ...string) { - if m.removedbilling_invoice_items == nil { - m.removedbilling_invoice_items = make(map[string]struct{}) - } - for i := range ids { - delete(m.billing_invoice_items, ids[i]) - m.removedbilling_invoice_items[ids[i]] = struct{}{} - } +// ResetCustomerAddressPhoneNumber resets all changes to the "customer_address_phone_number" field. +func (m *BillingInvoiceMutation) ResetCustomerAddressPhoneNumber() { + m.customer_address_phone_number = nil + delete(m.clearedFields, billinginvoice.FieldCustomerAddressPhoneNumber) } -// RemovedBillingInvoiceItems returns the removed IDs of the "billing_invoice_items" edge to the BillingInvoiceItem entity. -func (m *BillingInvoiceMutation) RemovedBillingInvoiceItemsIDs() (ids []string) { - for id := range m.removedbilling_invoice_items { - ids = append(ids, id) +// SetSupplierName sets the "supplier_name" field. +func (m *BillingInvoiceMutation) SetSupplierName(s string) { + m.supplier_name = &s +} + +// SupplierName returns the value of the "supplier_name" field in the mutation. +func (m *BillingInvoiceMutation) SupplierName() (r string, exists bool) { + v := m.supplier_name + if v == nil { + return } - return + return *v, true } -// BillingInvoiceItemsIDs returns the "billing_invoice_items" edge IDs in the mutation. -func (m *BillingInvoiceMutation) BillingInvoiceItemsIDs() (ids []string) { - for id := range m.billing_invoice_items { - ids = append(ids, id) +// OldSupplierName returns the old "supplier_name" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldSupplierName(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSupplierName is only allowed on UpdateOne operations") } - return + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSupplierName requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSupplierName: %w", err) + } + return oldValue.SupplierName, nil } -// ResetBillingInvoiceItems resets all changes to the "billing_invoice_items" edge. -func (m *BillingInvoiceMutation) ResetBillingInvoiceItems() { - m.billing_invoice_items = nil - m.clearedbilling_invoice_items = false - m.removedbilling_invoice_items = nil +// ResetSupplierName resets all changes to the "supplier_name" field. +func (m *BillingInvoiceMutation) ResetSupplierName() { + m.supplier_name = nil } -// Where appends a list predicates to the BillingInvoiceMutation builder. -func (m *BillingInvoiceMutation) Where(ps ...predicate.BillingInvoice) { - m.predicates = append(m.predicates, ps...) +// SetSupplierTaxCode sets the "supplier_tax_code" field. +func (m *BillingInvoiceMutation) SetSupplierTaxCode(s string) { + m.supplier_tax_code = &s } -// WhereP appends storage-level predicates to the BillingInvoiceMutation builder. Using this method, -// users can use type-assertion to append predicates that do not depend on any generated package. -func (m *BillingInvoiceMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.BillingInvoice, len(ps)) - for i := range ps { - p[i] = ps[i] +// SupplierTaxCode returns the value of the "supplier_tax_code" field in the mutation. +func (m *BillingInvoiceMutation) SupplierTaxCode() (r string, exists bool) { + v := m.supplier_tax_code + if v == nil { + return } - m.Where(p...) + return *v, true } -// Op returns the operation name. -func (m *BillingInvoiceMutation) Op() Op { - return m.op +// OldSupplierTaxCode returns the old "supplier_tax_code" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldSupplierTaxCode(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSupplierTaxCode is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSupplierTaxCode requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSupplierTaxCode: %w", err) + } + return oldValue.SupplierTaxCode, nil } -// SetOp allows setting the mutation operation. -func (m *BillingInvoiceMutation) SetOp(op Op) { - m.op = op +// ClearSupplierTaxCode clears the value of the "supplier_tax_code" field. +func (m *BillingInvoiceMutation) ClearSupplierTaxCode() { + m.supplier_tax_code = nil + m.clearedFields[billinginvoice.FieldSupplierTaxCode] = struct{}{} } -// Type returns the node type of this mutation (BillingInvoice). -func (m *BillingInvoiceMutation) Type() string { - return m.typ +// SupplierTaxCodeCleared returns if the "supplier_tax_code" field was cleared in this mutation. +func (m *BillingInvoiceMutation) SupplierTaxCodeCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldSupplierTaxCode] + return ok } -// Fields returns all fields that were changed during this mutation. Note that in -// order to get all numeric fields that were incremented/decremented, call -// AddedFields(). -func (m *BillingInvoiceMutation) Fields() []string { - fields := make([]string, 0, 16) - if m.namespace != nil { - fields = append(fields, billinginvoice.FieldNamespace) +// ResetSupplierTaxCode resets all changes to the "supplier_tax_code" field. +func (m *BillingInvoiceMutation) ResetSupplierTaxCode() { + m.supplier_tax_code = nil + delete(m.clearedFields, billinginvoice.FieldSupplierTaxCode) +} + +// SetCustomerName sets the "customer_name" field. +func (m *BillingInvoiceMutation) SetCustomerName(s string) { + m.customer_name = &s +} + +// CustomerName returns the value of the "customer_name" field in the mutation. +func (m *BillingInvoiceMutation) CustomerName() (r string, exists bool) { + v := m.customer_name + if v == nil { + return } - if m.created_at != nil { - fields = append(fields, billinginvoice.FieldCreatedAt) + return *v, true +} + +// OldCustomerName returns the old "customer_name" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCustomerName(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCustomerName is only allowed on UpdateOne operations") } - if m.updated_at != nil { - fields = append(fields, billinginvoice.FieldUpdatedAt) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCustomerName requires an ID field in the mutation") } - if m.deleted_at != nil { - fields = append(fields, billinginvoice.FieldDeletedAt) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCustomerName: %w", err) } - if m.metadata != nil { - fields = append(fields, billinginvoice.FieldMetadata) + return oldValue.CustomerName, nil +} + +// ResetCustomerName resets all changes to the "customer_name" field. +func (m *BillingInvoiceMutation) ResetCustomerName() { + m.customer_name = nil +} + +// SetCustomerTimezone sets the "customer_timezone" field. +func (m *BillingInvoiceMutation) SetCustomerTimezone(t timezone.Timezone) { + m.customer_timezone = &t +} + +// CustomerTimezone returns the value of the "customer_timezone" field in the mutation. +func (m *BillingInvoiceMutation) CustomerTimezone() (r timezone.Timezone, exists bool) { + v := m.customer_timezone + if v == nil { + return } - if m.series != nil { - fields = append(fields, billinginvoice.FieldSeries) + return *v, true +} + +// OldCustomerTimezone returns the old "customer_timezone" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCustomerTimezone(ctx context.Context) (v *timezone.Timezone, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCustomerTimezone is only allowed on UpdateOne operations") } - if m.code != nil { - fields = append(fields, billinginvoice.FieldCode) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCustomerTimezone requires an ID field in the mutation") } - if m.customer_id != nil { - fields = append(fields, billinginvoice.FieldCustomerID) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCustomerTimezone: %w", err) } - if m.billing_profile != nil { - fields = append(fields, billinginvoice.FieldBillingProfileID) + return oldValue.CustomerTimezone, nil +} + +// ClearCustomerTimezone clears the value of the "customer_timezone" field. +func (m *BillingInvoiceMutation) ClearCustomerTimezone() { + m.customer_timezone = nil + m.clearedFields[billinginvoice.FieldCustomerTimezone] = struct{}{} +} + +// CustomerTimezoneCleared returns if the "customer_timezone" field was cleared in this mutation. +func (m *BillingInvoiceMutation) CustomerTimezoneCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldCustomerTimezone] + return ok +} + +// ResetCustomerTimezone resets all changes to the "customer_timezone" field. +func (m *BillingInvoiceMutation) ResetCustomerTimezone() { + m.customer_timezone = nil + delete(m.clearedFields, billinginvoice.FieldCustomerTimezone) +} + +// SetNumber sets the "number" field. +func (m *BillingInvoiceMutation) SetNumber(s string) { + m.number = &s +} + +// Number returns the value of the "number" field in the mutation. +func (m *BillingInvoiceMutation) Number() (r string, exists bool) { + v := m.number + if v == nil { + return } - if m.voided_at != nil { - fields = append(fields, billinginvoice.FieldVoidedAt) + return *v, true +} + +// OldNumber returns the old "number" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldNumber(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldNumber is only allowed on UpdateOne operations") } - if m.currency != nil { - fields = append(fields, billinginvoice.FieldCurrency) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldNumber requires an ID field in the mutation") } - if m.due_date != nil { - fields = append(fields, billinginvoice.FieldDueDate) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldNumber: %w", err) } - if m.status != nil { - fields = append(fields, billinginvoice.FieldStatus) + return oldValue.Number, nil +} + +// ClearNumber clears the value of the "number" field. +func (m *BillingInvoiceMutation) ClearNumber() { + m.number = nil + m.clearedFields[billinginvoice.FieldNumber] = struct{}{} +} + +// NumberCleared returns if the "number" field was cleared in this mutation. +func (m *BillingInvoiceMutation) NumberCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldNumber] + return ok +} + +// ResetNumber resets all changes to the "number" field. +func (m *BillingInvoiceMutation) ResetNumber() { + m.number = nil + delete(m.clearedFields, billinginvoice.FieldNumber) +} + +// SetType sets the "type" field. +func (m *BillingInvoiceMutation) SetType(bt billingentity.InvoiceType) { + m._type = &bt +} + +// GetType returns the value of the "type" field in the mutation. +func (m *BillingInvoiceMutation) GetType() (r billingentity.InvoiceType, exists bool) { + v := m._type + if v == nil { + return } - if m.billing_workflow_config != nil { - fields = append(fields, billinginvoice.FieldWorkflowConfigID) + return *v, true +} + +// OldType returns the old "type" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldType(ctx context.Context) (v billingentity.InvoiceType, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldType is only allowed on UpdateOne operations") } - if m.period_start != nil { - fields = append(fields, billinginvoice.FieldPeriodStart) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldType requires an ID field in the mutation") } - if m.period_end != nil { - fields = append(fields, billinginvoice.FieldPeriodEnd) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldType: %w", err) } - return fields + return oldValue.Type, nil } -// Field returns the value of a field with the given name. The second boolean -// return value indicates that this field was not set, or was not defined in the -// schema. -func (m *BillingInvoiceMutation) Field(name string) (ent.Value, bool) { - switch name { - case billinginvoice.FieldNamespace: - return m.Namespace() - case billinginvoice.FieldCreatedAt: - return m.CreatedAt() - case billinginvoice.FieldUpdatedAt: - return m.UpdatedAt() - case billinginvoice.FieldDeletedAt: - return m.DeletedAt() - case billinginvoice.FieldMetadata: - return m.Metadata() - case billinginvoice.FieldSeries: - return m.Series() - case billinginvoice.FieldCode: - return m.Code() - case billinginvoice.FieldCustomerID: - return m.CustomerID() - case billinginvoice.FieldBillingProfileID: - return m.BillingProfileID() - case billinginvoice.FieldVoidedAt: - return m.VoidedAt() - case billinginvoice.FieldCurrency: - return m.Currency() - case billinginvoice.FieldDueDate: - return m.DueDate() - case billinginvoice.FieldStatus: - return m.Status() - case billinginvoice.FieldWorkflowConfigID: - return m.WorkflowConfigID() - case billinginvoice.FieldPeriodStart: - return m.PeriodStart() - case billinginvoice.FieldPeriodEnd: - return m.PeriodEnd() +// ResetType resets all changes to the "type" field. +func (m *BillingInvoiceMutation) ResetType() { + m._type = nil +} + +// SetDescription sets the "description" field. +func (m *BillingInvoiceMutation) SetDescription(s string) { + m.description = &s +} + +// Description returns the value of the "description" field in the mutation. +func (m *BillingInvoiceMutation) Description() (r string, exists bool) { + v := m.description + if v == nil { + return } - return nil, false + return *v, true } -// OldField returns the old value of the field from the database. An error is -// returned if the mutation operation is not UpdateOne, or the query to the +// OldDescription returns the old "description" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldDescription(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDescription is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDescription requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDescription: %w", err) + } + return oldValue.Description, nil +} + +// ClearDescription clears the value of the "description" field. +func (m *BillingInvoiceMutation) ClearDescription() { + m.description = nil + m.clearedFields[billinginvoice.FieldDescription] = struct{}{} +} + +// DescriptionCleared returns if the "description" field was cleared in this mutation. +func (m *BillingInvoiceMutation) DescriptionCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldDescription] + return ok +} + +// ResetDescription resets all changes to the "description" field. +func (m *BillingInvoiceMutation) ResetDescription() { + m.description = nil + delete(m.clearedFields, billinginvoice.FieldDescription) +} + +// SetCustomerID sets the "customer_id" field. +func (m *BillingInvoiceMutation) SetCustomerID(s string) { + m.billing_invoice_customer = &s +} + +// CustomerID returns the value of the "customer_id" field in the mutation. +func (m *BillingInvoiceMutation) CustomerID() (r string, exists bool) { + v := m.billing_invoice_customer + if v == nil { + return + } + return *v, true +} + +// OldCustomerID returns the old "customer_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCustomerID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCustomerID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCustomerID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCustomerID: %w", err) + } + return oldValue.CustomerID, nil +} + +// ResetCustomerID resets all changes to the "customer_id" field. +func (m *BillingInvoiceMutation) ResetCustomerID() { + m.billing_invoice_customer = nil +} + +// SetSourceBillingProfileID sets the "source_billing_profile_id" field. +func (m *BillingInvoiceMutation) SetSourceBillingProfileID(s string) { + m.source_billing_profile = &s +} + +// SourceBillingProfileID returns the value of the "source_billing_profile_id" field in the mutation. +func (m *BillingInvoiceMutation) SourceBillingProfileID() (r string, exists bool) { + v := m.source_billing_profile + if v == nil { + return + } + return *v, true +} + +// OldSourceBillingProfileID returns the old "source_billing_profile_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldSourceBillingProfileID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldSourceBillingProfileID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldSourceBillingProfileID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldSourceBillingProfileID: %w", err) + } + return oldValue.SourceBillingProfileID, nil +} + +// ResetSourceBillingProfileID resets all changes to the "source_billing_profile_id" field. +func (m *BillingInvoiceMutation) ResetSourceBillingProfileID() { + m.source_billing_profile = nil +} + +// SetVoidedAt sets the "voided_at" field. +func (m *BillingInvoiceMutation) SetVoidedAt(t time.Time) { + m.voided_at = &t +} + +// VoidedAt returns the value of the "voided_at" field in the mutation. +func (m *BillingInvoiceMutation) VoidedAt() (r time.Time, exists bool) { + v := m.voided_at + if v == nil { + return + } + return *v, true +} + +// OldVoidedAt returns the old "voided_at" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldVoidedAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldVoidedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldVoidedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldVoidedAt: %w", err) + } + return oldValue.VoidedAt, nil +} + +// ClearVoidedAt clears the value of the "voided_at" field. +func (m *BillingInvoiceMutation) ClearVoidedAt() { + m.voided_at = nil + m.clearedFields[billinginvoice.FieldVoidedAt] = struct{}{} +} + +// VoidedAtCleared returns if the "voided_at" field was cleared in this mutation. +func (m *BillingInvoiceMutation) VoidedAtCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldVoidedAt] + return ok +} + +// ResetVoidedAt resets all changes to the "voided_at" field. +func (m *BillingInvoiceMutation) ResetVoidedAt() { + m.voided_at = nil + delete(m.clearedFields, billinginvoice.FieldVoidedAt) +} + +// SetIssuedAt sets the "issued_at" field. +func (m *BillingInvoiceMutation) SetIssuedAt(t time.Time) { + m.issued_at = &t +} + +// IssuedAt returns the value of the "issued_at" field in the mutation. +func (m *BillingInvoiceMutation) IssuedAt() (r time.Time, exists bool) { + v := m.issued_at + if v == nil { + return + } + return *v, true +} + +// OldIssuedAt returns the old "issued_at" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldIssuedAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldIssuedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldIssuedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldIssuedAt: %w", err) + } + return oldValue.IssuedAt, nil +} + +// ClearIssuedAt clears the value of the "issued_at" field. +func (m *BillingInvoiceMutation) ClearIssuedAt() { + m.issued_at = nil + m.clearedFields[billinginvoice.FieldIssuedAt] = struct{}{} +} + +// IssuedAtCleared returns if the "issued_at" field was cleared in this mutation. +func (m *BillingInvoiceMutation) IssuedAtCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldIssuedAt] + return ok +} + +// ResetIssuedAt resets all changes to the "issued_at" field. +func (m *BillingInvoiceMutation) ResetIssuedAt() { + m.issued_at = nil + delete(m.clearedFields, billinginvoice.FieldIssuedAt) +} + +// SetCurrency sets the "currency" field. +func (m *BillingInvoiceMutation) SetCurrency(c currencyx.Code) { + m.currency = &c +} + +// Currency returns the value of the "currency" field in the mutation. +func (m *BillingInvoiceMutation) Currency() (r currencyx.Code, exists bool) { + v := m.currency + if v == nil { + return + } + return *v, true +} + +// OldCurrency returns the old "currency" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldCurrency(ctx context.Context) (v currencyx.Code, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCurrency is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCurrency requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCurrency: %w", err) + } + return oldValue.Currency, nil +} + +// ResetCurrency resets all changes to the "currency" field. +func (m *BillingInvoiceMutation) ResetCurrency() { + m.currency = nil +} + +// SetDueAt sets the "due_at" field. +func (m *BillingInvoiceMutation) SetDueAt(t time.Time) { + m.due_at = &t +} + +// DueAt returns the value of the "due_at" field in the mutation. +func (m *BillingInvoiceMutation) DueAt() (r time.Time, exists bool) { + v := m.due_at + if v == nil { + return + } + return *v, true +} + +// OldDueAt returns the old "due_at" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldDueAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDueAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDueAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDueAt: %w", err) + } + return oldValue.DueAt, nil +} + +// ClearDueAt clears the value of the "due_at" field. +func (m *BillingInvoiceMutation) ClearDueAt() { + m.due_at = nil + m.clearedFields[billinginvoice.FieldDueAt] = struct{}{} +} + +// DueAtCleared returns if the "due_at" field was cleared in this mutation. +func (m *BillingInvoiceMutation) DueAtCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldDueAt] + return ok +} + +// ResetDueAt resets all changes to the "due_at" field. +func (m *BillingInvoiceMutation) ResetDueAt() { + m.due_at = nil + delete(m.clearedFields, billinginvoice.FieldDueAt) +} + +// SetStatus sets the "status" field. +func (m *BillingInvoiceMutation) SetStatus(bs billingentity.InvoiceStatus) { + m.status = &bs +} + +// Status returns the value of the "status" field in the mutation. +func (m *BillingInvoiceMutation) Status() (r billingentity.InvoiceStatus, exists bool) { + v := m.status + if v == nil { + return + } + return *v, true +} + +// OldStatus returns the old "status" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldStatus(ctx context.Context) (v billingentity.InvoiceStatus, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldStatus is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldStatus requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldStatus: %w", err) + } + return oldValue.Status, nil +} + +// ResetStatus resets all changes to the "status" field. +func (m *BillingInvoiceMutation) ResetStatus() { + m.status = nil +} + +// SetWorkflowConfigID sets the "workflow_config_id" field. +func (m *BillingInvoiceMutation) SetWorkflowConfigID(s string) { + m.billing_workflow_config = &s +} + +// WorkflowConfigID returns the value of the "workflow_config_id" field in the mutation. +func (m *BillingInvoiceMutation) WorkflowConfigID() (r string, exists bool) { + v := m.billing_workflow_config + if v == nil { + return + } + return *v, true +} + +// OldWorkflowConfigID returns the old "workflow_config_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldWorkflowConfigID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldWorkflowConfigID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldWorkflowConfigID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldWorkflowConfigID: %w", err) + } + return oldValue.WorkflowConfigID, nil +} + +// ResetWorkflowConfigID resets all changes to the "workflow_config_id" field. +func (m *BillingInvoiceMutation) ResetWorkflowConfigID() { + m.billing_workflow_config = nil +} + +// SetTaxAppID sets the "tax_app_id" field. +func (m *BillingInvoiceMutation) SetTaxAppID(s string) { + m.tax_app = &s +} + +// TaxAppID returns the value of the "tax_app_id" field in the mutation. +func (m *BillingInvoiceMutation) TaxAppID() (r string, exists bool) { + v := m.tax_app + if v == nil { + return + } + return *v, true +} + +// OldTaxAppID returns the old "tax_app_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldTaxAppID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldTaxAppID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldTaxAppID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldTaxAppID: %w", err) + } + return oldValue.TaxAppID, nil +} + +// ResetTaxAppID resets all changes to the "tax_app_id" field. +func (m *BillingInvoiceMutation) ResetTaxAppID() { + m.tax_app = nil +} + +// SetInvoicingAppID sets the "invoicing_app_id" field. +func (m *BillingInvoiceMutation) SetInvoicingAppID(s string) { + m.invoicing_app = &s +} + +// InvoicingAppID returns the value of the "invoicing_app_id" field in the mutation. +func (m *BillingInvoiceMutation) InvoicingAppID() (r string, exists bool) { + v := m.invoicing_app + if v == nil { + return + } + return *v, true +} + +// OldInvoicingAppID returns the old "invoicing_app_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldInvoicingAppID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldInvoicingAppID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldInvoicingAppID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldInvoicingAppID: %w", err) + } + return oldValue.InvoicingAppID, nil +} + +// ResetInvoicingAppID resets all changes to the "invoicing_app_id" field. +func (m *BillingInvoiceMutation) ResetInvoicingAppID() { + m.invoicing_app = nil +} + +// SetPaymentAppID sets the "payment_app_id" field. +func (m *BillingInvoiceMutation) SetPaymentAppID(s string) { + m.payment_app = &s +} + +// PaymentAppID returns the value of the "payment_app_id" field in the mutation. +func (m *BillingInvoiceMutation) PaymentAppID() (r string, exists bool) { + v := m.payment_app + if v == nil { + return + } + return *v, true +} + +// OldPaymentAppID returns the old "payment_app_id" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldPaymentAppID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPaymentAppID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPaymentAppID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPaymentAppID: %w", err) + } + return oldValue.PaymentAppID, nil +} + +// ResetPaymentAppID resets all changes to the "payment_app_id" field. +func (m *BillingInvoiceMutation) ResetPaymentAppID() { + m.payment_app = nil +} + +// SetPeriodStart sets the "period_start" field. +func (m *BillingInvoiceMutation) SetPeriodStart(t time.Time) { + m.period_start = &t +} + +// PeriodStart returns the value of the "period_start" field in the mutation. +func (m *BillingInvoiceMutation) PeriodStart() (r time.Time, exists bool) { + v := m.period_start + if v == nil { + return + } + return *v, true +} + +// OldPeriodStart returns the old "period_start" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldPeriodStart(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPeriodStart is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPeriodStart requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPeriodStart: %w", err) + } + return oldValue.PeriodStart, nil +} + +// ClearPeriodStart clears the value of the "period_start" field. +func (m *BillingInvoiceMutation) ClearPeriodStart() { + m.period_start = nil + m.clearedFields[billinginvoice.FieldPeriodStart] = struct{}{} +} + +// PeriodStartCleared returns if the "period_start" field was cleared in this mutation. +func (m *BillingInvoiceMutation) PeriodStartCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldPeriodStart] + return ok +} + +// ResetPeriodStart resets all changes to the "period_start" field. +func (m *BillingInvoiceMutation) ResetPeriodStart() { + m.period_start = nil + delete(m.clearedFields, billinginvoice.FieldPeriodStart) +} + +// SetPeriodEnd sets the "period_end" field. +func (m *BillingInvoiceMutation) SetPeriodEnd(t time.Time) { + m.period_end = &t +} + +// PeriodEnd returns the value of the "period_end" field in the mutation. +func (m *BillingInvoiceMutation) PeriodEnd() (r time.Time, exists bool) { + v := m.period_end + if v == nil { + return + } + return *v, true +} + +// OldPeriodEnd returns the old "period_end" field's value of the BillingInvoice entity. +// If the BillingInvoice object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceMutation) OldPeriodEnd(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPeriodEnd is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPeriodEnd requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPeriodEnd: %w", err) + } + return oldValue.PeriodEnd, nil +} + +// ClearPeriodEnd clears the value of the "period_end" field. +func (m *BillingInvoiceMutation) ClearPeriodEnd() { + m.period_end = nil + m.clearedFields[billinginvoice.FieldPeriodEnd] = struct{}{} +} + +// PeriodEndCleared returns if the "period_end" field was cleared in this mutation. +func (m *BillingInvoiceMutation) PeriodEndCleared() bool { + _, ok := m.clearedFields[billinginvoice.FieldPeriodEnd] + return ok +} + +// ResetPeriodEnd resets all changes to the "period_end" field. +func (m *BillingInvoiceMutation) ResetPeriodEnd() { + m.period_end = nil + delete(m.clearedFields, billinginvoice.FieldPeriodEnd) +} + +// ClearSourceBillingProfile clears the "source_billing_profile" edge to the BillingProfile entity. +func (m *BillingInvoiceMutation) ClearSourceBillingProfile() { + m.clearedsource_billing_profile = true + m.clearedFields[billinginvoice.FieldSourceBillingProfileID] = struct{}{} +} + +// SourceBillingProfileCleared reports if the "source_billing_profile" edge to the BillingProfile entity was cleared. +func (m *BillingInvoiceMutation) SourceBillingProfileCleared() bool { + return m.clearedsource_billing_profile +} + +// SourceBillingProfileIDs returns the "source_billing_profile" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// SourceBillingProfileID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) SourceBillingProfileIDs() (ids []string) { + if id := m.source_billing_profile; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetSourceBillingProfile resets all changes to the "source_billing_profile" edge. +func (m *BillingInvoiceMutation) ResetSourceBillingProfile() { + m.source_billing_profile = nil + m.clearedsource_billing_profile = false +} + +// SetBillingWorkflowConfigID sets the "billing_workflow_config" edge to the BillingWorkflowConfig entity by id. +func (m *BillingInvoiceMutation) SetBillingWorkflowConfigID(id string) { + m.billing_workflow_config = &id +} + +// ClearBillingWorkflowConfig clears the "billing_workflow_config" edge to the BillingWorkflowConfig entity. +func (m *BillingInvoiceMutation) ClearBillingWorkflowConfig() { + m.clearedbilling_workflow_config = true + m.clearedFields[billinginvoice.FieldWorkflowConfigID] = struct{}{} +} + +// BillingWorkflowConfigCleared reports if the "billing_workflow_config" edge to the BillingWorkflowConfig entity was cleared. +func (m *BillingInvoiceMutation) BillingWorkflowConfigCleared() bool { + return m.clearedbilling_workflow_config +} + +// BillingWorkflowConfigID returns the "billing_workflow_config" edge ID in the mutation. +func (m *BillingInvoiceMutation) BillingWorkflowConfigID() (id string, exists bool) { + if m.billing_workflow_config != nil { + return *m.billing_workflow_config, true + } + return +} + +// BillingWorkflowConfigIDs returns the "billing_workflow_config" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// BillingWorkflowConfigID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) BillingWorkflowConfigIDs() (ids []string) { + if id := m.billing_workflow_config; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetBillingWorkflowConfig resets all changes to the "billing_workflow_config" edge. +func (m *BillingInvoiceMutation) ResetBillingWorkflowConfig() { + m.billing_workflow_config = nil + m.clearedbilling_workflow_config = false +} + +// AddBillingInvoiceLineIDs adds the "billing_invoice_lines" edge to the BillingInvoiceLine entity by ids. +func (m *BillingInvoiceMutation) AddBillingInvoiceLineIDs(ids ...string) { + if m.billing_invoice_lines == nil { + m.billing_invoice_lines = make(map[string]struct{}) + } + for i := range ids { + m.billing_invoice_lines[ids[i]] = struct{}{} + } +} + +// ClearBillingInvoiceLines clears the "billing_invoice_lines" edge to the BillingInvoiceLine entity. +func (m *BillingInvoiceMutation) ClearBillingInvoiceLines() { + m.clearedbilling_invoice_lines = true +} + +// BillingInvoiceLinesCleared reports if the "billing_invoice_lines" edge to the BillingInvoiceLine entity was cleared. +func (m *BillingInvoiceMutation) BillingInvoiceLinesCleared() bool { + return m.clearedbilling_invoice_lines +} + +// RemoveBillingInvoiceLineIDs removes the "billing_invoice_lines" edge to the BillingInvoiceLine entity by IDs. +func (m *BillingInvoiceMutation) RemoveBillingInvoiceLineIDs(ids ...string) { + if m.removedbilling_invoice_lines == nil { + m.removedbilling_invoice_lines = make(map[string]struct{}) + } + for i := range ids { + delete(m.billing_invoice_lines, ids[i]) + m.removedbilling_invoice_lines[ids[i]] = struct{}{} + } +} + +// RemovedBillingInvoiceLines returns the removed IDs of the "billing_invoice_lines" edge to the BillingInvoiceLine entity. +func (m *BillingInvoiceMutation) RemovedBillingInvoiceLinesIDs() (ids []string) { + for id := range m.removedbilling_invoice_lines { + ids = append(ids, id) + } + return +} + +// BillingInvoiceLinesIDs returns the "billing_invoice_lines" edge IDs in the mutation. +func (m *BillingInvoiceMutation) BillingInvoiceLinesIDs() (ids []string) { + for id := range m.billing_invoice_lines { + ids = append(ids, id) + } + return +} + +// ResetBillingInvoiceLines resets all changes to the "billing_invoice_lines" edge. +func (m *BillingInvoiceMutation) ResetBillingInvoiceLines() { + m.billing_invoice_lines = nil + m.clearedbilling_invoice_lines = false + m.removedbilling_invoice_lines = nil +} + +// SetBillingInvoiceCustomerID sets the "billing_invoice_customer" edge to the Customer entity by id. +func (m *BillingInvoiceMutation) SetBillingInvoiceCustomerID(id string) { + m.billing_invoice_customer = &id +} + +// ClearBillingInvoiceCustomer clears the "billing_invoice_customer" edge to the Customer entity. +func (m *BillingInvoiceMutation) ClearBillingInvoiceCustomer() { + m.clearedbilling_invoice_customer = true + m.clearedFields[billinginvoice.FieldCustomerID] = struct{}{} +} + +// BillingInvoiceCustomerCleared reports if the "billing_invoice_customer" edge to the Customer entity was cleared. +func (m *BillingInvoiceMutation) BillingInvoiceCustomerCleared() bool { + return m.clearedbilling_invoice_customer +} + +// BillingInvoiceCustomerID returns the "billing_invoice_customer" edge ID in the mutation. +func (m *BillingInvoiceMutation) BillingInvoiceCustomerID() (id string, exists bool) { + if m.billing_invoice_customer != nil { + return *m.billing_invoice_customer, true + } + return +} + +// BillingInvoiceCustomerIDs returns the "billing_invoice_customer" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// BillingInvoiceCustomerID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) BillingInvoiceCustomerIDs() (ids []string) { + if id := m.billing_invoice_customer; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetBillingInvoiceCustomer resets all changes to the "billing_invoice_customer" edge. +func (m *BillingInvoiceMutation) ResetBillingInvoiceCustomer() { + m.billing_invoice_customer = nil + m.clearedbilling_invoice_customer = false +} + +// ClearTaxApp clears the "tax_app" edge to the App entity. +func (m *BillingInvoiceMutation) ClearTaxApp() { + m.clearedtax_app = true + m.clearedFields[billinginvoice.FieldTaxAppID] = struct{}{} +} + +// TaxAppCleared reports if the "tax_app" edge to the App entity was cleared. +func (m *BillingInvoiceMutation) TaxAppCleared() bool { + return m.clearedtax_app +} + +// TaxAppIDs returns the "tax_app" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// TaxAppID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) TaxAppIDs() (ids []string) { + if id := m.tax_app; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetTaxApp resets all changes to the "tax_app" edge. +func (m *BillingInvoiceMutation) ResetTaxApp() { + m.tax_app = nil + m.clearedtax_app = false +} + +// ClearInvoicingApp clears the "invoicing_app" edge to the App entity. +func (m *BillingInvoiceMutation) ClearInvoicingApp() { + m.clearedinvoicing_app = true + m.clearedFields[billinginvoice.FieldInvoicingAppID] = struct{}{} +} + +// InvoicingAppCleared reports if the "invoicing_app" edge to the App entity was cleared. +func (m *BillingInvoiceMutation) InvoicingAppCleared() bool { + return m.clearedinvoicing_app +} + +// InvoicingAppIDs returns the "invoicing_app" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// InvoicingAppID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) InvoicingAppIDs() (ids []string) { + if id := m.invoicing_app; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetInvoicingApp resets all changes to the "invoicing_app" edge. +func (m *BillingInvoiceMutation) ResetInvoicingApp() { + m.invoicing_app = nil + m.clearedinvoicing_app = false +} + +// ClearPaymentApp clears the "payment_app" edge to the App entity. +func (m *BillingInvoiceMutation) ClearPaymentApp() { + m.clearedpayment_app = true + m.clearedFields[billinginvoice.FieldPaymentAppID] = struct{}{} +} + +// PaymentAppCleared reports if the "payment_app" edge to the App entity was cleared. +func (m *BillingInvoiceMutation) PaymentAppCleared() bool { + return m.clearedpayment_app +} + +// PaymentAppIDs returns the "payment_app" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// PaymentAppID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceMutation) PaymentAppIDs() (ids []string) { + if id := m.payment_app; id != nil { + ids = append(ids, *id) + } + return +} + +// ResetPaymentApp resets all changes to the "payment_app" edge. +func (m *BillingInvoiceMutation) ResetPaymentApp() { + m.payment_app = nil + m.clearedpayment_app = false +} + +// Where appends a list predicates to the BillingInvoiceMutation builder. +func (m *BillingInvoiceMutation) Where(ps ...predicate.BillingInvoice) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the BillingInvoiceMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *BillingInvoiceMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.BillingInvoice, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *BillingInvoiceMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *BillingInvoiceMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (BillingInvoice). +func (m *BillingInvoiceMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *BillingInvoiceMutation) Fields() []string { + fields := make([]string, 0, 39) + if m.namespace != nil { + fields = append(fields, billinginvoice.FieldNamespace) + } + if m.metadata != nil { + fields = append(fields, billinginvoice.FieldMetadata) + } + if m.created_at != nil { + fields = append(fields, billinginvoice.FieldCreatedAt) + } + if m.updated_at != nil { + fields = append(fields, billinginvoice.FieldUpdatedAt) + } + if m.deleted_at != nil { + fields = append(fields, billinginvoice.FieldDeletedAt) + } + if m.supplier_address_country != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressCountry) + } + if m.supplier_address_postal_code != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressPostalCode) + } + if m.supplier_address_state != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressState) + } + if m.supplier_address_city != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressCity) + } + if m.supplier_address_line1 != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressLine1) + } + if m.supplier_address_line2 != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressLine2) + } + if m.supplier_address_phone_number != nil { + fields = append(fields, billinginvoice.FieldSupplierAddressPhoneNumber) + } + if m.customer_address_country != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressCountry) + } + if m.customer_address_postal_code != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressPostalCode) + } + if m.customer_address_state != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressState) + } + if m.customer_address_city != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressCity) + } + if m.customer_address_line1 != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressLine1) + } + if m.customer_address_line2 != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressLine2) + } + if m.customer_address_phone_number != nil { + fields = append(fields, billinginvoice.FieldCustomerAddressPhoneNumber) + } + if m.supplier_name != nil { + fields = append(fields, billinginvoice.FieldSupplierName) + } + if m.supplier_tax_code != nil { + fields = append(fields, billinginvoice.FieldSupplierTaxCode) + } + if m.customer_name != nil { + fields = append(fields, billinginvoice.FieldCustomerName) + } + if m.customer_timezone != nil { + fields = append(fields, billinginvoice.FieldCustomerTimezone) + } + if m.number != nil { + fields = append(fields, billinginvoice.FieldNumber) + } + if m._type != nil { + fields = append(fields, billinginvoice.FieldType) + } + if m.description != nil { + fields = append(fields, billinginvoice.FieldDescription) + } + if m.billing_invoice_customer != nil { + fields = append(fields, billinginvoice.FieldCustomerID) + } + if m.source_billing_profile != nil { + fields = append(fields, billinginvoice.FieldSourceBillingProfileID) + } + if m.voided_at != nil { + fields = append(fields, billinginvoice.FieldVoidedAt) + } + if m.issued_at != nil { + fields = append(fields, billinginvoice.FieldIssuedAt) + } + if m.currency != nil { + fields = append(fields, billinginvoice.FieldCurrency) + } + if m.due_at != nil { + fields = append(fields, billinginvoice.FieldDueAt) + } + if m.status != nil { + fields = append(fields, billinginvoice.FieldStatus) + } + if m.billing_workflow_config != nil { + fields = append(fields, billinginvoice.FieldWorkflowConfigID) + } + if m.tax_app != nil { + fields = append(fields, billinginvoice.FieldTaxAppID) + } + if m.invoicing_app != nil { + fields = append(fields, billinginvoice.FieldInvoicingAppID) + } + if m.payment_app != nil { + fields = append(fields, billinginvoice.FieldPaymentAppID) + } + if m.period_start != nil { + fields = append(fields, billinginvoice.FieldPeriodStart) + } + if m.period_end != nil { + fields = append(fields, billinginvoice.FieldPeriodEnd) + } + return fields +} + +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *BillingInvoiceMutation) Field(name string) (ent.Value, bool) { + switch name { + case billinginvoice.FieldNamespace: + return m.Namespace() + case billinginvoice.FieldMetadata: + return m.Metadata() + case billinginvoice.FieldCreatedAt: + return m.CreatedAt() + case billinginvoice.FieldUpdatedAt: + return m.UpdatedAt() + case billinginvoice.FieldDeletedAt: + return m.DeletedAt() + case billinginvoice.FieldSupplierAddressCountry: + return m.SupplierAddressCountry() + case billinginvoice.FieldSupplierAddressPostalCode: + return m.SupplierAddressPostalCode() + case billinginvoice.FieldSupplierAddressState: + return m.SupplierAddressState() + case billinginvoice.FieldSupplierAddressCity: + return m.SupplierAddressCity() + case billinginvoice.FieldSupplierAddressLine1: + return m.SupplierAddressLine1() + case billinginvoice.FieldSupplierAddressLine2: + return m.SupplierAddressLine2() + case billinginvoice.FieldSupplierAddressPhoneNumber: + return m.SupplierAddressPhoneNumber() + case billinginvoice.FieldCustomerAddressCountry: + return m.CustomerAddressCountry() + case billinginvoice.FieldCustomerAddressPostalCode: + return m.CustomerAddressPostalCode() + case billinginvoice.FieldCustomerAddressState: + return m.CustomerAddressState() + case billinginvoice.FieldCustomerAddressCity: + return m.CustomerAddressCity() + case billinginvoice.FieldCustomerAddressLine1: + return m.CustomerAddressLine1() + case billinginvoice.FieldCustomerAddressLine2: + return m.CustomerAddressLine2() + case billinginvoice.FieldCustomerAddressPhoneNumber: + return m.CustomerAddressPhoneNumber() + case billinginvoice.FieldSupplierName: + return m.SupplierName() + case billinginvoice.FieldSupplierTaxCode: + return m.SupplierTaxCode() + case billinginvoice.FieldCustomerName: + return m.CustomerName() + case billinginvoice.FieldCustomerTimezone: + return m.CustomerTimezone() + case billinginvoice.FieldNumber: + return m.Number() + case billinginvoice.FieldType: + return m.GetType() + case billinginvoice.FieldDescription: + return m.Description() + case billinginvoice.FieldCustomerID: + return m.CustomerID() + case billinginvoice.FieldSourceBillingProfileID: + return m.SourceBillingProfileID() + case billinginvoice.FieldVoidedAt: + return m.VoidedAt() + case billinginvoice.FieldIssuedAt: + return m.IssuedAt() + case billinginvoice.FieldCurrency: + return m.Currency() + case billinginvoice.FieldDueAt: + return m.DueAt() + case billinginvoice.FieldStatus: + return m.Status() + case billinginvoice.FieldWorkflowConfigID: + return m.WorkflowConfigID() + case billinginvoice.FieldTaxAppID: + return m.TaxAppID() + case billinginvoice.FieldInvoicingAppID: + return m.InvoicingAppID() + case billinginvoice.FieldPaymentAppID: + return m.PaymentAppID() + case billinginvoice.FieldPeriodStart: + return m.PeriodStart() + case billinginvoice.FieldPeriodEnd: + return m.PeriodEnd() + } + return nil, false +} + +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the // database failed. func (m *BillingInvoiceMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { case billinginvoice.FieldNamespace: - return m.OldNamespace(ctx) + return m.OldNamespace(ctx) + case billinginvoice.FieldMetadata: + return m.OldMetadata(ctx) + case billinginvoice.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case billinginvoice.FieldUpdatedAt: + return m.OldUpdatedAt(ctx) + case billinginvoice.FieldDeletedAt: + return m.OldDeletedAt(ctx) + case billinginvoice.FieldSupplierAddressCountry: + return m.OldSupplierAddressCountry(ctx) + case billinginvoice.FieldSupplierAddressPostalCode: + return m.OldSupplierAddressPostalCode(ctx) + case billinginvoice.FieldSupplierAddressState: + return m.OldSupplierAddressState(ctx) + case billinginvoice.FieldSupplierAddressCity: + return m.OldSupplierAddressCity(ctx) + case billinginvoice.FieldSupplierAddressLine1: + return m.OldSupplierAddressLine1(ctx) + case billinginvoice.FieldSupplierAddressLine2: + return m.OldSupplierAddressLine2(ctx) + case billinginvoice.FieldSupplierAddressPhoneNumber: + return m.OldSupplierAddressPhoneNumber(ctx) + case billinginvoice.FieldCustomerAddressCountry: + return m.OldCustomerAddressCountry(ctx) + case billinginvoice.FieldCustomerAddressPostalCode: + return m.OldCustomerAddressPostalCode(ctx) + case billinginvoice.FieldCustomerAddressState: + return m.OldCustomerAddressState(ctx) + case billinginvoice.FieldCustomerAddressCity: + return m.OldCustomerAddressCity(ctx) + case billinginvoice.FieldCustomerAddressLine1: + return m.OldCustomerAddressLine1(ctx) + case billinginvoice.FieldCustomerAddressLine2: + return m.OldCustomerAddressLine2(ctx) + case billinginvoice.FieldCustomerAddressPhoneNumber: + return m.OldCustomerAddressPhoneNumber(ctx) + case billinginvoice.FieldSupplierName: + return m.OldSupplierName(ctx) + case billinginvoice.FieldSupplierTaxCode: + return m.OldSupplierTaxCode(ctx) + case billinginvoice.FieldCustomerName: + return m.OldCustomerName(ctx) + case billinginvoice.FieldCustomerTimezone: + return m.OldCustomerTimezone(ctx) + case billinginvoice.FieldNumber: + return m.OldNumber(ctx) + case billinginvoice.FieldType: + return m.OldType(ctx) + case billinginvoice.FieldDescription: + return m.OldDescription(ctx) + case billinginvoice.FieldCustomerID: + return m.OldCustomerID(ctx) + case billinginvoice.FieldSourceBillingProfileID: + return m.OldSourceBillingProfileID(ctx) + case billinginvoice.FieldVoidedAt: + return m.OldVoidedAt(ctx) + case billinginvoice.FieldIssuedAt: + return m.OldIssuedAt(ctx) + case billinginvoice.FieldCurrency: + return m.OldCurrency(ctx) + case billinginvoice.FieldDueAt: + return m.OldDueAt(ctx) + case billinginvoice.FieldStatus: + return m.OldStatus(ctx) + case billinginvoice.FieldWorkflowConfigID: + return m.OldWorkflowConfigID(ctx) + case billinginvoice.FieldTaxAppID: + return m.OldTaxAppID(ctx) + case billinginvoice.FieldInvoicingAppID: + return m.OldInvoicingAppID(ctx) + case billinginvoice.FieldPaymentAppID: + return m.OldPaymentAppID(ctx) + case billinginvoice.FieldPeriodStart: + return m.OldPeriodStart(ctx) + case billinginvoice.FieldPeriodEnd: + return m.OldPeriodEnd(ctx) + } + return nil, fmt.Errorf("unknown BillingInvoice field %s", name) +} + +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BillingInvoiceMutation) SetField(name string, value ent.Value) error { + switch name { + case billinginvoice.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case billinginvoice.FieldMetadata: + v, ok := value.(map[string]string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetMetadata(v) + return nil + case billinginvoice.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case billinginvoice.FieldUpdatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedAt(v) + return nil + case billinginvoice.FieldDeletedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDeletedAt(v) + return nil + case billinginvoice.FieldSupplierAddressCountry: + v, ok := value.(models.CountryCode) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressCountry(v) + return nil + case billinginvoice.FieldSupplierAddressPostalCode: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressPostalCode(v) + return nil + case billinginvoice.FieldSupplierAddressState: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressState(v) + return nil + case billinginvoice.FieldSupplierAddressCity: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressCity(v) + return nil + case billinginvoice.FieldSupplierAddressLine1: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressLine1(v) + return nil + case billinginvoice.FieldSupplierAddressLine2: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressLine2(v) + return nil + case billinginvoice.FieldSupplierAddressPhoneNumber: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierAddressPhoneNumber(v) + return nil + case billinginvoice.FieldCustomerAddressCountry: + v, ok := value.(models.CountryCode) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressCountry(v) + return nil + case billinginvoice.FieldCustomerAddressPostalCode: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressPostalCode(v) + return nil + case billinginvoice.FieldCustomerAddressState: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressState(v) + return nil + case billinginvoice.FieldCustomerAddressCity: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressCity(v) + return nil + case billinginvoice.FieldCustomerAddressLine1: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressLine1(v) + return nil + case billinginvoice.FieldCustomerAddressLine2: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressLine2(v) + return nil + case billinginvoice.FieldCustomerAddressPhoneNumber: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerAddressPhoneNumber(v) + return nil + case billinginvoice.FieldSupplierName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierName(v) + return nil + case billinginvoice.FieldSupplierTaxCode: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSupplierTaxCode(v) + return nil + case billinginvoice.FieldCustomerName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerName(v) + return nil + case billinginvoice.FieldCustomerTimezone: + v, ok := value.(timezone.Timezone) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerTimezone(v) + return nil + case billinginvoice.FieldNumber: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNumber(v) + return nil + case billinginvoice.FieldType: + v, ok := value.(billingentity.InvoiceType) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetType(v) + return nil + case billinginvoice.FieldDescription: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDescription(v) + return nil + case billinginvoice.FieldCustomerID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCustomerID(v) + return nil + case billinginvoice.FieldSourceBillingProfileID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetSourceBillingProfileID(v) + return nil + case billinginvoice.FieldVoidedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetVoidedAt(v) + return nil + case billinginvoice.FieldIssuedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetIssuedAt(v) + return nil + case billinginvoice.FieldCurrency: + v, ok := value.(currencyx.Code) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCurrency(v) + return nil + case billinginvoice.FieldDueAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDueAt(v) + return nil + case billinginvoice.FieldStatus: + v, ok := value.(billingentity.InvoiceStatus) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatus(v) + return nil + case billinginvoice.FieldWorkflowConfigID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetWorkflowConfigID(v) + return nil + case billinginvoice.FieldTaxAppID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTaxAppID(v) + return nil + case billinginvoice.FieldInvoicingAppID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetInvoicingAppID(v) + return nil + case billinginvoice.FieldPaymentAppID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPaymentAppID(v) + return nil + case billinginvoice.FieldPeriodStart: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPeriodStart(v) + return nil + case billinginvoice.FieldPeriodEnd: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPeriodEnd(v) + return nil + } + return fmt.Errorf("unknown BillingInvoice field %s", name) +} + +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *BillingInvoiceMutation) AddedFields() []string { + return nil +} + +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *BillingInvoiceMutation) AddedField(name string) (ent.Value, bool) { + return nil, false +} + +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BillingInvoiceMutation) AddField(name string, value ent.Value) error { + switch name { + } + return fmt.Errorf("unknown BillingInvoice numeric field %s", name) +} + +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *BillingInvoiceMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(billinginvoice.FieldMetadata) { + fields = append(fields, billinginvoice.FieldMetadata) + } + if m.FieldCleared(billinginvoice.FieldDeletedAt) { + fields = append(fields, billinginvoice.FieldDeletedAt) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressCountry) { + fields = append(fields, billinginvoice.FieldSupplierAddressCountry) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressPostalCode) { + fields = append(fields, billinginvoice.FieldSupplierAddressPostalCode) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressState) { + fields = append(fields, billinginvoice.FieldSupplierAddressState) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressCity) { + fields = append(fields, billinginvoice.FieldSupplierAddressCity) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressLine1) { + fields = append(fields, billinginvoice.FieldSupplierAddressLine1) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressLine2) { + fields = append(fields, billinginvoice.FieldSupplierAddressLine2) + } + if m.FieldCleared(billinginvoice.FieldSupplierAddressPhoneNumber) { + fields = append(fields, billinginvoice.FieldSupplierAddressPhoneNumber) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressCountry) { + fields = append(fields, billinginvoice.FieldCustomerAddressCountry) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressPostalCode) { + fields = append(fields, billinginvoice.FieldCustomerAddressPostalCode) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressState) { + fields = append(fields, billinginvoice.FieldCustomerAddressState) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressCity) { + fields = append(fields, billinginvoice.FieldCustomerAddressCity) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressLine1) { + fields = append(fields, billinginvoice.FieldCustomerAddressLine1) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressLine2) { + fields = append(fields, billinginvoice.FieldCustomerAddressLine2) + } + if m.FieldCleared(billinginvoice.FieldCustomerAddressPhoneNumber) { + fields = append(fields, billinginvoice.FieldCustomerAddressPhoneNumber) + } + if m.FieldCleared(billinginvoice.FieldSupplierTaxCode) { + fields = append(fields, billinginvoice.FieldSupplierTaxCode) + } + if m.FieldCleared(billinginvoice.FieldCustomerTimezone) { + fields = append(fields, billinginvoice.FieldCustomerTimezone) + } + if m.FieldCleared(billinginvoice.FieldNumber) { + fields = append(fields, billinginvoice.FieldNumber) + } + if m.FieldCleared(billinginvoice.FieldDescription) { + fields = append(fields, billinginvoice.FieldDescription) + } + if m.FieldCleared(billinginvoice.FieldVoidedAt) { + fields = append(fields, billinginvoice.FieldVoidedAt) + } + if m.FieldCleared(billinginvoice.FieldIssuedAt) { + fields = append(fields, billinginvoice.FieldIssuedAt) + } + if m.FieldCleared(billinginvoice.FieldDueAt) { + fields = append(fields, billinginvoice.FieldDueAt) + } + if m.FieldCleared(billinginvoice.FieldPeriodStart) { + fields = append(fields, billinginvoice.FieldPeriodStart) + } + if m.FieldCleared(billinginvoice.FieldPeriodEnd) { + fields = append(fields, billinginvoice.FieldPeriodEnd) + } + return fields +} + +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *BillingInvoiceMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok +} + +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *BillingInvoiceMutation) ClearField(name string) error { + switch name { + case billinginvoice.FieldMetadata: + m.ClearMetadata() + return nil + case billinginvoice.FieldDeletedAt: + m.ClearDeletedAt() + return nil + case billinginvoice.FieldSupplierAddressCountry: + m.ClearSupplierAddressCountry() + return nil + case billinginvoice.FieldSupplierAddressPostalCode: + m.ClearSupplierAddressPostalCode() + return nil + case billinginvoice.FieldSupplierAddressState: + m.ClearSupplierAddressState() + return nil + case billinginvoice.FieldSupplierAddressCity: + m.ClearSupplierAddressCity() + return nil + case billinginvoice.FieldSupplierAddressLine1: + m.ClearSupplierAddressLine1() + return nil + case billinginvoice.FieldSupplierAddressLine2: + m.ClearSupplierAddressLine2() + return nil + case billinginvoice.FieldSupplierAddressPhoneNumber: + m.ClearSupplierAddressPhoneNumber() + return nil + case billinginvoice.FieldCustomerAddressCountry: + m.ClearCustomerAddressCountry() + return nil + case billinginvoice.FieldCustomerAddressPostalCode: + m.ClearCustomerAddressPostalCode() + return nil + case billinginvoice.FieldCustomerAddressState: + m.ClearCustomerAddressState() + return nil + case billinginvoice.FieldCustomerAddressCity: + m.ClearCustomerAddressCity() + return nil + case billinginvoice.FieldCustomerAddressLine1: + m.ClearCustomerAddressLine1() + return nil + case billinginvoice.FieldCustomerAddressLine2: + m.ClearCustomerAddressLine2() + return nil + case billinginvoice.FieldCustomerAddressPhoneNumber: + m.ClearCustomerAddressPhoneNumber() + return nil + case billinginvoice.FieldSupplierTaxCode: + m.ClearSupplierTaxCode() + return nil + case billinginvoice.FieldCustomerTimezone: + m.ClearCustomerTimezone() + return nil + case billinginvoice.FieldNumber: + m.ClearNumber() + return nil + case billinginvoice.FieldDescription: + m.ClearDescription() + return nil + case billinginvoice.FieldVoidedAt: + m.ClearVoidedAt() + return nil + case billinginvoice.FieldIssuedAt: + m.ClearIssuedAt() + return nil + case billinginvoice.FieldDueAt: + m.ClearDueAt() + return nil + case billinginvoice.FieldPeriodStart: + m.ClearPeriodStart() + return nil + case billinginvoice.FieldPeriodEnd: + m.ClearPeriodEnd() + return nil + } + return fmt.Errorf("unknown BillingInvoice nullable field %s", name) +} + +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *BillingInvoiceMutation) ResetField(name string) error { + switch name { + case billinginvoice.FieldNamespace: + m.ResetNamespace() + return nil + case billinginvoice.FieldMetadata: + m.ResetMetadata() + return nil case billinginvoice.FieldCreatedAt: - return m.OldCreatedAt(ctx) + m.ResetCreatedAt() + return nil case billinginvoice.FieldUpdatedAt: - return m.OldUpdatedAt(ctx) + m.ResetUpdatedAt() + return nil case billinginvoice.FieldDeletedAt: - return m.OldDeletedAt(ctx) - case billinginvoice.FieldMetadata: - return m.OldMetadata(ctx) - case billinginvoice.FieldSeries: - return m.OldSeries(ctx) - case billinginvoice.FieldCode: - return m.OldCode(ctx) + m.ResetDeletedAt() + return nil + case billinginvoice.FieldSupplierAddressCountry: + m.ResetSupplierAddressCountry() + return nil + case billinginvoice.FieldSupplierAddressPostalCode: + m.ResetSupplierAddressPostalCode() + return nil + case billinginvoice.FieldSupplierAddressState: + m.ResetSupplierAddressState() + return nil + case billinginvoice.FieldSupplierAddressCity: + m.ResetSupplierAddressCity() + return nil + case billinginvoice.FieldSupplierAddressLine1: + m.ResetSupplierAddressLine1() + return nil + case billinginvoice.FieldSupplierAddressLine2: + m.ResetSupplierAddressLine2() + return nil + case billinginvoice.FieldSupplierAddressPhoneNumber: + m.ResetSupplierAddressPhoneNumber() + return nil + case billinginvoice.FieldCustomerAddressCountry: + m.ResetCustomerAddressCountry() + return nil + case billinginvoice.FieldCustomerAddressPostalCode: + m.ResetCustomerAddressPostalCode() + return nil + case billinginvoice.FieldCustomerAddressState: + m.ResetCustomerAddressState() + return nil + case billinginvoice.FieldCustomerAddressCity: + m.ResetCustomerAddressCity() + return nil + case billinginvoice.FieldCustomerAddressLine1: + m.ResetCustomerAddressLine1() + return nil + case billinginvoice.FieldCustomerAddressLine2: + m.ResetCustomerAddressLine2() + return nil + case billinginvoice.FieldCustomerAddressPhoneNumber: + m.ResetCustomerAddressPhoneNumber() + return nil + case billinginvoice.FieldSupplierName: + m.ResetSupplierName() + return nil + case billinginvoice.FieldSupplierTaxCode: + m.ResetSupplierTaxCode() + return nil + case billinginvoice.FieldCustomerName: + m.ResetCustomerName() + return nil + case billinginvoice.FieldCustomerTimezone: + m.ResetCustomerTimezone() + return nil + case billinginvoice.FieldNumber: + m.ResetNumber() + return nil + case billinginvoice.FieldType: + m.ResetType() + return nil + case billinginvoice.FieldDescription: + m.ResetDescription() + return nil case billinginvoice.FieldCustomerID: - return m.OldCustomerID(ctx) - case billinginvoice.FieldBillingProfileID: - return m.OldBillingProfileID(ctx) + m.ResetCustomerID() + return nil + case billinginvoice.FieldSourceBillingProfileID: + m.ResetSourceBillingProfileID() + return nil case billinginvoice.FieldVoidedAt: - return m.OldVoidedAt(ctx) + m.ResetVoidedAt() + return nil + case billinginvoice.FieldIssuedAt: + m.ResetIssuedAt() + return nil case billinginvoice.FieldCurrency: - return m.OldCurrency(ctx) - case billinginvoice.FieldDueDate: - return m.OldDueDate(ctx) + m.ResetCurrency() + return nil + case billinginvoice.FieldDueAt: + m.ResetDueAt() + return nil case billinginvoice.FieldStatus: - return m.OldStatus(ctx) + m.ResetStatus() + return nil case billinginvoice.FieldWorkflowConfigID: - return m.OldWorkflowConfigID(ctx) + m.ResetWorkflowConfigID() + return nil + case billinginvoice.FieldTaxAppID: + m.ResetTaxAppID() + return nil + case billinginvoice.FieldInvoicingAppID: + m.ResetInvoicingAppID() + return nil + case billinginvoice.FieldPaymentAppID: + m.ResetPaymentAppID() + return nil case billinginvoice.FieldPeriodStart: - return m.OldPeriodStart(ctx) + m.ResetPeriodStart() + return nil case billinginvoice.FieldPeriodEnd: - return m.OldPeriodEnd(ctx) + m.ResetPeriodEnd() + return nil } - return nil, fmt.Errorf("unknown BillingInvoice field %s", name) + return fmt.Errorf("unknown BillingInvoice field %s", name) } -// SetField sets the value of a field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *BillingInvoiceMutation) SetField(name string, value ent.Value) error { +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *BillingInvoiceMutation) AddedEdges() []string { + edges := make([]string, 0, 7) + if m.source_billing_profile != nil { + edges = append(edges, billinginvoice.EdgeSourceBillingProfile) + } + if m.billing_workflow_config != nil { + edges = append(edges, billinginvoice.EdgeBillingWorkflowConfig) + } + if m.billing_invoice_lines != nil { + edges = append(edges, billinginvoice.EdgeBillingInvoiceLines) + } + if m.billing_invoice_customer != nil { + edges = append(edges, billinginvoice.EdgeBillingInvoiceCustomer) + } + if m.tax_app != nil { + edges = append(edges, billinginvoice.EdgeTaxApp) + } + if m.invoicing_app != nil { + edges = append(edges, billinginvoice.EdgeInvoicingApp) + } + if m.payment_app != nil { + edges = append(edges, billinginvoice.EdgePaymentApp) + } + return edges +} + +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *BillingInvoiceMutation) AddedIDs(name string) []ent.Value { switch name { - case billinginvoice.FieldNamespace: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeSourceBillingProfile: + if id := m.source_billing_profile; id != nil { + return []ent.Value{*id} } - m.SetNamespace(v) - return nil - case billinginvoice.FieldCreatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeBillingWorkflowConfig: + if id := m.billing_workflow_config; id != nil { + return []ent.Value{*id} } - m.SetCreatedAt(v) - return nil - case billinginvoice.FieldUpdatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeBillingInvoiceLines: + ids := make([]ent.Value, 0, len(m.billing_invoice_lines)) + for id := range m.billing_invoice_lines { + ids = append(ids, id) } - m.SetUpdatedAt(v) - return nil - case billinginvoice.FieldDeletedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + return ids + case billinginvoice.EdgeBillingInvoiceCustomer: + if id := m.billing_invoice_customer; id != nil { + return []ent.Value{*id} } - m.SetDeletedAt(v) - return nil - case billinginvoice.FieldMetadata: - v, ok := value.(map[string]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeTaxApp: + if id := m.tax_app; id != nil { + return []ent.Value{*id} } - m.SetMetadata(v) - return nil - case billinginvoice.FieldSeries: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeInvoicingApp: + if id := m.invoicing_app; id != nil { + return []ent.Value{*id} } - m.SetSeries(v) - return nil - case billinginvoice.FieldCode: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgePaymentApp: + if id := m.payment_app; id != nil { + return []ent.Value{*id} } - m.SetCode(v) - return nil - case billinginvoice.FieldCustomerID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + } + return nil +} + +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *BillingInvoiceMutation) RemovedEdges() []string { + edges := make([]string, 0, 7) + if m.removedbilling_invoice_lines != nil { + edges = append(edges, billinginvoice.EdgeBillingInvoiceLines) + } + return edges +} + +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *BillingInvoiceMutation) RemovedIDs(name string) []ent.Value { + switch name { + case billinginvoice.EdgeBillingInvoiceLines: + ids := make([]ent.Value, 0, len(m.removedbilling_invoice_lines)) + for id := range m.removedbilling_invoice_lines { + ids = append(ids, id) } - m.SetCustomerID(v) + return ids + } + return nil +} + +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *BillingInvoiceMutation) ClearedEdges() []string { + edges := make([]string, 0, 7) + if m.clearedsource_billing_profile { + edges = append(edges, billinginvoice.EdgeSourceBillingProfile) + } + if m.clearedbilling_workflow_config { + edges = append(edges, billinginvoice.EdgeBillingWorkflowConfig) + } + if m.clearedbilling_invoice_lines { + edges = append(edges, billinginvoice.EdgeBillingInvoiceLines) + } + if m.clearedbilling_invoice_customer { + edges = append(edges, billinginvoice.EdgeBillingInvoiceCustomer) + } + if m.clearedtax_app { + edges = append(edges, billinginvoice.EdgeTaxApp) + } + if m.clearedinvoicing_app { + edges = append(edges, billinginvoice.EdgeInvoicingApp) + } + if m.clearedpayment_app { + edges = append(edges, billinginvoice.EdgePaymentApp) + } + return edges +} + +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *BillingInvoiceMutation) EdgeCleared(name string) bool { + switch name { + case billinginvoice.EdgeSourceBillingProfile: + return m.clearedsource_billing_profile + case billinginvoice.EdgeBillingWorkflowConfig: + return m.clearedbilling_workflow_config + case billinginvoice.EdgeBillingInvoiceLines: + return m.clearedbilling_invoice_lines + case billinginvoice.EdgeBillingInvoiceCustomer: + return m.clearedbilling_invoice_customer + case billinginvoice.EdgeTaxApp: + return m.clearedtax_app + case billinginvoice.EdgeInvoicingApp: + return m.clearedinvoicing_app + case billinginvoice.EdgePaymentApp: + return m.clearedpayment_app + } + return false +} + +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *BillingInvoiceMutation) ClearEdge(name string) error { + switch name { + case billinginvoice.EdgeSourceBillingProfile: + m.ClearSourceBillingProfile() return nil - case billinginvoice.FieldBillingProfileID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetBillingProfileID(v) + case billinginvoice.EdgeBillingWorkflowConfig: + m.ClearBillingWorkflowConfig() return nil - case billinginvoice.FieldVoidedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetVoidedAt(v) + case billinginvoice.EdgeBillingInvoiceCustomer: + m.ClearBillingInvoiceCustomer() return nil - case billinginvoice.FieldCurrency: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCurrency(v) + case billinginvoice.EdgeTaxApp: + m.ClearTaxApp() return nil - case billinginvoice.FieldDueDate: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDueDate(v) + case billinginvoice.EdgeInvoicingApp: + m.ClearInvoicingApp() return nil - case billinginvoice.FieldStatus: - v, ok := value.(billingentity.InvoiceStatus) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetStatus(v) + case billinginvoice.EdgePaymentApp: + m.ClearPaymentApp() return nil - case billinginvoice.FieldWorkflowConfigID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetWorkflowConfigID(v) + } + return fmt.Errorf("unknown BillingInvoice unique edge %s", name) +} + +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *BillingInvoiceMutation) ResetEdge(name string) error { + switch name { + case billinginvoice.EdgeSourceBillingProfile: + m.ResetSourceBillingProfile() return nil - case billinginvoice.FieldPeriodStart: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPeriodStart(v) + case billinginvoice.EdgeBillingWorkflowConfig: + m.ResetBillingWorkflowConfig() return nil - case billinginvoice.FieldPeriodEnd: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) + case billinginvoice.EdgeBillingInvoiceLines: + m.ResetBillingInvoiceLines() + return nil + case billinginvoice.EdgeBillingInvoiceCustomer: + m.ResetBillingInvoiceCustomer() + return nil + case billinginvoice.EdgeTaxApp: + m.ResetTaxApp() + return nil + case billinginvoice.EdgeInvoicingApp: + m.ResetInvoicingApp() + return nil + case billinginvoice.EdgePaymentApp: + m.ResetPaymentApp() + return nil + } + return fmt.Errorf("unknown BillingInvoice edge %s", name) +} + +// BillingInvoiceLineMutation represents an operation that mutates the BillingInvoiceLine nodes in the graph. +type BillingInvoiceLineMutation struct { + config + op Op + typ string + id *string + namespace *string + metadata *map[string]string + created_at *time.Time + updated_at *time.Time + deleted_at *time.Time + name *string + description *string + period_start *time.Time + period_end *time.Time + invoice_at *time.Time + _type *billingentity.InvoiceLineType + status *billingentity.InvoiceLineStatus + currency *currencyx.Code + quantity *alpacadecimal.Decimal + tax_overrides **billingentity.TaxOverrides + clearedFields map[string]struct{} + billing_invoice *string + clearedbilling_invoice bool + billing_invoice_manual_lines *string + clearedbilling_invoice_manual_lines bool + done bool + oldValue func(context.Context) (*BillingInvoiceLine, error) + predicates []predicate.BillingInvoiceLine +} + +var _ ent.Mutation = (*BillingInvoiceLineMutation)(nil) + +// billinginvoicelineOption allows management of the mutation configuration using functional options. +type billinginvoicelineOption func(*BillingInvoiceLineMutation) + +// newBillingInvoiceLineMutation creates new mutation for the BillingInvoiceLine entity. +func newBillingInvoiceLineMutation(c config, op Op, opts ...billinginvoicelineOption) *BillingInvoiceLineMutation { + m := &BillingInvoiceLineMutation{ + config: c, + op: op, + typ: TypeBillingInvoiceLine, + clearedFields: make(map[string]struct{}), + } + for _, opt := range opts { + opt(m) + } + return m +} + +// withBillingInvoiceLineID sets the ID field of the mutation. +func withBillingInvoiceLineID(id string) billinginvoicelineOption { + return func(m *BillingInvoiceLineMutation) { + var ( + err error + once sync.Once + value *BillingInvoiceLine + ) + m.oldValue = func(ctx context.Context) (*BillingInvoiceLine, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().BillingInvoiceLine.Get(ctx, id) + } + }) + return value, err } - m.SetPeriodEnd(v) - return nil + m.id = &id } - return fmt.Errorf("unknown BillingInvoice field %s", name) } -// AddedFields returns all numeric fields that were incremented/decremented during -// this mutation. -func (m *BillingInvoiceMutation) AddedFields() []string { - return nil +// withBillingInvoiceLine sets the old BillingInvoiceLine of the mutation. +func withBillingInvoiceLine(node *BillingInvoiceLine) billinginvoicelineOption { + return func(m *BillingInvoiceLineMutation) { + m.oldValue = func(context.Context) (*BillingInvoiceLine, error) { + return node, nil + } + m.id = &node.ID + } } -// AddedField returns the numeric value that was incremented/decremented on a field -// with the given name. The second boolean return value indicates that this field -// was not set, or was not defined in the schema. -func (m *BillingInvoiceMutation) AddedField(name string) (ent.Value, bool) { - return nil, false +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m BillingInvoiceLineMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client } -// AddField adds the value to the field with the given name. It returns an error if -// the field is not defined in the schema, or if the type mismatched the field -// type. -func (m *BillingInvoiceMutation) AddField(name string, value ent.Value) error { - switch name { +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m BillingInvoiceLineMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("db: mutation is not running in a transaction") } - return fmt.Errorf("unknown BillingInvoice numeric field %s", name) + tx := &Tx{config: m.config} + tx.init() + return tx, nil } -// ClearedFields returns all nullable fields that were cleared during this -// mutation. -func (m *BillingInvoiceMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(billinginvoice.FieldDeletedAt) { - fields = append(fields, billinginvoice.FieldDeletedAt) +// SetID sets the value of the id field. Note that this +// operation is only accepted on creation of BillingInvoiceLine entities. +func (m *BillingInvoiceLineMutation) SetID(id string) { + m.id = &id +} + +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *BillingInvoiceLineMutation) ID() (id string, exists bool) { + if m.id == nil { + return } - if m.FieldCleared(billinginvoice.FieldMetadata) { - fields = append(fields, billinginvoice.FieldMetadata) + return *m.id, true +} + +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *BillingInvoiceLineMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().BillingInvoiceLine.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) + } +} + +// SetNamespace sets the "namespace" field. +func (m *BillingInvoiceLineMutation) SetNamespace(s string) { + m.namespace = &s +} + +// Namespace returns the value of the "namespace" field in the mutation. +func (m *BillingInvoiceLineMutation) Namespace() (r string, exists bool) { + v := m.namespace + if v == nil { + return } - if m.FieldCleared(billinginvoice.FieldSeries) { - fields = append(fields, billinginvoice.FieldSeries) + return *v, true +} + +// OldNamespace returns the old "namespace" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldNamespace(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } - if m.FieldCleared(billinginvoice.FieldCode) { - fields = append(fields, billinginvoice.FieldCode) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldNamespace requires an ID field in the mutation") } - if m.FieldCleared(billinginvoice.FieldVoidedAt) { - fields = append(fields, billinginvoice.FieldVoidedAt) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) } - return fields + return oldValue.Namespace, nil } -// FieldCleared returns a boolean indicating if a field with the given name was -// cleared in this mutation. -func (m *BillingInvoiceMutation) FieldCleared(name string) bool { - _, ok := m.clearedFields[name] +// ResetNamespace resets all changes to the "namespace" field. +func (m *BillingInvoiceLineMutation) ResetNamespace() { + m.namespace = nil +} + +// SetMetadata sets the "metadata" field. +func (m *BillingInvoiceLineMutation) SetMetadata(value map[string]string) { + m.metadata = &value +} + +// Metadata returns the value of the "metadata" field in the mutation. +func (m *BillingInvoiceLineMutation) Metadata() (r map[string]string, exists bool) { + v := m.metadata + if v == nil { + return + } + return *v, true +} + +// OldMetadata returns the old "metadata" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldMetadata(ctx context.Context) (v map[string]string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldMetadata is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldMetadata requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldMetadata: %w", err) + } + return oldValue.Metadata, nil +} + +// ClearMetadata clears the value of the "metadata" field. +func (m *BillingInvoiceLineMutation) ClearMetadata() { + m.metadata = nil + m.clearedFields[billinginvoiceline.FieldMetadata] = struct{}{} +} + +// MetadataCleared returns if the "metadata" field was cleared in this mutation. +func (m *BillingInvoiceLineMutation) MetadataCleared() bool { + _, ok := m.clearedFields[billinginvoiceline.FieldMetadata] return ok } -// ClearField clears the value of the field with the given name. It returns an -// error if the field is not defined in the schema. -func (m *BillingInvoiceMutation) ClearField(name string) error { - switch name { - case billinginvoice.FieldDeletedAt: - m.ClearDeletedAt() - return nil - case billinginvoice.FieldMetadata: - m.ClearMetadata() - return nil - case billinginvoice.FieldSeries: - m.ClearSeries() - return nil - case billinginvoice.FieldCode: - m.ClearCode() - return nil - case billinginvoice.FieldVoidedAt: - m.ClearVoidedAt() - return nil +// ResetMetadata resets all changes to the "metadata" field. +func (m *BillingInvoiceLineMutation) ResetMetadata() { + m.metadata = nil + delete(m.clearedFields, billinginvoiceline.FieldMetadata) +} + +// SetCreatedAt sets the "created_at" field. +func (m *BillingInvoiceLineMutation) SetCreatedAt(t time.Time) { + m.created_at = &t +} + +// CreatedAt returns the value of the "created_at" field in the mutation. +func (m *BillingInvoiceLineMutation) CreatedAt() (r time.Time, exists bool) { + v := m.created_at + if v == nil { + return } - return fmt.Errorf("unknown BillingInvoice nullable field %s", name) + return *v, true } -// ResetField resets all changes in the mutation for the field with the given name. -// It returns an error if the field is not defined in the schema. -func (m *BillingInvoiceMutation) ResetField(name string) error { - switch name { - case billinginvoice.FieldNamespace: - m.ResetNamespace() - return nil - case billinginvoice.FieldCreatedAt: - m.ResetCreatedAt() - return nil - case billinginvoice.FieldUpdatedAt: - m.ResetUpdatedAt() - return nil - case billinginvoice.FieldDeletedAt: - m.ResetDeletedAt() - return nil - case billinginvoice.FieldMetadata: - m.ResetMetadata() - return nil - case billinginvoice.FieldSeries: - m.ResetSeries() - return nil - case billinginvoice.FieldCode: - m.ResetCode() - return nil - case billinginvoice.FieldCustomerID: - m.ResetCustomerID() - return nil - case billinginvoice.FieldBillingProfileID: - m.ResetBillingProfileID() - return nil - case billinginvoice.FieldVoidedAt: - m.ResetVoidedAt() - return nil - case billinginvoice.FieldCurrency: - m.ResetCurrency() - return nil - case billinginvoice.FieldDueDate: - m.ResetDueDate() - return nil - case billinginvoice.FieldStatus: - m.ResetStatus() - return nil - case billinginvoice.FieldWorkflowConfigID: - m.ResetWorkflowConfigID() - return nil - case billinginvoice.FieldPeriodStart: - m.ResetPeriodStart() - return nil - case billinginvoice.FieldPeriodEnd: - m.ResetPeriodEnd() - return nil +// OldCreatedAt returns the old "created_at" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCreatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + } + return oldValue.CreatedAt, nil +} + +// ResetCreatedAt resets all changes to the "created_at" field. +func (m *BillingInvoiceLineMutation) ResetCreatedAt() { + m.created_at = nil +} + +// SetUpdatedAt sets the "updated_at" field. +func (m *BillingInvoiceLineMutation) SetUpdatedAt(t time.Time) { + m.updated_at = &t +} + +// UpdatedAt returns the value of the "updated_at" field in the mutation. +func (m *BillingInvoiceLineMutation) UpdatedAt() (r time.Time, exists bool) { + v := m.updated_at + if v == nil { + return + } + return *v, true +} + +// OldUpdatedAt returns the old "updated_at" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldUpdatedAt requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err) + } + return oldValue.UpdatedAt, nil +} + +// ResetUpdatedAt resets all changes to the "updated_at" field. +func (m *BillingInvoiceLineMutation) ResetUpdatedAt() { + m.updated_at = nil +} + +// SetDeletedAt sets the "deleted_at" field. +func (m *BillingInvoiceLineMutation) SetDeletedAt(t time.Time) { + m.deleted_at = &t +} + +// DeletedAt returns the value of the "deleted_at" field in the mutation. +func (m *BillingInvoiceLineMutation) DeletedAt() (r time.Time, exists bool) { + v := m.deleted_at + if v == nil { + return } - return fmt.Errorf("unknown BillingInvoice field %s", name) + return *v, true } -// AddedEdges returns all edge names that were set/added in this mutation. -func (m *BillingInvoiceMutation) AddedEdges() []string { - edges := make([]string, 0, 3) - if m.billing_profile != nil { - edges = append(edges, billinginvoice.EdgeBillingProfile) +// OldDeletedAt returns the old "deleted_at" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations") } - if m.billing_workflow_config != nil { - edges = append(edges, billinginvoice.EdgeBillingWorkflowConfig) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDeletedAt requires an ID field in the mutation") } - if m.billing_invoice_items != nil { - edges = append(edges, billinginvoice.EdgeBillingInvoiceItems) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err) } - return edges + return oldValue.DeletedAt, nil } -// AddedIDs returns all IDs (to other nodes) that were added for the given edge -// name in this mutation. -func (m *BillingInvoiceMutation) AddedIDs(name string) []ent.Value { - switch name { - case billinginvoice.EdgeBillingProfile: - if id := m.billing_profile; id != nil { - return []ent.Value{*id} - } - case billinginvoice.EdgeBillingWorkflowConfig: - if id := m.billing_workflow_config; id != nil { - return []ent.Value{*id} - } - case billinginvoice.EdgeBillingInvoiceItems: - ids := make([]ent.Value, 0, len(m.billing_invoice_items)) - for id := range m.billing_invoice_items { - ids = append(ids, id) - } - return ids - } - return nil +// ClearDeletedAt clears the value of the "deleted_at" field. +func (m *BillingInvoiceLineMutation) ClearDeletedAt() { + m.deleted_at = nil + m.clearedFields[billinginvoiceline.FieldDeletedAt] = struct{}{} } -// RemovedEdges returns all edge names that were removed in this mutation. -func (m *BillingInvoiceMutation) RemovedEdges() []string { - edges := make([]string, 0, 3) - if m.removedbilling_invoice_items != nil { - edges = append(edges, billinginvoice.EdgeBillingInvoiceItems) - } - return edges +// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation. +func (m *BillingInvoiceLineMutation) DeletedAtCleared() bool { + _, ok := m.clearedFields[billinginvoiceline.FieldDeletedAt] + return ok } -// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with -// the given name in this mutation. -func (m *BillingInvoiceMutation) RemovedIDs(name string) []ent.Value { - switch name { - case billinginvoice.EdgeBillingInvoiceItems: - ids := make([]ent.Value, 0, len(m.removedbilling_invoice_items)) - for id := range m.removedbilling_invoice_items { - ids = append(ids, id) - } - return ids +// ResetDeletedAt resets all changes to the "deleted_at" field. +func (m *BillingInvoiceLineMutation) ResetDeletedAt() { + m.deleted_at = nil + delete(m.clearedFields, billinginvoiceline.FieldDeletedAt) +} + +// SetName sets the "name" field. +func (m *BillingInvoiceLineMutation) SetName(s string) { + m.name = &s +} + +// Name returns the value of the "name" field in the mutation. +func (m *BillingInvoiceLineMutation) Name() (r string, exists bool) { + v := m.name + if v == nil { + return } - return nil + return *v, true } -// ClearedEdges returns all edge names that were cleared in this mutation. -func (m *BillingInvoiceMutation) ClearedEdges() []string { - edges := make([]string, 0, 3) - if m.clearedbilling_profile { - edges = append(edges, billinginvoice.EdgeBillingProfile) +// OldName returns the old "name" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldName(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldName is only allowed on UpdateOne operations") } - if m.clearedbilling_workflow_config { - edges = append(edges, billinginvoice.EdgeBillingWorkflowConfig) + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldName requires an ID field in the mutation") } - if m.clearedbilling_invoice_items { - edges = append(edges, billinginvoice.EdgeBillingInvoiceItems) + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldName: %w", err) } - return edges + return oldValue.Name, nil } -// EdgeCleared returns a boolean which indicates if the edge with the given name -// was cleared in this mutation. -func (m *BillingInvoiceMutation) EdgeCleared(name string) bool { - switch name { - case billinginvoice.EdgeBillingProfile: - return m.clearedbilling_profile - case billinginvoice.EdgeBillingWorkflowConfig: - return m.clearedbilling_workflow_config - case billinginvoice.EdgeBillingInvoiceItems: - return m.clearedbilling_invoice_items - } - return false +// ResetName resets all changes to the "name" field. +func (m *BillingInvoiceLineMutation) ResetName() { + m.name = nil } -// ClearEdge clears the value of the edge with the given name. It returns an error -// if that edge is not defined in the schema. -func (m *BillingInvoiceMutation) ClearEdge(name string) error { - switch name { - case billinginvoice.EdgeBillingProfile: - m.ClearBillingProfile() - return nil - case billinginvoice.EdgeBillingWorkflowConfig: - m.ClearBillingWorkflowConfig() - return nil - } - return fmt.Errorf("unknown BillingInvoice unique edge %s", name) +// SetDescription sets the "description" field. +func (m *BillingInvoiceLineMutation) SetDescription(s string) { + m.description = &s } -// ResetEdge resets all changes to the edge with the given name in this mutation. -// It returns an error if the edge is not defined in the schema. -func (m *BillingInvoiceMutation) ResetEdge(name string) error { - switch name { - case billinginvoice.EdgeBillingProfile: - m.ResetBillingProfile() - return nil - case billinginvoice.EdgeBillingWorkflowConfig: - m.ResetBillingWorkflowConfig() - return nil - case billinginvoice.EdgeBillingInvoiceItems: - m.ResetBillingInvoiceItems() - return nil +// Description returns the value of the "description" field in the mutation. +func (m *BillingInvoiceLineMutation) Description() (r string, exists bool) { + v := m.description + if v == nil { + return } - return fmt.Errorf("unknown BillingInvoice edge %s", name) + return *v, true } -// BillingInvoiceItemMutation represents an operation that mutates the BillingInvoiceItem nodes in the graph. -type BillingInvoiceItemMutation struct { - config - op Op - typ string - id *string - namespace *string - created_at *time.Time - updated_at *time.Time - deleted_at *time.Time - metadata *map[string]string - customer_id *string - period_start *time.Time - period_end *time.Time - invoice_at *time.Time - _type *billingentity.InvoiceItemType - name *string - quantity *alpacadecimal.Decimal - unit_price *alpacadecimal.Decimal - currency *currencyx.Code - tax_code_override *billingentity.TaxOverrides - clearedFields map[string]struct{} - billing_invoice *string - clearedbilling_invoice bool - done bool - oldValue func(context.Context) (*BillingInvoiceItem, error) - predicates []predicate.BillingInvoiceItem +// OldDescription returns the old "description" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldDescription(ctx context.Context) (v *string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldDescription is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldDescription requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldDescription: %w", err) + } + return oldValue.Description, nil } -var _ ent.Mutation = (*BillingInvoiceItemMutation)(nil) +// ClearDescription clears the value of the "description" field. +func (m *BillingInvoiceLineMutation) ClearDescription() { + m.description = nil + m.clearedFields[billinginvoiceline.FieldDescription] = struct{}{} +} -// billinginvoiceitemOption allows management of the mutation configuration using functional options. -type billinginvoiceitemOption func(*BillingInvoiceItemMutation) +// DescriptionCleared returns if the "description" field was cleared in this mutation. +func (m *BillingInvoiceLineMutation) DescriptionCleared() bool { + _, ok := m.clearedFields[billinginvoiceline.FieldDescription] + return ok +} -// newBillingInvoiceItemMutation creates new mutation for the BillingInvoiceItem entity. -func newBillingInvoiceItemMutation(c config, op Op, opts ...billinginvoiceitemOption) *BillingInvoiceItemMutation { - m := &BillingInvoiceItemMutation{ - config: c, - op: op, - typ: TypeBillingInvoiceItem, - clearedFields: make(map[string]struct{}), - } - for _, opt := range opts { - opt(m) - } - return m +// ResetDescription resets all changes to the "description" field. +func (m *BillingInvoiceLineMutation) ResetDescription() { + m.description = nil + delete(m.clearedFields, billinginvoiceline.FieldDescription) } -// withBillingInvoiceItemID sets the ID field of the mutation. -func withBillingInvoiceItemID(id string) billinginvoiceitemOption { - return func(m *BillingInvoiceItemMutation) { - var ( - err error - once sync.Once - value *BillingInvoiceItem - ) - m.oldValue = func(ctx context.Context) (*BillingInvoiceItem, error) { - once.Do(func() { - if m.done { - err = errors.New("querying old values post mutation is not allowed") - } else { - value, err = m.Client().BillingInvoiceItem.Get(ctx, id) - } - }) - return value, err - } - m.id = &id - } +// SetInvoiceID sets the "invoice_id" field. +func (m *BillingInvoiceLineMutation) SetInvoiceID(s string) { + m.billing_invoice = &s } -// withBillingInvoiceItem sets the old BillingInvoiceItem of the mutation. -func withBillingInvoiceItem(node *BillingInvoiceItem) billinginvoiceitemOption { - return func(m *BillingInvoiceItemMutation) { - m.oldValue = func(context.Context) (*BillingInvoiceItem, error) { - return node, nil - } - m.id = &node.ID +// InvoiceID returns the value of the "invoice_id" field in the mutation. +func (m *BillingInvoiceLineMutation) InvoiceID() (r string, exists bool) { + v := m.billing_invoice + if v == nil { + return } + return *v, true } -// Client returns a new `ent.Client` from the mutation. If the mutation was -// executed in a transaction (ent.Tx), a transactional client is returned. -func (m BillingInvoiceItemMutation) Client() *Client { - client := &Client{config: m.config} - client.init() - return client +// OldInvoiceID returns the old "invoice_id" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldInvoiceID(ctx context.Context) (v string, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldInvoiceID is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldInvoiceID requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldInvoiceID: %w", err) + } + return oldValue.InvoiceID, nil } -// Tx returns an `ent.Tx` for mutations that were executed in transactions; -// it returns an error otherwise. -func (m BillingInvoiceItemMutation) Tx() (*Tx, error) { - if _, ok := m.driver.(*txDriver); !ok { - return nil, errors.New("db: mutation is not running in a transaction") - } - tx := &Tx{config: m.config} - tx.init() - return tx, nil +// ResetInvoiceID resets all changes to the "invoice_id" field. +func (m *BillingInvoiceLineMutation) ResetInvoiceID() { + m.billing_invoice = nil } -// SetID sets the value of the id field. Note that this -// operation is only accepted on creation of BillingInvoiceItem entities. -func (m *BillingInvoiceItemMutation) SetID(id string) { - m.id = &id +// SetPeriodStart sets the "period_start" field. +func (m *BillingInvoiceLineMutation) SetPeriodStart(t time.Time) { + m.period_start = &t } -// ID returns the ID value in the mutation. Note that the ID is only available -// if it was provided to the builder or after it was returned from the database. -func (m *BillingInvoiceItemMutation) ID() (id string, exists bool) { - if m.id == nil { +// PeriodStart returns the value of the "period_start" field in the mutation. +func (m *BillingInvoiceLineMutation) PeriodStart() (r time.Time, exists bool) { + v := m.period_start + if v == nil { return } - return *m.id, true + return *v, true } -// IDs queries the database and returns the entity ids that match the mutation's predicate. -// That means, if the mutation is applied within a transaction with an isolation level such -// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated -// or updated by the mutation. -func (m *BillingInvoiceItemMutation) IDs(ctx context.Context) ([]string, error) { - switch { - case m.op.Is(OpUpdateOne | OpDeleteOne): - id, exists := m.ID() - if exists { - return []string{id}, nil - } - fallthrough - case m.op.Is(OpUpdate | OpDelete): - return m.Client().BillingInvoiceItem.Query().Where(m.predicates...).IDs(ctx) - default: - return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) +// OldPeriodStart returns the old "period_start" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldPeriodStart(ctx context.Context) (v time.Time, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldPeriodStart is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldPeriodStart requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldPeriodStart: %w", err) } + return oldValue.PeriodStart, nil +} + +// ResetPeriodStart resets all changes to the "period_start" field. +func (m *BillingInvoiceLineMutation) ResetPeriodStart() { + m.period_start = nil } -// SetNamespace sets the "namespace" field. -func (m *BillingInvoiceItemMutation) SetNamespace(s string) { - m.namespace = &s +// SetPeriodEnd sets the "period_end" field. +func (m *BillingInvoiceLineMutation) SetPeriodEnd(t time.Time) { + m.period_end = &t } -// Namespace returns the value of the "namespace" field in the mutation. -func (m *BillingInvoiceItemMutation) Namespace() (r string, exists bool) { - v := m.namespace +// PeriodEnd returns the value of the "period_end" field in the mutation. +func (m *BillingInvoiceLineMutation) PeriodEnd() (r time.Time, exists bool) { + v := m.period_end if v == nil { return } return *v, true } -// OldNamespace returns the old "namespace" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldPeriodEnd returns the old "period_end" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldNamespace(ctx context.Context) (v string, err error) { +func (m *BillingInvoiceLineMutation) OldPeriodEnd(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldNamespace is only allowed on UpdateOne operations") + return v, errors.New("OldPeriodEnd is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldNamespace requires an ID field in the mutation") + return v, errors.New("OldPeriodEnd requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldNamespace: %w", err) + return v, fmt.Errorf("querying old value for OldPeriodEnd: %w", err) } - return oldValue.Namespace, nil + return oldValue.PeriodEnd, nil } -// ResetNamespace resets all changes to the "namespace" field. -func (m *BillingInvoiceItemMutation) ResetNamespace() { - m.namespace = nil +// ResetPeriodEnd resets all changes to the "period_end" field. +func (m *BillingInvoiceLineMutation) ResetPeriodEnd() { + m.period_end = nil } -// SetCreatedAt sets the "created_at" field. -func (m *BillingInvoiceItemMutation) SetCreatedAt(t time.Time) { - m.created_at = &t +// SetInvoiceAt sets the "invoice_at" field. +func (m *BillingInvoiceLineMutation) SetInvoiceAt(t time.Time) { + m.invoice_at = &t } -// CreatedAt returns the value of the "created_at" field in the mutation. -func (m *BillingInvoiceItemMutation) CreatedAt() (r time.Time, exists bool) { - v := m.created_at +// InvoiceAt returns the value of the "invoice_at" field in the mutation. +func (m *BillingInvoiceLineMutation) InvoiceAt() (r time.Time, exists bool) { + v := m.invoice_at if v == nil { return } return *v, true } -// OldCreatedAt returns the old "created_at" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldInvoiceAt returns the old "invoice_at" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldCreatedAt(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceLineMutation) OldInvoiceAt(ctx context.Context) (v time.Time, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCreatedAt is only allowed on UpdateOne operations") + return v, errors.New("OldInvoiceAt is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCreatedAt requires an ID field in the mutation") + return v, errors.New("OldInvoiceAt requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldCreatedAt: %w", err) + return v, fmt.Errorf("querying old value for OldInvoiceAt: %w", err) } - return oldValue.CreatedAt, nil + return oldValue.InvoiceAt, nil } -// ResetCreatedAt resets all changes to the "created_at" field. -func (m *BillingInvoiceItemMutation) ResetCreatedAt() { - m.created_at = nil +// ResetInvoiceAt resets all changes to the "invoice_at" field. +func (m *BillingInvoiceLineMutation) ResetInvoiceAt() { + m.invoice_at = nil } -// SetUpdatedAt sets the "updated_at" field. -func (m *BillingInvoiceItemMutation) SetUpdatedAt(t time.Time) { - m.updated_at = &t +// SetType sets the "type" field. +func (m *BillingInvoiceLineMutation) SetType(blt billingentity.InvoiceLineType) { + m._type = &blt } -// UpdatedAt returns the value of the "updated_at" field in the mutation. -func (m *BillingInvoiceItemMutation) UpdatedAt() (r time.Time, exists bool) { - v := m.updated_at +// GetType returns the value of the "type" field in the mutation. +func (m *BillingInvoiceLineMutation) GetType() (r billingentity.InvoiceLineType, exists bool) { + v := m._type if v == nil { return } return *v, true } -// OldUpdatedAt returns the old "updated_at" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldType returns the old "type" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldUpdatedAt(ctx context.Context) (v time.Time, err error) { +func (m *BillingInvoiceLineMutation) OldType(ctx context.Context) (v billingentity.InvoiceLineType, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldUpdatedAt is only allowed on UpdateOne operations") + return v, errors.New("OldType is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldUpdatedAt requires an ID field in the mutation") + return v, errors.New("OldType requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldUpdatedAt: %w", err) + return v, fmt.Errorf("querying old value for OldType: %w", err) } - return oldValue.UpdatedAt, nil + return oldValue.Type, nil } -// ResetUpdatedAt resets all changes to the "updated_at" field. -func (m *BillingInvoiceItemMutation) ResetUpdatedAt() { - m.updated_at = nil +// ResetType resets all changes to the "type" field. +func (m *BillingInvoiceLineMutation) ResetType() { + m._type = nil } -// SetDeletedAt sets the "deleted_at" field. -func (m *BillingInvoiceItemMutation) SetDeletedAt(t time.Time) { - m.deleted_at = &t +// SetStatus sets the "status" field. +func (m *BillingInvoiceLineMutation) SetStatus(bls billingentity.InvoiceLineStatus) { + m.status = &bls } -// DeletedAt returns the value of the "deleted_at" field in the mutation. -func (m *BillingInvoiceItemMutation) DeletedAt() (r time.Time, exists bool) { - v := m.deleted_at +// Status returns the value of the "status" field in the mutation. +func (m *BillingInvoiceLineMutation) Status() (r billingentity.InvoiceLineStatus, exists bool) { + v := m.status if v == nil { return } return *v, true } -// OldDeletedAt returns the old "deleted_at" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldStatus returns the old "status" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldDeletedAt(ctx context.Context) (v *time.Time, err error) { +func (m *BillingInvoiceLineMutation) OldStatus(ctx context.Context) (v billingentity.InvoiceLineStatus, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldDeletedAt is only allowed on UpdateOne operations") + return v, errors.New("OldStatus is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldDeletedAt requires an ID field in the mutation") + return v, errors.New("OldStatus requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldDeletedAt: %w", err) + return v, fmt.Errorf("querying old value for OldStatus: %w", err) } - return oldValue.DeletedAt, nil + return oldValue.Status, nil } -// ClearDeletedAt clears the value of the "deleted_at" field. -func (m *BillingInvoiceItemMutation) ClearDeletedAt() { - m.deleted_at = nil - m.clearedFields[billinginvoiceitem.FieldDeletedAt] = struct{}{} +// ResetStatus resets all changes to the "status" field. +func (m *BillingInvoiceLineMutation) ResetStatus() { + m.status = nil } -// DeletedAtCleared returns if the "deleted_at" field was cleared in this mutation. -func (m *BillingInvoiceItemMutation) DeletedAtCleared() bool { - _, ok := m.clearedFields[billinginvoiceitem.FieldDeletedAt] - return ok +// SetCurrency sets the "currency" field. +func (m *BillingInvoiceLineMutation) SetCurrency(c currencyx.Code) { + m.currency = &c } -// ResetDeletedAt resets all changes to the "deleted_at" field. -func (m *BillingInvoiceItemMutation) ResetDeletedAt() { - m.deleted_at = nil - delete(m.clearedFields, billinginvoiceitem.FieldDeletedAt) +// Currency returns the value of the "currency" field in the mutation. +func (m *BillingInvoiceLineMutation) Currency() (r currencyx.Code, exists bool) { + v := m.currency + if v == nil { + return + } + return *v, true } -// SetMetadata sets the "metadata" field. -func (m *BillingInvoiceItemMutation) SetMetadata(value map[string]string) { - m.metadata = &value +// OldCurrency returns the old "currency" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. +// An error is returned if the mutation operation is not UpdateOne, or the database query fails. +func (m *BillingInvoiceLineMutation) OldCurrency(ctx context.Context) (v currencyx.Code, err error) { + if !m.op.Is(OpUpdateOne) { + return v, errors.New("OldCurrency is only allowed on UpdateOne operations") + } + if m.id == nil || m.oldValue == nil { + return v, errors.New("OldCurrency requires an ID field in the mutation") + } + oldValue, err := m.oldValue(ctx) + if err != nil { + return v, fmt.Errorf("querying old value for OldCurrency: %w", err) + } + return oldValue.Currency, nil } -// Metadata returns the value of the "metadata" field in the mutation. -func (m *BillingInvoiceItemMutation) Metadata() (r map[string]string, exists bool) { - v := m.metadata +// ResetCurrency resets all changes to the "currency" field. +func (m *BillingInvoiceLineMutation) ResetCurrency() { + m.currency = nil +} + +// SetQuantity sets the "quantity" field. +func (m *BillingInvoiceLineMutation) SetQuantity(a alpacadecimal.Decimal) { + m.quantity = &a +} + +// Quantity returns the value of the "quantity" field in the mutation. +func (m *BillingInvoiceLineMutation) Quantity() (r alpacadecimal.Decimal, exists bool) { + v := m.quantity if v == nil { return } return *v, true } -// OldMetadata returns the old "metadata" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldQuantity returns the old "quantity" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldMetadata(ctx context.Context) (v map[string]string, err error) { +func (m *BillingInvoiceLineMutation) OldQuantity(ctx context.Context) (v *alpacadecimal.Decimal, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldMetadata is only allowed on UpdateOne operations") + return v, errors.New("OldQuantity is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldMetadata requires an ID field in the mutation") + return v, errors.New("OldQuantity requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldMetadata: %w", err) + return v, fmt.Errorf("querying old value for OldQuantity: %w", err) } - return oldValue.Metadata, nil + return oldValue.Quantity, nil } -// ClearMetadata clears the value of the "metadata" field. -func (m *BillingInvoiceItemMutation) ClearMetadata() { - m.metadata = nil - m.clearedFields[billinginvoiceitem.FieldMetadata] = struct{}{} +// ClearQuantity clears the value of the "quantity" field. +func (m *BillingInvoiceLineMutation) ClearQuantity() { + m.quantity = nil + m.clearedFields[billinginvoiceline.FieldQuantity] = struct{}{} } -// MetadataCleared returns if the "metadata" field was cleared in this mutation. -func (m *BillingInvoiceItemMutation) MetadataCleared() bool { - _, ok := m.clearedFields[billinginvoiceitem.FieldMetadata] +// QuantityCleared returns if the "quantity" field was cleared in this mutation. +func (m *BillingInvoiceLineMutation) QuantityCleared() bool { + _, ok := m.clearedFields[billinginvoiceline.FieldQuantity] return ok } -// ResetMetadata resets all changes to the "metadata" field. -func (m *BillingInvoiceItemMutation) ResetMetadata() { - m.metadata = nil - delete(m.clearedFields, billinginvoiceitem.FieldMetadata) +// ResetQuantity resets all changes to the "quantity" field. +func (m *BillingInvoiceLineMutation) ResetQuantity() { + m.quantity = nil + delete(m.clearedFields, billinginvoiceline.FieldQuantity) } -// SetInvoiceID sets the "invoice_id" field. -func (m *BillingInvoiceItemMutation) SetInvoiceID(s string) { - m.billing_invoice = &s +// SetTaxOverrides sets the "tax_overrides" field. +func (m *BillingInvoiceLineMutation) SetTaxOverrides(bo *billingentity.TaxOverrides) { + m.tax_overrides = &bo } -// InvoiceID returns the value of the "invoice_id" field in the mutation. -func (m *BillingInvoiceItemMutation) InvoiceID() (r string, exists bool) { - v := m.billing_invoice +// TaxOverrides returns the value of the "tax_overrides" field in the mutation. +func (m *BillingInvoiceLineMutation) TaxOverrides() (r *billingentity.TaxOverrides, exists bool) { + v := m.tax_overrides if v == nil { return } return *v, true } -// OldInvoiceID returns the old "invoice_id" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldTaxOverrides returns the old "tax_overrides" field's value of the BillingInvoiceLine entity. +// If the BillingInvoiceLine object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldInvoiceID(ctx context.Context) (v *string, err error) { +func (m *BillingInvoiceLineMutation) OldTaxOverrides(ctx context.Context) (v *billingentity.TaxOverrides, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldInvoiceID is only allowed on UpdateOne operations") + return v, errors.New("OldTaxOverrides is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldInvoiceID requires an ID field in the mutation") + return v, errors.New("OldTaxOverrides requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldInvoiceID: %w", err) + return v, fmt.Errorf("querying old value for OldTaxOverrides: %w", err) } - return oldValue.InvoiceID, nil + return oldValue.TaxOverrides, nil } -// ClearInvoiceID clears the value of the "invoice_id" field. -func (m *BillingInvoiceItemMutation) ClearInvoiceID() { - m.billing_invoice = nil - m.clearedFields[billinginvoiceitem.FieldInvoiceID] = struct{}{} +// ClearTaxOverrides clears the value of the "tax_overrides" field. +func (m *BillingInvoiceLineMutation) ClearTaxOverrides() { + m.tax_overrides = nil + m.clearedFields[billinginvoiceline.FieldTaxOverrides] = struct{}{} } -// InvoiceIDCleared returns if the "invoice_id" field was cleared in this mutation. -func (m *BillingInvoiceItemMutation) InvoiceIDCleared() bool { - _, ok := m.clearedFields[billinginvoiceitem.FieldInvoiceID] +// TaxOverridesCleared returns if the "tax_overrides" field was cleared in this mutation. +func (m *BillingInvoiceLineMutation) TaxOverridesCleared() bool { + _, ok := m.clearedFields[billinginvoiceline.FieldTaxOverrides] return ok } -// ResetInvoiceID resets all changes to the "invoice_id" field. -func (m *BillingInvoiceItemMutation) ResetInvoiceID() { - m.billing_invoice = nil - delete(m.clearedFields, billinginvoiceitem.FieldInvoiceID) +// ResetTaxOverrides resets all changes to the "tax_overrides" field. +func (m *BillingInvoiceLineMutation) ResetTaxOverrides() { + m.tax_overrides = nil + delete(m.clearedFields, billinginvoiceline.FieldTaxOverrides) } -// SetCustomerID sets the "customer_id" field. -func (m *BillingInvoiceItemMutation) SetCustomerID(s string) { - m.customer_id = &s +// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by id. +func (m *BillingInvoiceLineMutation) SetBillingInvoiceID(id string) { + m.billing_invoice = &id } -// CustomerID returns the value of the "customer_id" field in the mutation. -func (m *BillingInvoiceItemMutation) CustomerID() (r string, exists bool) { - v := m.customer_id - if v == nil { - return +// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. +func (m *BillingInvoiceLineMutation) ClearBillingInvoice() { + m.clearedbilling_invoice = true + m.clearedFields[billinginvoiceline.FieldInvoiceID] = struct{}{} +} + +// BillingInvoiceCleared reports if the "billing_invoice" edge to the BillingInvoice entity was cleared. +func (m *BillingInvoiceLineMutation) BillingInvoiceCleared() bool { + return m.clearedbilling_invoice +} + +// BillingInvoiceID returns the "billing_invoice" edge ID in the mutation. +func (m *BillingInvoiceLineMutation) BillingInvoiceID() (id string, exists bool) { + if m.billing_invoice != nil { + return *m.billing_invoice, true } - return *v, true + return } -// OldCustomerID returns the old "customer_id" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldCustomerID(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCustomerID is only allowed on UpdateOne operations") +// BillingInvoiceIDs returns the "billing_invoice" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// BillingInvoiceID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceLineMutation) BillingInvoiceIDs() (ids []string) { + if id := m.billing_invoice; id != nil { + ids = append(ids, *id) } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCustomerID requires an ID field in the mutation") + return +} + +// ResetBillingInvoice resets all changes to the "billing_invoice" edge. +func (m *BillingInvoiceLineMutation) ResetBillingInvoice() { + m.billing_invoice = nil + m.clearedbilling_invoice = false +} + +// SetBillingInvoiceManualLinesID sets the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity by id. +func (m *BillingInvoiceLineMutation) SetBillingInvoiceManualLinesID(id string) { + m.billing_invoice_manual_lines = &id +} + +// ClearBillingInvoiceManualLines clears the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity. +func (m *BillingInvoiceLineMutation) ClearBillingInvoiceManualLines() { + m.clearedbilling_invoice_manual_lines = true +} + +// BillingInvoiceManualLinesCleared reports if the "billing_invoice_manual_lines" edge to the BillingInvoiceManualLineConfig entity was cleared. +func (m *BillingInvoiceLineMutation) BillingInvoiceManualLinesCleared() bool { + return m.clearedbilling_invoice_manual_lines +} + +// BillingInvoiceManualLinesID returns the "billing_invoice_manual_lines" edge ID in the mutation. +func (m *BillingInvoiceLineMutation) BillingInvoiceManualLinesID() (id string, exists bool) { + if m.billing_invoice_manual_lines != nil { + return *m.billing_invoice_manual_lines, true } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldCustomerID: %w", err) + return +} + +// BillingInvoiceManualLinesIDs returns the "billing_invoice_manual_lines" edge IDs in the mutation. +// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use +// BillingInvoiceManualLinesID instead. It exists only for internal usage by the builders. +func (m *BillingInvoiceLineMutation) BillingInvoiceManualLinesIDs() (ids []string) { + if id := m.billing_invoice_manual_lines; id != nil { + ids = append(ids, *id) } - return oldValue.CustomerID, nil + return } -// ResetCustomerID resets all changes to the "customer_id" field. -func (m *BillingInvoiceItemMutation) ResetCustomerID() { - m.customer_id = nil +// ResetBillingInvoiceManualLines resets all changes to the "billing_invoice_manual_lines" edge. +func (m *BillingInvoiceLineMutation) ResetBillingInvoiceManualLines() { + m.billing_invoice_manual_lines = nil + m.clearedbilling_invoice_manual_lines = false +} + +// Where appends a list predicates to the BillingInvoiceLineMutation builder. +func (m *BillingInvoiceLineMutation) Where(ps ...predicate.BillingInvoiceLine) { + m.predicates = append(m.predicates, ps...) +} + +// WhereP appends storage-level predicates to the BillingInvoiceLineMutation builder. Using this method, +// users can use type-assertion to append predicates that do not depend on any generated package. +func (m *BillingInvoiceLineMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.BillingInvoiceLine, len(ps)) + for i := range ps { + p[i] = ps[i] + } + m.Where(p...) +} + +// Op returns the operation name. +func (m *BillingInvoiceLineMutation) Op() Op { + return m.op +} + +// SetOp allows setting the mutation operation. +func (m *BillingInvoiceLineMutation) SetOp(op Op) { + m.op = op +} + +// Type returns the node type of this mutation (BillingInvoiceLine). +func (m *BillingInvoiceLineMutation) Type() string { + return m.typ +} + +// Fields returns all fields that were changed during this mutation. Note that in +// order to get all numeric fields that were incremented/decremented, call +// AddedFields(). +func (m *BillingInvoiceLineMutation) Fields() []string { + fields := make([]string, 0, 16) + if m.namespace != nil { + fields = append(fields, billinginvoiceline.FieldNamespace) + } + if m.metadata != nil { + fields = append(fields, billinginvoiceline.FieldMetadata) + } + if m.created_at != nil { + fields = append(fields, billinginvoiceline.FieldCreatedAt) + } + if m.updated_at != nil { + fields = append(fields, billinginvoiceline.FieldUpdatedAt) + } + if m.deleted_at != nil { + fields = append(fields, billinginvoiceline.FieldDeletedAt) + } + if m.name != nil { + fields = append(fields, billinginvoiceline.FieldName) + } + if m.description != nil { + fields = append(fields, billinginvoiceline.FieldDescription) + } + if m.billing_invoice != nil { + fields = append(fields, billinginvoiceline.FieldInvoiceID) + } + if m.period_start != nil { + fields = append(fields, billinginvoiceline.FieldPeriodStart) + } + if m.period_end != nil { + fields = append(fields, billinginvoiceline.FieldPeriodEnd) + } + if m.invoice_at != nil { + fields = append(fields, billinginvoiceline.FieldInvoiceAt) + } + if m._type != nil { + fields = append(fields, billinginvoiceline.FieldType) + } + if m.status != nil { + fields = append(fields, billinginvoiceline.FieldStatus) + } + if m.currency != nil { + fields = append(fields, billinginvoiceline.FieldCurrency) + } + if m.quantity != nil { + fields = append(fields, billinginvoiceline.FieldQuantity) + } + if m.tax_overrides != nil { + fields = append(fields, billinginvoiceline.FieldTaxOverrides) + } + return fields } -// SetPeriodStart sets the "period_start" field. -func (m *BillingInvoiceItemMutation) SetPeriodStart(t time.Time) { - m.period_start = &t +// Field returns the value of a field with the given name. The second boolean +// return value indicates that this field was not set, or was not defined in the +// schema. +func (m *BillingInvoiceLineMutation) Field(name string) (ent.Value, bool) { + switch name { + case billinginvoiceline.FieldNamespace: + return m.Namespace() + case billinginvoiceline.FieldMetadata: + return m.Metadata() + case billinginvoiceline.FieldCreatedAt: + return m.CreatedAt() + case billinginvoiceline.FieldUpdatedAt: + return m.UpdatedAt() + case billinginvoiceline.FieldDeletedAt: + return m.DeletedAt() + case billinginvoiceline.FieldName: + return m.Name() + case billinginvoiceline.FieldDescription: + return m.Description() + case billinginvoiceline.FieldInvoiceID: + return m.InvoiceID() + case billinginvoiceline.FieldPeriodStart: + return m.PeriodStart() + case billinginvoiceline.FieldPeriodEnd: + return m.PeriodEnd() + case billinginvoiceline.FieldInvoiceAt: + return m.InvoiceAt() + case billinginvoiceline.FieldType: + return m.GetType() + case billinginvoiceline.FieldStatus: + return m.Status() + case billinginvoiceline.FieldCurrency: + return m.Currency() + case billinginvoiceline.FieldQuantity: + return m.Quantity() + case billinginvoiceline.FieldTaxOverrides: + return m.TaxOverrides() + } + return nil, false } -// PeriodStart returns the value of the "period_start" field in the mutation. -func (m *BillingInvoiceItemMutation) PeriodStart() (r time.Time, exists bool) { - v := m.period_start - if v == nil { - return +// OldField returns the old value of the field from the database. An error is +// returned if the mutation operation is not UpdateOne, or the query to the +// database failed. +func (m *BillingInvoiceLineMutation) OldField(ctx context.Context, name string) (ent.Value, error) { + switch name { + case billinginvoiceline.FieldNamespace: + return m.OldNamespace(ctx) + case billinginvoiceline.FieldMetadata: + return m.OldMetadata(ctx) + case billinginvoiceline.FieldCreatedAt: + return m.OldCreatedAt(ctx) + case billinginvoiceline.FieldUpdatedAt: + return m.OldUpdatedAt(ctx) + case billinginvoiceline.FieldDeletedAt: + return m.OldDeletedAt(ctx) + case billinginvoiceline.FieldName: + return m.OldName(ctx) + case billinginvoiceline.FieldDescription: + return m.OldDescription(ctx) + case billinginvoiceline.FieldInvoiceID: + return m.OldInvoiceID(ctx) + case billinginvoiceline.FieldPeriodStart: + return m.OldPeriodStart(ctx) + case billinginvoiceline.FieldPeriodEnd: + return m.OldPeriodEnd(ctx) + case billinginvoiceline.FieldInvoiceAt: + return m.OldInvoiceAt(ctx) + case billinginvoiceline.FieldType: + return m.OldType(ctx) + case billinginvoiceline.FieldStatus: + return m.OldStatus(ctx) + case billinginvoiceline.FieldCurrency: + return m.OldCurrency(ctx) + case billinginvoiceline.FieldQuantity: + return m.OldQuantity(ctx) + case billinginvoiceline.FieldTaxOverrides: + return m.OldTaxOverrides(ctx) } - return *v, true + return nil, fmt.Errorf("unknown BillingInvoiceLine field %s", name) } -// OldPeriodStart returns the old "period_start" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldPeriodStart(ctx context.Context) (v time.Time, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldPeriodStart is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldPeriodStart requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPeriodStart: %w", err) +// SetField sets the value of a field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BillingInvoiceLineMutation) SetField(name string, value ent.Value) error { + switch name { + case billinginvoiceline.FieldNamespace: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetNamespace(v) + return nil + case billinginvoiceline.FieldMetadata: + v, ok := value.(map[string]string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetMetadata(v) + return nil + case billinginvoiceline.FieldCreatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCreatedAt(v) + return nil + case billinginvoiceline.FieldUpdatedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetUpdatedAt(v) + return nil + case billinginvoiceline.FieldDeletedAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDeletedAt(v) + return nil + case billinginvoiceline.FieldName: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetName(v) + return nil + case billinginvoiceline.FieldDescription: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetDescription(v) + return nil + case billinginvoiceline.FieldInvoiceID: + v, ok := value.(string) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetInvoiceID(v) + return nil + case billinginvoiceline.FieldPeriodStart: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPeriodStart(v) + return nil + case billinginvoiceline.FieldPeriodEnd: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetPeriodEnd(v) + return nil + case billinginvoiceline.FieldInvoiceAt: + v, ok := value.(time.Time) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetInvoiceAt(v) + return nil + case billinginvoiceline.FieldType: + v, ok := value.(billingentity.InvoiceLineType) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetType(v) + return nil + case billinginvoiceline.FieldStatus: + v, ok := value.(billingentity.InvoiceLineStatus) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetStatus(v) + return nil + case billinginvoiceline.FieldCurrency: + v, ok := value.(currencyx.Code) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetCurrency(v) + return nil + case billinginvoiceline.FieldQuantity: + v, ok := value.(alpacadecimal.Decimal) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetQuantity(v) + return nil + case billinginvoiceline.FieldTaxOverrides: + v, ok := value.(*billingentity.TaxOverrides) + if !ok { + return fmt.Errorf("unexpected type %T for field %s", value, name) + } + m.SetTaxOverrides(v) + return nil } - return oldValue.PeriodStart, nil + return fmt.Errorf("unknown BillingInvoiceLine field %s", name) } -// ResetPeriodStart resets all changes to the "period_start" field. -func (m *BillingInvoiceItemMutation) ResetPeriodStart() { - m.period_start = nil +// AddedFields returns all numeric fields that were incremented/decremented during +// this mutation. +func (m *BillingInvoiceLineMutation) AddedFields() []string { + return nil } -// SetPeriodEnd sets the "period_end" field. -func (m *BillingInvoiceItemMutation) SetPeriodEnd(t time.Time) { - m.period_end = &t +// AddedField returns the numeric value that was incremented/decremented on a field +// with the given name. The second boolean return value indicates that this field +// was not set, or was not defined in the schema. +func (m *BillingInvoiceLineMutation) AddedField(name string) (ent.Value, bool) { + return nil, false } -// PeriodEnd returns the value of the "period_end" field in the mutation. -func (m *BillingInvoiceItemMutation) PeriodEnd() (r time.Time, exists bool) { - v := m.period_end - if v == nil { - return +// AddField adds the value to the field with the given name. It returns an error if +// the field is not defined in the schema, or if the type mismatched the field +// type. +func (m *BillingInvoiceLineMutation) AddField(name string, value ent.Value) error { + switch name { } - return *v, true + return fmt.Errorf("unknown BillingInvoiceLine numeric field %s", name) } -// OldPeriodEnd returns the old "period_end" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldPeriodEnd(ctx context.Context) (v time.Time, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldPeriodEnd is only allowed on UpdateOne operations") +// ClearedFields returns all nullable fields that were cleared during this +// mutation. +func (m *BillingInvoiceLineMutation) ClearedFields() []string { + var fields []string + if m.FieldCleared(billinginvoiceline.FieldMetadata) { + fields = append(fields, billinginvoiceline.FieldMetadata) } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldPeriodEnd requires an ID field in the mutation") + if m.FieldCleared(billinginvoiceline.FieldDeletedAt) { + fields = append(fields, billinginvoiceline.FieldDeletedAt) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldPeriodEnd: %w", err) + if m.FieldCleared(billinginvoiceline.FieldDescription) { + fields = append(fields, billinginvoiceline.FieldDescription) } - return oldValue.PeriodEnd, nil + if m.FieldCleared(billinginvoiceline.FieldQuantity) { + fields = append(fields, billinginvoiceline.FieldQuantity) + } + if m.FieldCleared(billinginvoiceline.FieldTaxOverrides) { + fields = append(fields, billinginvoiceline.FieldTaxOverrides) + } + return fields } -// ResetPeriodEnd resets all changes to the "period_end" field. -func (m *BillingInvoiceItemMutation) ResetPeriodEnd() { - m.period_end = nil +// FieldCleared returns a boolean indicating if a field with the given name was +// cleared in this mutation. +func (m *BillingInvoiceLineMutation) FieldCleared(name string) bool { + _, ok := m.clearedFields[name] + return ok } -// SetInvoiceAt sets the "invoice_at" field. -func (m *BillingInvoiceItemMutation) SetInvoiceAt(t time.Time) { - m.invoice_at = &t +// ClearField clears the value of the field with the given name. It returns an +// error if the field is not defined in the schema. +func (m *BillingInvoiceLineMutation) ClearField(name string) error { + switch name { + case billinginvoiceline.FieldMetadata: + m.ClearMetadata() + return nil + case billinginvoiceline.FieldDeletedAt: + m.ClearDeletedAt() + return nil + case billinginvoiceline.FieldDescription: + m.ClearDescription() + return nil + case billinginvoiceline.FieldQuantity: + m.ClearQuantity() + return nil + case billinginvoiceline.FieldTaxOverrides: + m.ClearTaxOverrides() + return nil + } + return fmt.Errorf("unknown BillingInvoiceLine nullable field %s", name) } -// InvoiceAt returns the value of the "invoice_at" field in the mutation. -func (m *BillingInvoiceItemMutation) InvoiceAt() (r time.Time, exists bool) { - v := m.invoice_at - if v == nil { - return +// ResetField resets all changes in the mutation for the field with the given name. +// It returns an error if the field is not defined in the schema. +func (m *BillingInvoiceLineMutation) ResetField(name string) error { + switch name { + case billinginvoiceline.FieldNamespace: + m.ResetNamespace() + return nil + case billinginvoiceline.FieldMetadata: + m.ResetMetadata() + return nil + case billinginvoiceline.FieldCreatedAt: + m.ResetCreatedAt() + return nil + case billinginvoiceline.FieldUpdatedAt: + m.ResetUpdatedAt() + return nil + case billinginvoiceline.FieldDeletedAt: + m.ResetDeletedAt() + return nil + case billinginvoiceline.FieldName: + m.ResetName() + return nil + case billinginvoiceline.FieldDescription: + m.ResetDescription() + return nil + case billinginvoiceline.FieldInvoiceID: + m.ResetInvoiceID() + return nil + case billinginvoiceline.FieldPeriodStart: + m.ResetPeriodStart() + return nil + case billinginvoiceline.FieldPeriodEnd: + m.ResetPeriodEnd() + return nil + case billinginvoiceline.FieldInvoiceAt: + m.ResetInvoiceAt() + return nil + case billinginvoiceline.FieldType: + m.ResetType() + return nil + case billinginvoiceline.FieldStatus: + m.ResetStatus() + return nil + case billinginvoiceline.FieldCurrency: + m.ResetCurrency() + return nil + case billinginvoiceline.FieldQuantity: + m.ResetQuantity() + return nil + case billinginvoiceline.FieldTaxOverrides: + m.ResetTaxOverrides() + return nil } - return *v, true + return fmt.Errorf("unknown BillingInvoiceLine field %s", name) } -// OldInvoiceAt returns the old "invoice_at" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldInvoiceAt(ctx context.Context) (v time.Time, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldInvoiceAt is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldInvoiceAt requires an ID field in the mutation") +// AddedEdges returns all edge names that were set/added in this mutation. +func (m *BillingInvoiceLineMutation) AddedEdges() []string { + edges := make([]string, 0, 2) + if m.billing_invoice != nil { + edges = append(edges, billinginvoiceline.EdgeBillingInvoice) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldInvoiceAt: %w", err) + if m.billing_invoice_manual_lines != nil { + edges = append(edges, billinginvoiceline.EdgeBillingInvoiceManualLines) } - return oldValue.InvoiceAt, nil + return edges } -// ResetInvoiceAt resets all changes to the "invoice_at" field. -func (m *BillingInvoiceItemMutation) ResetInvoiceAt() { - m.invoice_at = nil +// AddedIDs returns all IDs (to other nodes) that were added for the given edge +// name in this mutation. +func (m *BillingInvoiceLineMutation) AddedIDs(name string) []ent.Value { + switch name { + case billinginvoiceline.EdgeBillingInvoice: + if id := m.billing_invoice; id != nil { + return []ent.Value{*id} + } + case billinginvoiceline.EdgeBillingInvoiceManualLines: + if id := m.billing_invoice_manual_lines; id != nil { + return []ent.Value{*id} + } + } + return nil } -// SetType sets the "type" field. -func (m *BillingInvoiceItemMutation) SetType(bit billingentity.InvoiceItemType) { - m._type = &bit +// RemovedEdges returns all edge names that were removed in this mutation. +func (m *BillingInvoiceLineMutation) RemovedEdges() []string { + edges := make([]string, 0, 2) + return edges } -// GetType returns the value of the "type" field in the mutation. -func (m *BillingInvoiceItemMutation) GetType() (r billingentity.InvoiceItemType, exists bool) { - v := m._type - if v == nil { - return - } - return *v, true +// RemovedIDs returns all IDs (to other nodes) that were removed for the edge with +// the given name in this mutation. +func (m *BillingInvoiceLineMutation) RemovedIDs(name string) []ent.Value { + return nil } -// OldType returns the old "type" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldType(ctx context.Context) (v billingentity.InvoiceItemType, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldType is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldType requires an ID field in the mutation") +// ClearedEdges returns all edge names that were cleared in this mutation. +func (m *BillingInvoiceLineMutation) ClearedEdges() []string { + edges := make([]string, 0, 2) + if m.clearedbilling_invoice { + edges = append(edges, billinginvoiceline.EdgeBillingInvoice) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldType: %w", err) + if m.clearedbilling_invoice_manual_lines { + edges = append(edges, billinginvoiceline.EdgeBillingInvoiceManualLines) } - return oldValue.Type, nil -} - -// ResetType resets all changes to the "type" field. -func (m *BillingInvoiceItemMutation) ResetType() { - m._type = nil + return edges } -// SetName sets the "name" field. -func (m *BillingInvoiceItemMutation) SetName(s string) { - m.name = &s +// EdgeCleared returns a boolean which indicates if the edge with the given name +// was cleared in this mutation. +func (m *BillingInvoiceLineMutation) EdgeCleared(name string) bool { + switch name { + case billinginvoiceline.EdgeBillingInvoice: + return m.clearedbilling_invoice + case billinginvoiceline.EdgeBillingInvoiceManualLines: + return m.clearedbilling_invoice_manual_lines + } + return false } -// Name returns the value of the "name" field in the mutation. -func (m *BillingInvoiceItemMutation) Name() (r string, exists bool) { - v := m.name - if v == nil { - return +// ClearEdge clears the value of the edge with the given name. It returns an error +// if that edge is not defined in the schema. +func (m *BillingInvoiceLineMutation) ClearEdge(name string) error { + switch name { + case billinginvoiceline.EdgeBillingInvoice: + m.ClearBillingInvoice() + return nil + case billinginvoiceline.EdgeBillingInvoiceManualLines: + m.ClearBillingInvoiceManualLines() + return nil } - return *v, true + return fmt.Errorf("unknown BillingInvoiceLine unique edge %s", name) } -// OldName returns the old "name" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldName(ctx context.Context) (v string, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldName is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldName requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldName: %w", err) +// ResetEdge resets all changes to the edge with the given name in this mutation. +// It returns an error if the edge is not defined in the schema. +func (m *BillingInvoiceLineMutation) ResetEdge(name string) error { + switch name { + case billinginvoiceline.EdgeBillingInvoice: + m.ResetBillingInvoice() + return nil + case billinginvoiceline.EdgeBillingInvoiceManualLines: + m.ResetBillingInvoiceManualLines() + return nil } - return oldValue.Name, nil + return fmt.Errorf("unknown BillingInvoiceLine edge %s", name) } -// ResetName resets all changes to the "name" field. -func (m *BillingInvoiceItemMutation) ResetName() { - m.name = nil +// BillingInvoiceManualLineConfigMutation represents an operation that mutates the BillingInvoiceManualLineConfig nodes in the graph. +type BillingInvoiceManualLineConfigMutation struct { + config + op Op + typ string + id *string + namespace *string + unit_price *alpacadecimal.Decimal + clearedFields map[string]struct{} + done bool + oldValue func(context.Context) (*BillingInvoiceManualLineConfig, error) + predicates []predicate.BillingInvoiceManualLineConfig } -// SetQuantity sets the "quantity" field. -func (m *BillingInvoiceItemMutation) SetQuantity(a alpacadecimal.Decimal) { - m.quantity = &a -} +var _ ent.Mutation = (*BillingInvoiceManualLineConfigMutation)(nil) -// Quantity returns the value of the "quantity" field in the mutation. -func (m *BillingInvoiceItemMutation) Quantity() (r alpacadecimal.Decimal, exists bool) { - v := m.quantity - if v == nil { - return - } - return *v, true -} +// billinginvoicemanuallineconfigOption allows management of the mutation configuration using functional options. +type billinginvoicemanuallineconfigOption func(*BillingInvoiceManualLineConfigMutation) -// OldQuantity returns the old "quantity" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldQuantity(ctx context.Context) (v *alpacadecimal.Decimal, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldQuantity is only allowed on UpdateOne operations") +// newBillingInvoiceManualLineConfigMutation creates new mutation for the BillingInvoiceManualLineConfig entity. +func newBillingInvoiceManualLineConfigMutation(c config, op Op, opts ...billinginvoicemanuallineconfigOption) *BillingInvoiceManualLineConfigMutation { + m := &BillingInvoiceManualLineConfigMutation{ + config: c, + op: op, + typ: TypeBillingInvoiceManualLineConfig, + clearedFields: make(map[string]struct{}), } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldQuantity requires an ID field in the mutation") + for _, opt := range opts { + opt(m) } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldQuantity: %w", err) + return m +} + +// withBillingInvoiceManualLineConfigID sets the ID field of the mutation. +func withBillingInvoiceManualLineConfigID(id string) billinginvoicemanuallineconfigOption { + return func(m *BillingInvoiceManualLineConfigMutation) { + var ( + err error + once sync.Once + value *BillingInvoiceManualLineConfig + ) + m.oldValue = func(ctx context.Context) (*BillingInvoiceManualLineConfig, error) { + once.Do(func() { + if m.done { + err = errors.New("querying old values post mutation is not allowed") + } else { + value, err = m.Client().BillingInvoiceManualLineConfig.Get(ctx, id) + } + }) + return value, err + } + m.id = &id } - return oldValue.Quantity, nil } -// ClearQuantity clears the value of the "quantity" field. -func (m *BillingInvoiceItemMutation) ClearQuantity() { - m.quantity = nil - m.clearedFields[billinginvoiceitem.FieldQuantity] = struct{}{} +// withBillingInvoiceManualLineConfig sets the old BillingInvoiceManualLineConfig of the mutation. +func withBillingInvoiceManualLineConfig(node *BillingInvoiceManualLineConfig) billinginvoicemanuallineconfigOption { + return func(m *BillingInvoiceManualLineConfigMutation) { + m.oldValue = func(context.Context) (*BillingInvoiceManualLineConfig, error) { + return node, nil + } + m.id = &node.ID + } } -// QuantityCleared returns if the "quantity" field was cleared in this mutation. -func (m *BillingInvoiceItemMutation) QuantityCleared() bool { - _, ok := m.clearedFields[billinginvoiceitem.FieldQuantity] - return ok +// Client returns a new `ent.Client` from the mutation. If the mutation was +// executed in a transaction (ent.Tx), a transactional client is returned. +func (m BillingInvoiceManualLineConfigMutation) Client() *Client { + client := &Client{config: m.config} + client.init() + return client } -// ResetQuantity resets all changes to the "quantity" field. -func (m *BillingInvoiceItemMutation) ResetQuantity() { - m.quantity = nil - delete(m.clearedFields, billinginvoiceitem.FieldQuantity) +// Tx returns an `ent.Tx` for mutations that were executed in transactions; +// it returns an error otherwise. +func (m BillingInvoiceManualLineConfigMutation) Tx() (*Tx, error) { + if _, ok := m.driver.(*txDriver); !ok { + return nil, errors.New("db: mutation is not running in a transaction") + } + tx := &Tx{config: m.config} + tx.init() + return tx, nil } -// SetUnitPrice sets the "unit_price" field. -func (m *BillingInvoiceItemMutation) SetUnitPrice(a alpacadecimal.Decimal) { - m.unit_price = &a +// SetID sets the value of the id field. Note that this +// operation is only accepted on creation of BillingInvoiceManualLineConfig entities. +func (m *BillingInvoiceManualLineConfigMutation) SetID(id string) { + m.id = &id } -// UnitPrice returns the value of the "unit_price" field in the mutation. -func (m *BillingInvoiceItemMutation) UnitPrice() (r alpacadecimal.Decimal, exists bool) { - v := m.unit_price - if v == nil { +// ID returns the ID value in the mutation. Note that the ID is only available +// if it was provided to the builder or after it was returned from the database. +func (m *BillingInvoiceManualLineConfigMutation) ID() (id string, exists bool) { + if m.id == nil { return } - return *v, true + return *m.id, true } -// OldUnitPrice returns the old "unit_price" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. -// An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldUnitPrice(ctx context.Context) (v alpacadecimal.Decimal, err error) { - if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldUnitPrice is only allowed on UpdateOne operations") - } - if m.id == nil || m.oldValue == nil { - return v, errors.New("OldUnitPrice requires an ID field in the mutation") - } - oldValue, err := m.oldValue(ctx) - if err != nil { - return v, fmt.Errorf("querying old value for OldUnitPrice: %w", err) +// IDs queries the database and returns the entity ids that match the mutation's predicate. +// That means, if the mutation is applied within a transaction with an isolation level such +// as sql.LevelSerializable, the returned ids match the ids of the rows that will be updated +// or updated by the mutation. +func (m *BillingInvoiceManualLineConfigMutation) IDs(ctx context.Context) ([]string, error) { + switch { + case m.op.Is(OpUpdateOne | OpDeleteOne): + id, exists := m.ID() + if exists { + return []string{id}, nil + } + fallthrough + case m.op.Is(OpUpdate | OpDelete): + return m.Client().BillingInvoiceManualLineConfig.Query().Where(m.predicates...).IDs(ctx) + default: + return nil, fmt.Errorf("IDs is not allowed on %s operations", m.op) } - return oldValue.UnitPrice, nil -} - -// ResetUnitPrice resets all changes to the "unit_price" field. -func (m *BillingInvoiceItemMutation) ResetUnitPrice() { - m.unit_price = nil } -// SetCurrency sets the "currency" field. -func (m *BillingInvoiceItemMutation) SetCurrency(c currencyx.Code) { - m.currency = &c +// SetNamespace sets the "namespace" field. +func (m *BillingInvoiceManualLineConfigMutation) SetNamespace(s string) { + m.namespace = &s } -// Currency returns the value of the "currency" field in the mutation. -func (m *BillingInvoiceItemMutation) Currency() (r currencyx.Code, exists bool) { - v := m.currency +// Namespace returns the value of the "namespace" field in the mutation. +func (m *BillingInvoiceManualLineConfigMutation) Namespace() (r string, exists bool) { + v := m.namespace if v == nil { return } return *v, true } -// OldCurrency returns the old "currency" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldNamespace returns the old "namespace" field's value of the BillingInvoiceManualLineConfig entity. +// If the BillingInvoiceManualLineConfig object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldCurrency(ctx context.Context) (v currencyx.Code, err error) { +func (m *BillingInvoiceManualLineConfigMutation) OldNamespace(ctx context.Context) (v string, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldCurrency is only allowed on UpdateOne operations") + return v, errors.New("OldNamespace is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldCurrency requires an ID field in the mutation") + return v, errors.New("OldNamespace requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldCurrency: %w", err) + return v, fmt.Errorf("querying old value for OldNamespace: %w", err) } - return oldValue.Currency, nil + return oldValue.Namespace, nil } -// ResetCurrency resets all changes to the "currency" field. -func (m *BillingInvoiceItemMutation) ResetCurrency() { - m.currency = nil +// ResetNamespace resets all changes to the "namespace" field. +func (m *BillingInvoiceManualLineConfigMutation) ResetNamespace() { + m.namespace = nil } -// SetTaxCodeOverride sets the "tax_code_override" field. -func (m *BillingInvoiceItemMutation) SetTaxCodeOverride(bo billingentity.TaxOverrides) { - m.tax_code_override = &bo +// SetUnitPrice sets the "unit_price" field. +func (m *BillingInvoiceManualLineConfigMutation) SetUnitPrice(a alpacadecimal.Decimal) { + m.unit_price = &a } -// TaxCodeOverride returns the value of the "tax_code_override" field in the mutation. -func (m *BillingInvoiceItemMutation) TaxCodeOverride() (r billingentity.TaxOverrides, exists bool) { - v := m.tax_code_override +// UnitPrice returns the value of the "unit_price" field in the mutation. +func (m *BillingInvoiceManualLineConfigMutation) UnitPrice() (r alpacadecimal.Decimal, exists bool) { + v := m.unit_price if v == nil { return } return *v, true } -// OldTaxCodeOverride returns the old "tax_code_override" field's value of the BillingInvoiceItem entity. -// If the BillingInvoiceItem object wasn't provided to the builder, the object is fetched from the database. +// OldUnitPrice returns the old "unit_price" field's value of the BillingInvoiceManualLineConfig entity. +// If the BillingInvoiceManualLineConfig object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingInvoiceItemMutation) OldTaxCodeOverride(ctx context.Context) (v billingentity.TaxOverrides, err error) { +func (m *BillingInvoiceManualLineConfigMutation) OldUnitPrice(ctx context.Context) (v alpacadecimal.Decimal, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldTaxCodeOverride is only allowed on UpdateOne operations") + return v, errors.New("OldUnitPrice is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldTaxCodeOverride requires an ID field in the mutation") + return v, errors.New("OldUnitPrice requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldTaxCodeOverride: %w", err) - } - return oldValue.TaxCodeOverride, nil -} - -// ResetTaxCodeOverride resets all changes to the "tax_code_override" field. -func (m *BillingInvoiceItemMutation) ResetTaxCodeOverride() { - m.tax_code_override = nil -} - -// SetBillingInvoiceID sets the "billing_invoice" edge to the BillingInvoice entity by id. -func (m *BillingInvoiceItemMutation) SetBillingInvoiceID(id string) { - m.billing_invoice = &id -} - -// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. -func (m *BillingInvoiceItemMutation) ClearBillingInvoice() { - m.clearedbilling_invoice = true - m.clearedFields[billinginvoiceitem.FieldInvoiceID] = struct{}{} -} - -// BillingInvoiceCleared reports if the "billing_invoice" edge to the BillingInvoice entity was cleared. -func (m *BillingInvoiceItemMutation) BillingInvoiceCleared() bool { - return m.InvoiceIDCleared() || m.clearedbilling_invoice -} - -// BillingInvoiceID returns the "billing_invoice" edge ID in the mutation. -func (m *BillingInvoiceItemMutation) BillingInvoiceID() (id string, exists bool) { - if m.billing_invoice != nil { - return *m.billing_invoice, true - } - return -} - -// BillingInvoiceIDs returns the "billing_invoice" edge IDs in the mutation. -// Note that IDs always returns len(IDs) <= 1 for unique edges, and you should use -// BillingInvoiceID instead. It exists only for internal usage by the builders. -func (m *BillingInvoiceItemMutation) BillingInvoiceIDs() (ids []string) { - if id := m.billing_invoice; id != nil { - ids = append(ids, *id) + return v, fmt.Errorf("querying old value for OldUnitPrice: %w", err) } - return + return oldValue.UnitPrice, nil } -// ResetBillingInvoice resets all changes to the "billing_invoice" edge. -func (m *BillingInvoiceItemMutation) ResetBillingInvoice() { - m.billing_invoice = nil - m.clearedbilling_invoice = false +// ResetUnitPrice resets all changes to the "unit_price" field. +func (m *BillingInvoiceManualLineConfigMutation) ResetUnitPrice() { + m.unit_price = nil } -// Where appends a list predicates to the BillingInvoiceItemMutation builder. -func (m *BillingInvoiceItemMutation) Where(ps ...predicate.BillingInvoiceItem) { +// Where appends a list predicates to the BillingInvoiceManualLineConfigMutation builder. +func (m *BillingInvoiceManualLineConfigMutation) Where(ps ...predicate.BillingInvoiceManualLineConfig) { m.predicates = append(m.predicates, ps...) } -// WhereP appends storage-level predicates to the BillingInvoiceItemMutation builder. Using this method, +// WhereP appends storage-level predicates to the BillingInvoiceManualLineConfigMutation builder. Using this method, // users can use type-assertion to append predicates that do not depend on any generated package. -func (m *BillingInvoiceItemMutation) WhereP(ps ...func(*sql.Selector)) { - p := make([]predicate.BillingInvoiceItem, len(ps)) +func (m *BillingInvoiceManualLineConfigMutation) WhereP(ps ...func(*sql.Selector)) { + p := make([]predicate.BillingInvoiceManualLineConfig, len(ps)) for i := range ps { p[i] = ps[i] } @@ -8162,72 +10987,30 @@ func (m *BillingInvoiceItemMutation) WhereP(ps ...func(*sql.Selector)) { } // Op returns the operation name. -func (m *BillingInvoiceItemMutation) Op() Op { +func (m *BillingInvoiceManualLineConfigMutation) Op() Op { return m.op } // SetOp allows setting the mutation operation. -func (m *BillingInvoiceItemMutation) SetOp(op Op) { +func (m *BillingInvoiceManualLineConfigMutation) SetOp(op Op) { m.op = op } -// Type returns the node type of this mutation (BillingInvoiceItem). -func (m *BillingInvoiceItemMutation) Type() string { +// Type returns the node type of this mutation (BillingInvoiceManualLineConfig). +func (m *BillingInvoiceManualLineConfigMutation) Type() string { return m.typ } // Fields returns all fields that were changed during this mutation. Note that in // order to get all numeric fields that were incremented/decremented, call // AddedFields(). -func (m *BillingInvoiceItemMutation) Fields() []string { - fields := make([]string, 0, 16) +func (m *BillingInvoiceManualLineConfigMutation) Fields() []string { + fields := make([]string, 0, 2) if m.namespace != nil { - fields = append(fields, billinginvoiceitem.FieldNamespace) - } - if m.created_at != nil { - fields = append(fields, billinginvoiceitem.FieldCreatedAt) - } - if m.updated_at != nil { - fields = append(fields, billinginvoiceitem.FieldUpdatedAt) - } - if m.deleted_at != nil { - fields = append(fields, billinginvoiceitem.FieldDeletedAt) - } - if m.metadata != nil { - fields = append(fields, billinginvoiceitem.FieldMetadata) - } - if m.billing_invoice != nil { - fields = append(fields, billinginvoiceitem.FieldInvoiceID) - } - if m.customer_id != nil { - fields = append(fields, billinginvoiceitem.FieldCustomerID) - } - if m.period_start != nil { - fields = append(fields, billinginvoiceitem.FieldPeriodStart) - } - if m.period_end != nil { - fields = append(fields, billinginvoiceitem.FieldPeriodEnd) - } - if m.invoice_at != nil { - fields = append(fields, billinginvoiceitem.FieldInvoiceAt) - } - if m._type != nil { - fields = append(fields, billinginvoiceitem.FieldType) - } - if m.name != nil { - fields = append(fields, billinginvoiceitem.FieldName) - } - if m.quantity != nil { - fields = append(fields, billinginvoiceitem.FieldQuantity) + fields = append(fields, billinginvoicemanuallineconfig.FieldNamespace) } if m.unit_price != nil { - fields = append(fields, billinginvoiceitem.FieldUnitPrice) - } - if m.currency != nil { - fields = append(fields, billinginvoiceitem.FieldCurrency) - } - if m.tax_code_override != nil { - fields = append(fields, billinginvoiceitem.FieldTaxCodeOverride) + fields = append(fields, billinginvoicemanuallineconfig.FieldUnitPrice) } return fields } @@ -8235,40 +11018,12 @@ func (m *BillingInvoiceItemMutation) Fields() []string { // Field returns the value of a field with the given name. The second boolean // return value indicates that this field was not set, or was not defined in the // schema. -func (m *BillingInvoiceItemMutation) Field(name string) (ent.Value, bool) { +func (m *BillingInvoiceManualLineConfigMutation) Field(name string) (ent.Value, bool) { switch name { - case billinginvoiceitem.FieldNamespace: + case billinginvoicemanuallineconfig.FieldNamespace: return m.Namespace() - case billinginvoiceitem.FieldCreatedAt: - return m.CreatedAt() - case billinginvoiceitem.FieldUpdatedAt: - return m.UpdatedAt() - case billinginvoiceitem.FieldDeletedAt: - return m.DeletedAt() - case billinginvoiceitem.FieldMetadata: - return m.Metadata() - case billinginvoiceitem.FieldInvoiceID: - return m.InvoiceID() - case billinginvoiceitem.FieldCustomerID: - return m.CustomerID() - case billinginvoiceitem.FieldPeriodStart: - return m.PeriodStart() - case billinginvoiceitem.FieldPeriodEnd: - return m.PeriodEnd() - case billinginvoiceitem.FieldInvoiceAt: - return m.InvoiceAt() - case billinginvoiceitem.FieldType: - return m.GetType() - case billinginvoiceitem.FieldName: - return m.Name() - case billinginvoiceitem.FieldQuantity: - return m.Quantity() - case billinginvoiceitem.FieldUnitPrice: + case billinginvoicemanuallineconfig.FieldUnitPrice: return m.UnitPrice() - case billinginvoiceitem.FieldCurrency: - return m.Currency() - case billinginvoiceitem.FieldTaxCodeOverride: - return m.TaxCodeOverride() } return nil, false } @@ -8276,361 +11031,140 @@ func (m *BillingInvoiceItemMutation) Field(name string) (ent.Value, bool) { // OldField returns the old value of the field from the database. An error is // returned if the mutation operation is not UpdateOne, or the query to the // database failed. -func (m *BillingInvoiceItemMutation) OldField(ctx context.Context, name string) (ent.Value, error) { +func (m *BillingInvoiceManualLineConfigMutation) OldField(ctx context.Context, name string) (ent.Value, error) { switch name { - case billinginvoiceitem.FieldNamespace: + case billinginvoicemanuallineconfig.FieldNamespace: return m.OldNamespace(ctx) - case billinginvoiceitem.FieldCreatedAt: - return m.OldCreatedAt(ctx) - case billinginvoiceitem.FieldUpdatedAt: - return m.OldUpdatedAt(ctx) - case billinginvoiceitem.FieldDeletedAt: - return m.OldDeletedAt(ctx) - case billinginvoiceitem.FieldMetadata: - return m.OldMetadata(ctx) - case billinginvoiceitem.FieldInvoiceID: - return m.OldInvoiceID(ctx) - case billinginvoiceitem.FieldCustomerID: - return m.OldCustomerID(ctx) - case billinginvoiceitem.FieldPeriodStart: - return m.OldPeriodStart(ctx) - case billinginvoiceitem.FieldPeriodEnd: - return m.OldPeriodEnd(ctx) - case billinginvoiceitem.FieldInvoiceAt: - return m.OldInvoiceAt(ctx) - case billinginvoiceitem.FieldType: - return m.OldType(ctx) - case billinginvoiceitem.FieldName: - return m.OldName(ctx) - case billinginvoiceitem.FieldQuantity: - return m.OldQuantity(ctx) - case billinginvoiceitem.FieldUnitPrice: + case billinginvoicemanuallineconfig.FieldUnitPrice: return m.OldUnitPrice(ctx) - case billinginvoiceitem.FieldCurrency: - return m.OldCurrency(ctx) - case billinginvoiceitem.FieldTaxCodeOverride: - return m.OldTaxCodeOverride(ctx) } - return nil, fmt.Errorf("unknown BillingInvoiceItem field %s", name) + return nil, fmt.Errorf("unknown BillingInvoiceManualLineConfig field %s", name) } // SetField sets the value of a field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. -func (m *BillingInvoiceItemMutation) SetField(name string, value ent.Value) error { +func (m *BillingInvoiceManualLineConfigMutation) SetField(name string, value ent.Value) error { switch name { - case billinginvoiceitem.FieldNamespace: + case billinginvoicemanuallineconfig.FieldNamespace: v, ok := value.(string) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetNamespace(v) return nil - case billinginvoiceitem.FieldCreatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCreatedAt(v) - return nil - case billinginvoiceitem.FieldUpdatedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetUpdatedAt(v) - return nil - case billinginvoiceitem.FieldDeletedAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetDeletedAt(v) - return nil - case billinginvoiceitem.FieldMetadata: - v, ok := value.(map[string]string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetMetadata(v) - return nil - case billinginvoiceitem.FieldInvoiceID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetInvoiceID(v) - return nil - case billinginvoiceitem.FieldCustomerID: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCustomerID(v) - return nil - case billinginvoiceitem.FieldPeriodStart: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPeriodStart(v) - return nil - case billinginvoiceitem.FieldPeriodEnd: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetPeriodEnd(v) - return nil - case billinginvoiceitem.FieldInvoiceAt: - v, ok := value.(time.Time) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetInvoiceAt(v) - return nil - case billinginvoiceitem.FieldType: - v, ok := value.(billingentity.InvoiceItemType) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetType(v) - return nil - case billinginvoiceitem.FieldName: - v, ok := value.(string) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetName(v) - return nil - case billinginvoiceitem.FieldQuantity: - v, ok := value.(alpacadecimal.Decimal) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetQuantity(v) - return nil - case billinginvoiceitem.FieldUnitPrice: + case billinginvoicemanuallineconfig.FieldUnitPrice: v, ok := value.(alpacadecimal.Decimal) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } m.SetUnitPrice(v) return nil - case billinginvoiceitem.FieldCurrency: - v, ok := value.(currencyx.Code) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetCurrency(v) - return nil - case billinginvoiceitem.FieldTaxCodeOverride: - v, ok := value.(billingentity.TaxOverrides) - if !ok { - return fmt.Errorf("unexpected type %T for field %s", value, name) - } - m.SetTaxCodeOverride(v) - return nil } - return fmt.Errorf("unknown BillingInvoiceItem field %s", name) + return fmt.Errorf("unknown BillingInvoiceManualLineConfig field %s", name) } // AddedFields returns all numeric fields that were incremented/decremented during // this mutation. -func (m *BillingInvoiceItemMutation) AddedFields() []string { +func (m *BillingInvoiceManualLineConfigMutation) AddedFields() []string { return nil } // AddedField returns the numeric value that was incremented/decremented on a field // with the given name. The second boolean return value indicates that this field // was not set, or was not defined in the schema. -func (m *BillingInvoiceItemMutation) AddedField(name string) (ent.Value, bool) { +func (m *BillingInvoiceManualLineConfigMutation) AddedField(name string) (ent.Value, bool) { return nil, false } // AddField adds the value to the field with the given name. It returns an error if // the field is not defined in the schema, or if the type mismatched the field // type. -func (m *BillingInvoiceItemMutation) AddField(name string, value ent.Value) error { +func (m *BillingInvoiceManualLineConfigMutation) AddField(name string, value ent.Value) error { switch name { } - return fmt.Errorf("unknown BillingInvoiceItem numeric field %s", name) + return fmt.Errorf("unknown BillingInvoiceManualLineConfig numeric field %s", name) } // ClearedFields returns all nullable fields that were cleared during this // mutation. -func (m *BillingInvoiceItemMutation) ClearedFields() []string { - var fields []string - if m.FieldCleared(billinginvoiceitem.FieldDeletedAt) { - fields = append(fields, billinginvoiceitem.FieldDeletedAt) - } - if m.FieldCleared(billinginvoiceitem.FieldMetadata) { - fields = append(fields, billinginvoiceitem.FieldMetadata) - } - if m.FieldCleared(billinginvoiceitem.FieldInvoiceID) { - fields = append(fields, billinginvoiceitem.FieldInvoiceID) - } - if m.FieldCleared(billinginvoiceitem.FieldQuantity) { - fields = append(fields, billinginvoiceitem.FieldQuantity) - } - return fields +func (m *BillingInvoiceManualLineConfigMutation) ClearedFields() []string { + return nil } // FieldCleared returns a boolean indicating if a field with the given name was // cleared in this mutation. -func (m *BillingInvoiceItemMutation) FieldCleared(name string) bool { +func (m *BillingInvoiceManualLineConfigMutation) FieldCleared(name string) bool { _, ok := m.clearedFields[name] return ok } // ClearField clears the value of the field with the given name. It returns an // error if the field is not defined in the schema. -func (m *BillingInvoiceItemMutation) ClearField(name string) error { - switch name { - case billinginvoiceitem.FieldDeletedAt: - m.ClearDeletedAt() - return nil - case billinginvoiceitem.FieldMetadata: - m.ClearMetadata() - return nil - case billinginvoiceitem.FieldInvoiceID: - m.ClearInvoiceID() - return nil - case billinginvoiceitem.FieldQuantity: - m.ClearQuantity() - return nil - } - return fmt.Errorf("unknown BillingInvoiceItem nullable field %s", name) +func (m *BillingInvoiceManualLineConfigMutation) ClearField(name string) error { + return fmt.Errorf("unknown BillingInvoiceManualLineConfig nullable field %s", name) } // ResetField resets all changes in the mutation for the field with the given name. // It returns an error if the field is not defined in the schema. -func (m *BillingInvoiceItemMutation) ResetField(name string) error { +func (m *BillingInvoiceManualLineConfigMutation) ResetField(name string) error { switch name { - case billinginvoiceitem.FieldNamespace: + case billinginvoicemanuallineconfig.FieldNamespace: m.ResetNamespace() return nil - case billinginvoiceitem.FieldCreatedAt: - m.ResetCreatedAt() - return nil - case billinginvoiceitem.FieldUpdatedAt: - m.ResetUpdatedAt() - return nil - case billinginvoiceitem.FieldDeletedAt: - m.ResetDeletedAt() - return nil - case billinginvoiceitem.FieldMetadata: - m.ResetMetadata() - return nil - case billinginvoiceitem.FieldInvoiceID: - m.ResetInvoiceID() - return nil - case billinginvoiceitem.FieldCustomerID: - m.ResetCustomerID() - return nil - case billinginvoiceitem.FieldPeriodStart: - m.ResetPeriodStart() - return nil - case billinginvoiceitem.FieldPeriodEnd: - m.ResetPeriodEnd() - return nil - case billinginvoiceitem.FieldInvoiceAt: - m.ResetInvoiceAt() - return nil - case billinginvoiceitem.FieldType: - m.ResetType() - return nil - case billinginvoiceitem.FieldName: - m.ResetName() - return nil - case billinginvoiceitem.FieldQuantity: - m.ResetQuantity() - return nil - case billinginvoiceitem.FieldUnitPrice: + case billinginvoicemanuallineconfig.FieldUnitPrice: m.ResetUnitPrice() return nil - case billinginvoiceitem.FieldCurrency: - m.ResetCurrency() - return nil - case billinginvoiceitem.FieldTaxCodeOverride: - m.ResetTaxCodeOverride() - return nil } - return fmt.Errorf("unknown BillingInvoiceItem field %s", name) + return fmt.Errorf("unknown BillingInvoiceManualLineConfig field %s", name) } // AddedEdges returns all edge names that were set/added in this mutation. -func (m *BillingInvoiceItemMutation) AddedEdges() []string { - edges := make([]string, 0, 1) - if m.billing_invoice != nil { - edges = append(edges, billinginvoiceitem.EdgeBillingInvoice) - } +func (m *BillingInvoiceManualLineConfigMutation) AddedEdges() []string { + edges := make([]string, 0, 0) return edges } // AddedIDs returns all IDs (to other nodes) that were added for the given edge // name in this mutation. -func (m *BillingInvoiceItemMutation) AddedIDs(name string) []ent.Value { - switch name { - case billinginvoiceitem.EdgeBillingInvoice: - if id := m.billing_invoice; id != nil { - return []ent.Value{*id} - } - } +func (m *BillingInvoiceManualLineConfigMutation) AddedIDs(name string) []ent.Value { return nil } // RemovedEdges returns all edge names that were removed in this mutation. -func (m *BillingInvoiceItemMutation) RemovedEdges() []string { - edges := make([]string, 0, 1) +func (m *BillingInvoiceManualLineConfigMutation) RemovedEdges() []string { + edges := make([]string, 0, 0) return edges } // RemovedIDs returns all IDs (to other nodes) that were removed for the edge with // the given name in this mutation. -func (m *BillingInvoiceItemMutation) RemovedIDs(name string) []ent.Value { +func (m *BillingInvoiceManualLineConfigMutation) RemovedIDs(name string) []ent.Value { return nil } // ClearedEdges returns all edge names that were cleared in this mutation. -func (m *BillingInvoiceItemMutation) ClearedEdges() []string { - edges := make([]string, 0, 1) - if m.clearedbilling_invoice { - edges = append(edges, billinginvoiceitem.EdgeBillingInvoice) - } +func (m *BillingInvoiceManualLineConfigMutation) ClearedEdges() []string { + edges := make([]string, 0, 0) return edges } // EdgeCleared returns a boolean which indicates if the edge with the given name // was cleared in this mutation. -func (m *BillingInvoiceItemMutation) EdgeCleared(name string) bool { - switch name { - case billinginvoiceitem.EdgeBillingInvoice: - return m.clearedbilling_invoice - } +func (m *BillingInvoiceManualLineConfigMutation) EdgeCleared(name string) bool { return false } // ClearEdge clears the value of the edge with the given name. It returns an error // if that edge is not defined in the schema. -func (m *BillingInvoiceItemMutation) ClearEdge(name string) error { - switch name { - case billinginvoiceitem.EdgeBillingInvoice: - m.ClearBillingInvoice() - return nil - } - return fmt.Errorf("unknown BillingInvoiceItem unique edge %s", name) +func (m *BillingInvoiceManualLineConfigMutation) ClearEdge(name string) error { + return fmt.Errorf("unknown BillingInvoiceManualLineConfig unique edge %s", name) } // ResetEdge resets all changes to the edge with the given name in this mutation. // It returns an error if the edge is not defined in the schema. -func (m *BillingInvoiceItemMutation) ResetEdge(name string) error { - switch name { - case billinginvoiceitem.EdgeBillingInvoice: - m.ResetBillingInvoice() - return nil - } - return fmt.Errorf("unknown BillingInvoiceItem edge %s", name) +func (m *BillingInvoiceManualLineConfigMutation) ResetEdge(name string) error { + return fmt.Errorf("unknown BillingInvoiceManualLineConfig edge %s", name) } // BillingProfileMutation represents an operation that mutates the BillingProfile nodes in the graph. @@ -10628,7 +13162,7 @@ type BillingWorkflowConfigMutation struct { updated_at *time.Time deleted_at *time.Time collection_alignment *billingentity.AlignmentKind - item_collection_period *datex.ISOString + line_collection_period *datex.ISOString invoice_auto_advance *bool invoice_draft_period *datex.ISOString invoice_due_after *datex.ISOString @@ -10940,40 +13474,40 @@ func (m *BillingWorkflowConfigMutation) ResetCollectionAlignment() { m.collection_alignment = nil } -// SetItemCollectionPeriod sets the "item_collection_period" field. -func (m *BillingWorkflowConfigMutation) SetItemCollectionPeriod(ds datex.ISOString) { - m.item_collection_period = &ds +// SetLineCollectionPeriod sets the "line_collection_period" field. +func (m *BillingWorkflowConfigMutation) SetLineCollectionPeriod(ds datex.ISOString) { + m.line_collection_period = &ds } -// ItemCollectionPeriod returns the value of the "item_collection_period" field in the mutation. -func (m *BillingWorkflowConfigMutation) ItemCollectionPeriod() (r datex.ISOString, exists bool) { - v := m.item_collection_period +// LineCollectionPeriod returns the value of the "line_collection_period" field in the mutation. +func (m *BillingWorkflowConfigMutation) LineCollectionPeriod() (r datex.ISOString, exists bool) { + v := m.line_collection_period if v == nil { return } return *v, true } -// OldItemCollectionPeriod returns the old "item_collection_period" field's value of the BillingWorkflowConfig entity. +// OldLineCollectionPeriod returns the old "line_collection_period" field's value of the BillingWorkflowConfig entity. // If the BillingWorkflowConfig object wasn't provided to the builder, the object is fetched from the database. // An error is returned if the mutation operation is not UpdateOne, or the database query fails. -func (m *BillingWorkflowConfigMutation) OldItemCollectionPeriod(ctx context.Context) (v datex.ISOString, err error) { +func (m *BillingWorkflowConfigMutation) OldLineCollectionPeriod(ctx context.Context) (v datex.ISOString, err error) { if !m.op.Is(OpUpdateOne) { - return v, errors.New("OldItemCollectionPeriod is only allowed on UpdateOne operations") + return v, errors.New("OldLineCollectionPeriod is only allowed on UpdateOne operations") } if m.id == nil || m.oldValue == nil { - return v, errors.New("OldItemCollectionPeriod requires an ID field in the mutation") + return v, errors.New("OldLineCollectionPeriod requires an ID field in the mutation") } oldValue, err := m.oldValue(ctx) if err != nil { - return v, fmt.Errorf("querying old value for OldItemCollectionPeriod: %w", err) + return v, fmt.Errorf("querying old value for OldLineCollectionPeriod: %w", err) } - return oldValue.ItemCollectionPeriod, nil + return oldValue.LineCollectionPeriod, nil } -// ResetItemCollectionPeriod resets all changes to the "item_collection_period" field. -func (m *BillingWorkflowConfigMutation) ResetItemCollectionPeriod() { - m.item_collection_period = nil +// ResetLineCollectionPeriod resets all changes to the "line_collection_period" field. +func (m *BillingWorkflowConfigMutation) ResetLineCollectionPeriod() { + m.line_collection_period = nil } // SetInvoiceAutoAdvance sets the "invoice_auto_advance" field. @@ -11248,8 +13782,8 @@ func (m *BillingWorkflowConfigMutation) Fields() []string { if m.collection_alignment != nil { fields = append(fields, billingworkflowconfig.FieldCollectionAlignment) } - if m.item_collection_period != nil { - fields = append(fields, billingworkflowconfig.FieldItemCollectionPeriod) + if m.line_collection_period != nil { + fields = append(fields, billingworkflowconfig.FieldLineCollectionPeriod) } if m.invoice_auto_advance != nil { fields = append(fields, billingworkflowconfig.FieldInvoiceAutoAdvance) @@ -11281,8 +13815,8 @@ func (m *BillingWorkflowConfigMutation) Field(name string) (ent.Value, bool) { return m.DeletedAt() case billingworkflowconfig.FieldCollectionAlignment: return m.CollectionAlignment() - case billingworkflowconfig.FieldItemCollectionPeriod: - return m.ItemCollectionPeriod() + case billingworkflowconfig.FieldLineCollectionPeriod: + return m.LineCollectionPeriod() case billingworkflowconfig.FieldInvoiceAutoAdvance: return m.InvoiceAutoAdvance() case billingworkflowconfig.FieldInvoiceDraftPeriod: @@ -11310,8 +13844,8 @@ func (m *BillingWorkflowConfigMutation) OldField(ctx context.Context, name strin return m.OldDeletedAt(ctx) case billingworkflowconfig.FieldCollectionAlignment: return m.OldCollectionAlignment(ctx) - case billingworkflowconfig.FieldItemCollectionPeriod: - return m.OldItemCollectionPeriod(ctx) + case billingworkflowconfig.FieldLineCollectionPeriod: + return m.OldLineCollectionPeriod(ctx) case billingworkflowconfig.FieldInvoiceAutoAdvance: return m.OldInvoiceAutoAdvance(ctx) case billingworkflowconfig.FieldInvoiceDraftPeriod: @@ -11364,12 +13898,12 @@ func (m *BillingWorkflowConfigMutation) SetField(name string, value ent.Value) e } m.SetCollectionAlignment(v) return nil - case billingworkflowconfig.FieldItemCollectionPeriod: + case billingworkflowconfig.FieldLineCollectionPeriod: v, ok := value.(datex.ISOString) if !ok { return fmt.Errorf("unexpected type %T for field %s", value, name) } - m.SetItemCollectionPeriod(v) + m.SetLineCollectionPeriod(v) return nil case billingworkflowconfig.FieldInvoiceAutoAdvance: v, ok := value.(bool) @@ -11472,8 +14006,8 @@ func (m *BillingWorkflowConfigMutation) ResetField(name string) error { case billingworkflowconfig.FieldCollectionAlignment: m.ResetCollectionAlignment() return nil - case billingworkflowconfig.FieldItemCollectionPeriod: - m.ResetItemCollectionPeriod() + case billingworkflowconfig.FieldLineCollectionPeriod: + m.ResetLineCollectionPeriod() return nil case billingworkflowconfig.FieldInvoiceAutoAdvance: m.ResetInvoiceAutoAdvance() @@ -11615,6 +14149,9 @@ type CustomerMutation struct { clearedsubjects bool billing_customer_override *string clearedbilling_customer_override bool + billing_invoice map[string]struct{} + removedbilling_invoice map[string]struct{} + clearedbilling_invoice bool done bool oldValue func(context.Context) (*Customer, error) predicates []predicate.Customer @@ -12652,6 +15189,60 @@ func (m *CustomerMutation) ResetBillingCustomerOverride() { m.clearedbilling_customer_override = false } +// AddBillingInvoiceIDs adds the "billing_invoice" edge to the BillingInvoice entity by ids. +func (m *CustomerMutation) AddBillingInvoiceIDs(ids ...string) { + if m.billing_invoice == nil { + m.billing_invoice = make(map[string]struct{}) + } + for i := range ids { + m.billing_invoice[ids[i]] = struct{}{} + } +} + +// ClearBillingInvoice clears the "billing_invoice" edge to the BillingInvoice entity. +func (m *CustomerMutation) ClearBillingInvoice() { + m.clearedbilling_invoice = true +} + +// BillingInvoiceCleared reports if the "billing_invoice" edge to the BillingInvoice entity was cleared. +func (m *CustomerMutation) BillingInvoiceCleared() bool { + return m.clearedbilling_invoice +} + +// RemoveBillingInvoiceIDs removes the "billing_invoice" edge to the BillingInvoice entity by IDs. +func (m *CustomerMutation) RemoveBillingInvoiceIDs(ids ...string) { + if m.removedbilling_invoice == nil { + m.removedbilling_invoice = make(map[string]struct{}) + } + for i := range ids { + delete(m.billing_invoice, ids[i]) + m.removedbilling_invoice[ids[i]] = struct{}{} + } +} + +// RemovedBillingInvoice returns the removed IDs of the "billing_invoice" edge to the BillingInvoice entity. +func (m *CustomerMutation) RemovedBillingInvoiceIDs() (ids []string) { + for id := range m.removedbilling_invoice { + ids = append(ids, id) + } + return +} + +// BillingInvoiceIDs returns the "billing_invoice" edge IDs in the mutation. +func (m *CustomerMutation) BillingInvoiceIDs() (ids []string) { + for id := range m.billing_invoice { + ids = append(ids, id) + } + return +} + +// ResetBillingInvoice resets all changes to the "billing_invoice" edge. +func (m *CustomerMutation) ResetBillingInvoice() { + m.billing_invoice = nil + m.clearedbilling_invoice = false + m.removedbilling_invoice = nil +} + // Where appends a list predicates to the CustomerMutation builder. func (m *CustomerMutation) Where(ps ...predicate.Customer) { m.predicates = append(m.predicates, ps...) @@ -13138,7 +15729,7 @@ func (m *CustomerMutation) ResetField(name string) error { // AddedEdges returns all edge names that were set/added in this mutation. func (m *CustomerMutation) AddedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.apps != nil { edges = append(edges, customer.EdgeApps) } @@ -13148,6 +15739,9 @@ func (m *CustomerMutation) AddedEdges() []string { if m.billing_customer_override != nil { edges = append(edges, customer.EdgeBillingCustomerOverride) } + if m.billing_invoice != nil { + edges = append(edges, customer.EdgeBillingInvoice) + } return edges } @@ -13171,19 +15765,28 @@ func (m *CustomerMutation) AddedIDs(name string) []ent.Value { if id := m.billing_customer_override; id != nil { return []ent.Value{*id} } + case customer.EdgeBillingInvoice: + ids := make([]ent.Value, 0, len(m.billing_invoice)) + for id := range m.billing_invoice { + ids = append(ids, id) + } + return ids } return nil } // RemovedEdges returns all edge names that were removed in this mutation. func (m *CustomerMutation) RemovedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.removedapps != nil { edges = append(edges, customer.EdgeApps) } if m.removedsubjects != nil { edges = append(edges, customer.EdgeSubjects) } + if m.removedbilling_invoice != nil { + edges = append(edges, customer.EdgeBillingInvoice) + } return edges } @@ -13203,13 +15806,19 @@ func (m *CustomerMutation) RemovedIDs(name string) []ent.Value { ids = append(ids, id) } return ids + case customer.EdgeBillingInvoice: + ids := make([]ent.Value, 0, len(m.removedbilling_invoice)) + for id := range m.removedbilling_invoice { + ids = append(ids, id) + } + return ids } return nil } // ClearedEdges returns all edge names that were cleared in this mutation. func (m *CustomerMutation) ClearedEdges() []string { - edges := make([]string, 0, 3) + edges := make([]string, 0, 4) if m.clearedapps { edges = append(edges, customer.EdgeApps) } @@ -13219,6 +15828,9 @@ func (m *CustomerMutation) ClearedEdges() []string { if m.clearedbilling_customer_override { edges = append(edges, customer.EdgeBillingCustomerOverride) } + if m.clearedbilling_invoice { + edges = append(edges, customer.EdgeBillingInvoice) + } return edges } @@ -13232,6 +15844,8 @@ func (m *CustomerMutation) EdgeCleared(name string) bool { return m.clearedsubjects case customer.EdgeBillingCustomerOverride: return m.clearedbilling_customer_override + case customer.EdgeBillingInvoice: + return m.clearedbilling_invoice } return false } @@ -13260,6 +15874,9 @@ func (m *CustomerMutation) ResetEdge(name string) error { case customer.EdgeBillingCustomerOverride: m.ResetBillingCustomerOverride() return nil + case customer.EdgeBillingInvoice: + m.ResetBillingInvoice() + return nil } return fmt.Errorf("unknown Customer edge %s", name) } diff --git a/openmeter/ent/db/paginate.go b/openmeter/ent/db/paginate.go index 49b5c705b..0ea2667e3 100644 --- a/openmeter/ent/db/paginate.go +++ b/openmeter/ent/db/paginate.go @@ -347,23 +347,23 @@ var _ pagination.Paginator[*BillingInvoice] = (*BillingInvoiceQuery)(nil) // Paginate runs the query and returns a paginated response. // If page is its 0 value then it will return all the items and populate the response page accordingly. -func (bii *BillingInvoiceItemQuery) Paginate(ctx context.Context, page pagination.Page) (pagination.PagedResponse[*BillingInvoiceItem], error) { +func (bil *BillingInvoiceLineQuery) Paginate(ctx context.Context, page pagination.Page) (pagination.PagedResponse[*BillingInvoiceLine], error) { // Get the limit and offset limit, offset := page.Limit(), page.Offset() // Unset previous pagination settings zero := 0 - bii.ctx.Offset = &zero - bii.ctx.Limit = &zero + bil.ctx.Offset = &zero + bil.ctx.Limit = &zero // Create duplicate of the query to run for - countQuery := bii.Clone() - pagedQuery := bii + countQuery := bil.Clone() + pagedQuery := bil // Unset ordering for count query countQuery.order = nil - pagedResponse := pagination.PagedResponse[*BillingInvoiceItem]{ + pagedResponse := pagination.PagedResponse[*BillingInvoiceLine]{ Page: page, } @@ -391,7 +391,55 @@ func (bii *BillingInvoiceItemQuery) Paginate(ctx context.Context, page paginatio } // type check -var _ pagination.Paginator[*BillingInvoiceItem] = (*BillingInvoiceItemQuery)(nil) +var _ pagination.Paginator[*BillingInvoiceLine] = (*BillingInvoiceLineQuery)(nil) + +// Paginate runs the query and returns a paginated response. +// If page is its 0 value then it will return all the items and populate the response page accordingly. +func (bimlc *BillingInvoiceManualLineConfigQuery) Paginate(ctx context.Context, page pagination.Page) (pagination.PagedResponse[*BillingInvoiceManualLineConfig], error) { + // Get the limit and offset + limit, offset := page.Limit(), page.Offset() + + // Unset previous pagination settings + zero := 0 + bimlc.ctx.Offset = &zero + bimlc.ctx.Limit = &zero + + // Create duplicate of the query to run for + countQuery := bimlc.Clone() + pagedQuery := bimlc + + // Unset ordering for count query + countQuery.order = nil + + pagedResponse := pagination.PagedResponse[*BillingInvoiceManualLineConfig]{ + Page: page, + } + + // Get the total count + count, err := countQuery.Count(ctx) + if err != nil { + return pagedResponse, fmt.Errorf("failed to get count: %w", err) + } + pagedResponse.TotalCount = count + + // If page is its 0 value then return all the items + if page.IsZero() { + offset = 0 + limit = count + } + + // Set the limit and offset + pagedQuery.ctx.Limit = &limit + pagedQuery.ctx.Offset = &offset + + // Get the paged items + items, err := pagedQuery.All(ctx) + pagedResponse.Items = items + return pagedResponse, err +} + +// type check +var _ pagination.Paginator[*BillingInvoiceManualLineConfig] = (*BillingInvoiceManualLineConfigQuery)(nil) // Paginate runs the query and returns a paginated response. // If page is its 0 value then it will return all the items and populate the response page accordingly. diff --git a/openmeter/ent/db/predicate/predicate.go b/openmeter/ent/db/predicate/predicate.go index 336bb505d..8bae04c1d 100644 --- a/openmeter/ent/db/predicate/predicate.go +++ b/openmeter/ent/db/predicate/predicate.go @@ -27,8 +27,11 @@ type BillingCustomerOverride func(*sql.Selector) // BillingInvoice is the predicate function for billinginvoice builders. type BillingInvoice func(*sql.Selector) -// BillingInvoiceItem is the predicate function for billinginvoiceitem builders. -type BillingInvoiceItem func(*sql.Selector) +// BillingInvoiceLine is the predicate function for billinginvoiceline builders. +type BillingInvoiceLine func(*sql.Selector) + +// BillingInvoiceManualLineConfig is the predicate function for billinginvoicemanuallineconfig builders. +type BillingInvoiceManualLineConfig func(*sql.Selector) // BillingProfile is the predicate function for billingprofile builders. type BillingProfile func(*sql.Selector) diff --git a/openmeter/ent/db/runtime.go b/openmeter/ent/db/runtime.go index a6cbf3521..7845c1c5b 100644 --- a/openmeter/ent/db/runtime.go +++ b/openmeter/ent/db/runtime.go @@ -12,7 +12,8 @@ import ( "github.com/openmeterio/openmeter/openmeter/ent/db/balancesnapshot" "github.com/openmeterio/openmeter/openmeter/ent/db/billingcustomeroverride" "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoice" - "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceitem" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoiceline" + "github.com/openmeterio/openmeter/openmeter/ent/db/billinginvoicemanuallineconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/billingprofile" "github.com/openmeterio/openmeter/openmeter/ent/db/billingworkflowconfig" "github.com/openmeterio/openmeter/openmeter/ent/db/customer" @@ -216,8 +217,12 @@ func init() { _ = billinginvoiceMixinFields0 billinginvoiceMixinFields1 := billinginvoiceMixin[1].Fields() _ = billinginvoiceMixinFields1 - billinginvoiceMixinFields2 := billinginvoiceMixin[2].Fields() - _ = billinginvoiceMixinFields2 + billinginvoiceMixinFields3 := billinginvoiceMixin[3].Fields() + _ = billinginvoiceMixinFields3 + billinginvoiceMixinFields4 := billinginvoiceMixin[4].Fields() + _ = billinginvoiceMixinFields4 + billinginvoiceMixinFields5 := billinginvoiceMixin[5].Fields() + _ = billinginvoiceMixinFields5 billinginvoiceFields := schema.BillingInvoice{}.Fields() _ = billinginvoiceFields // billinginvoiceDescNamespace is the schema descriptor for namespace field. @@ -225,70 +230,117 @@ func init() { // billinginvoice.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. billinginvoice.NamespaceValidator = billinginvoiceDescNamespace.Validators[0].(func(string) error) // billinginvoiceDescCreatedAt is the schema descriptor for created_at field. - billinginvoiceDescCreatedAt := billinginvoiceMixinFields2[0].Descriptor() + billinginvoiceDescCreatedAt := billinginvoiceMixinFields3[0].Descriptor() // billinginvoice.DefaultCreatedAt holds the default value on creation for the created_at field. billinginvoice.DefaultCreatedAt = billinginvoiceDescCreatedAt.Default.(func() time.Time) // billinginvoiceDescUpdatedAt is the schema descriptor for updated_at field. - billinginvoiceDescUpdatedAt := billinginvoiceMixinFields2[1].Descriptor() + billinginvoiceDescUpdatedAt := billinginvoiceMixinFields3[1].Descriptor() // billinginvoice.DefaultUpdatedAt holds the default value on creation for the updated_at field. billinginvoice.DefaultUpdatedAt = billinginvoiceDescUpdatedAt.Default.(func() time.Time) // billinginvoice.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. billinginvoice.UpdateDefaultUpdatedAt = billinginvoiceDescUpdatedAt.UpdateDefault.(func() time.Time) + // billinginvoiceDescSupplierAddressCountry is the schema descriptor for supplier_address_country field. + billinginvoiceDescSupplierAddressCountry := billinginvoiceMixinFields4[0].Descriptor() + // billinginvoice.SupplierAddressCountryValidator is a validator for the "supplier_address_country" field. It is called by the builders before save. + billinginvoice.SupplierAddressCountryValidator = func() func(string) error { + validators := billinginvoiceDescSupplierAddressCountry.Validators + fns := [...]func(string) error{ + validators[0].(func(string) error), + validators[1].(func(string) error), + } + return func(supplier_address_country string) error { + for _, fn := range fns { + if err := fn(supplier_address_country); err != nil { + return err + } + } + return nil + } + }() + // billinginvoiceDescCustomerAddressCountry is the schema descriptor for customer_address_country field. + billinginvoiceDescCustomerAddressCountry := billinginvoiceMixinFields5[0].Descriptor() + // billinginvoice.CustomerAddressCountryValidator is a validator for the "customer_address_country" field. It is called by the builders before save. + billinginvoice.CustomerAddressCountryValidator = func() func(string) error { + validators := billinginvoiceDescCustomerAddressCountry.Validators + fns := [...]func(string) error{ + validators[0].(func(string) error), + validators[1].(func(string) error), + } + return func(customer_address_country string) error { + for _, fn := range fns { + if err := fn(customer_address_country); err != nil { + return err + } + } + return nil + } + }() + // billinginvoiceDescSupplierName is the schema descriptor for supplier_name field. + billinginvoiceDescSupplierName := billinginvoiceFields[0].Descriptor() + // billinginvoice.SupplierNameValidator is a validator for the "supplier_name" field. It is called by the builders before save. + billinginvoice.SupplierNameValidator = billinginvoiceDescSupplierName.Validators[0].(func(string) error) + // billinginvoiceDescCustomerName is the schema descriptor for customer_name field. + billinginvoiceDescCustomerName := billinginvoiceFields[2].Descriptor() + // billinginvoice.CustomerNameValidator is a validator for the "customer_name" field. It is called by the builders before save. + billinginvoice.CustomerNameValidator = billinginvoiceDescCustomerName.Validators[0].(func(string) error) // billinginvoiceDescCustomerID is the schema descriptor for customer_id field. - billinginvoiceDescCustomerID := billinginvoiceFields[2].Descriptor() + billinginvoiceDescCustomerID := billinginvoiceFields[7].Descriptor() // billinginvoice.CustomerIDValidator is a validator for the "customer_id" field. It is called by the builders before save. billinginvoice.CustomerIDValidator = billinginvoiceDescCustomerID.Validators[0].(func(string) error) - // billinginvoiceDescBillingProfileID is the schema descriptor for billing_profile_id field. - billinginvoiceDescBillingProfileID := billinginvoiceFields[3].Descriptor() - // billinginvoice.BillingProfileIDValidator is a validator for the "billing_profile_id" field. It is called by the builders before save. - billinginvoice.BillingProfileIDValidator = billinginvoiceDescBillingProfileID.Validators[0].(func(string) error) + // billinginvoiceDescSourceBillingProfileID is the schema descriptor for source_billing_profile_id field. + billinginvoiceDescSourceBillingProfileID := billinginvoiceFields[8].Descriptor() + // billinginvoice.SourceBillingProfileIDValidator is a validator for the "source_billing_profile_id" field. It is called by the builders before save. + billinginvoice.SourceBillingProfileIDValidator = billinginvoiceDescSourceBillingProfileID.Validators[0].(func(string) error) // billinginvoiceDescCurrency is the schema descriptor for currency field. - billinginvoiceDescCurrency := billinginvoiceFields[5].Descriptor() + billinginvoiceDescCurrency := billinginvoiceFields[11].Descriptor() // billinginvoice.CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. billinginvoice.CurrencyValidator = billinginvoiceDescCurrency.Validators[0].(func(string) error) // billinginvoiceDescID is the schema descriptor for id field. billinginvoiceDescID := billinginvoiceMixinFields0[0].Descriptor() // billinginvoice.DefaultID holds the default value on creation for the id field. billinginvoice.DefaultID = billinginvoiceDescID.Default.(func() string) - billinginvoiceitemMixin := schema.BillingInvoiceItem{}.Mixin() - billinginvoiceitemMixinFields0 := billinginvoiceitemMixin[0].Fields() - _ = billinginvoiceitemMixinFields0 - billinginvoiceitemMixinFields1 := billinginvoiceitemMixin[1].Fields() - _ = billinginvoiceitemMixinFields1 - billinginvoiceitemMixinFields2 := billinginvoiceitemMixin[2].Fields() - _ = billinginvoiceitemMixinFields2 - billinginvoiceitemFields := schema.BillingInvoiceItem{}.Fields() - _ = billinginvoiceitemFields - // billinginvoiceitemDescNamespace is the schema descriptor for namespace field. - billinginvoiceitemDescNamespace := billinginvoiceitemMixinFields1[0].Descriptor() - // billinginvoiceitem.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. - billinginvoiceitem.NamespaceValidator = billinginvoiceitemDescNamespace.Validators[0].(func(string) error) - // billinginvoiceitemDescCreatedAt is the schema descriptor for created_at field. - billinginvoiceitemDescCreatedAt := billinginvoiceitemMixinFields2[0].Descriptor() - // billinginvoiceitem.DefaultCreatedAt holds the default value on creation for the created_at field. - billinginvoiceitem.DefaultCreatedAt = billinginvoiceitemDescCreatedAt.Default.(func() time.Time) - // billinginvoiceitemDescUpdatedAt is the schema descriptor for updated_at field. - billinginvoiceitemDescUpdatedAt := billinginvoiceitemMixinFields2[1].Descriptor() - // billinginvoiceitem.DefaultUpdatedAt holds the default value on creation for the updated_at field. - billinginvoiceitem.DefaultUpdatedAt = billinginvoiceitemDescUpdatedAt.Default.(func() time.Time) - // billinginvoiceitem.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. - billinginvoiceitem.UpdateDefaultUpdatedAt = billinginvoiceitemDescUpdatedAt.UpdateDefault.(func() time.Time) - // billinginvoiceitemDescCustomerID is the schema descriptor for customer_id field. - billinginvoiceitemDescCustomerID := billinginvoiceitemFields[1].Descriptor() - // billinginvoiceitem.CustomerIDValidator is a validator for the "customer_id" field. It is called by the builders before save. - billinginvoiceitem.CustomerIDValidator = billinginvoiceitemDescCustomerID.Validators[0].(func(string) error) - // billinginvoiceitemDescName is the schema descriptor for name field. - billinginvoiceitemDescName := billinginvoiceitemFields[6].Descriptor() - // billinginvoiceitem.NameValidator is a validator for the "name" field. It is called by the builders before save. - billinginvoiceitem.NameValidator = billinginvoiceitemDescName.Validators[0].(func(string) error) - // billinginvoiceitemDescCurrency is the schema descriptor for currency field. - billinginvoiceitemDescCurrency := billinginvoiceitemFields[9].Descriptor() - // billinginvoiceitem.CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. - billinginvoiceitem.CurrencyValidator = billinginvoiceitemDescCurrency.Validators[0].(func(string) error) - // billinginvoiceitemDescID is the schema descriptor for id field. - billinginvoiceitemDescID := billinginvoiceitemMixinFields0[0].Descriptor() - // billinginvoiceitem.DefaultID holds the default value on creation for the id field. - billinginvoiceitem.DefaultID = billinginvoiceitemDescID.Default.(func() string) + billinginvoicelineMixin := schema.BillingInvoiceLine{}.Mixin() + billinginvoicelineMixinFields0 := billinginvoicelineMixin[0].Fields() + _ = billinginvoicelineMixinFields0 + billinginvoicelineFields := schema.BillingInvoiceLine{}.Fields() + _ = billinginvoicelineFields + // billinginvoicelineDescNamespace is the schema descriptor for namespace field. + billinginvoicelineDescNamespace := billinginvoicelineMixinFields0[1].Descriptor() + // billinginvoiceline.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + billinginvoiceline.NamespaceValidator = billinginvoicelineDescNamespace.Validators[0].(func(string) error) + // billinginvoicelineDescCreatedAt is the schema descriptor for created_at field. + billinginvoicelineDescCreatedAt := billinginvoicelineMixinFields0[3].Descriptor() + // billinginvoiceline.DefaultCreatedAt holds the default value on creation for the created_at field. + billinginvoiceline.DefaultCreatedAt = billinginvoicelineDescCreatedAt.Default.(func() time.Time) + // billinginvoicelineDescUpdatedAt is the schema descriptor for updated_at field. + billinginvoicelineDescUpdatedAt := billinginvoicelineMixinFields0[4].Descriptor() + // billinginvoiceline.DefaultUpdatedAt holds the default value on creation for the updated_at field. + billinginvoiceline.DefaultUpdatedAt = billinginvoicelineDescUpdatedAt.Default.(func() time.Time) + // billinginvoiceline.UpdateDefaultUpdatedAt holds the default value on update for the updated_at field. + billinginvoiceline.UpdateDefaultUpdatedAt = billinginvoicelineDescUpdatedAt.UpdateDefault.(func() time.Time) + // billinginvoicelineDescCurrency is the schema descriptor for currency field. + billinginvoicelineDescCurrency := billinginvoicelineFields[6].Descriptor() + // billinginvoiceline.CurrencyValidator is a validator for the "currency" field. It is called by the builders before save. + billinginvoiceline.CurrencyValidator = billinginvoicelineDescCurrency.Validators[0].(func(string) error) + // billinginvoicelineDescID is the schema descriptor for id field. + billinginvoicelineDescID := billinginvoicelineMixinFields0[0].Descriptor() + // billinginvoiceline.DefaultID holds the default value on creation for the id field. + billinginvoiceline.DefaultID = billinginvoicelineDescID.Default.(func() string) + billinginvoicemanuallineconfigMixin := schema.BillingInvoiceManualLineConfig{}.Mixin() + billinginvoicemanuallineconfigMixinFields0 := billinginvoicemanuallineconfigMixin[0].Fields() + _ = billinginvoicemanuallineconfigMixinFields0 + billinginvoicemanuallineconfigMixinFields1 := billinginvoicemanuallineconfigMixin[1].Fields() + _ = billinginvoicemanuallineconfigMixinFields1 + billinginvoicemanuallineconfigFields := schema.BillingInvoiceManualLineConfig{}.Fields() + _ = billinginvoicemanuallineconfigFields + // billinginvoicemanuallineconfigDescNamespace is the schema descriptor for namespace field. + billinginvoicemanuallineconfigDescNamespace := billinginvoicemanuallineconfigMixinFields0[0].Descriptor() + // billinginvoicemanuallineconfig.NamespaceValidator is a validator for the "namespace" field. It is called by the builders before save. + billinginvoicemanuallineconfig.NamespaceValidator = billinginvoicemanuallineconfigDescNamespace.Validators[0].(func(string) error) + // billinginvoicemanuallineconfigDescID is the schema descriptor for id field. + billinginvoicemanuallineconfigDescID := billinginvoicemanuallineconfigMixinFields1[0].Descriptor() + // billinginvoicemanuallineconfig.DefaultID holds the default value on creation for the id field. + billinginvoicemanuallineconfig.DefaultID = billinginvoicemanuallineconfigDescID.Default.(func() string) billingprofileMixin := schema.BillingProfile{}.Mixin() billingprofileMixinFields0 := billingprofileMixin[0].Fields() _ = billingprofileMixinFields0 diff --git a/openmeter/ent/db/setorclear.go b/openmeter/ent/db/setorclear.go index 8a67dfb0f..4bd88a69a 100644 --- a/openmeter/ent/db/setorclear.go +++ b/openmeter/ent/db/setorclear.go @@ -167,18 +167,18 @@ func (u *BillingCustomerOverrideUpdateOne) SetOrClearCollectionAlignment(value * return u.SetCollectionAlignment(*value) } -func (u *BillingCustomerOverrideUpdate) SetOrClearItemCollectionPeriod(value *datex.ISOString) *BillingCustomerOverrideUpdate { +func (u *BillingCustomerOverrideUpdate) SetOrClearLineCollectionPeriod(value *datex.ISOString) *BillingCustomerOverrideUpdate { if value == nil { - return u.ClearItemCollectionPeriod() + return u.ClearLineCollectionPeriod() } - return u.SetItemCollectionPeriod(*value) + return u.SetLineCollectionPeriod(*value) } -func (u *BillingCustomerOverrideUpdateOne) SetOrClearItemCollectionPeriod(value *datex.ISOString) *BillingCustomerOverrideUpdateOne { +func (u *BillingCustomerOverrideUpdateOne) SetOrClearLineCollectionPeriod(value *datex.ISOString) *BillingCustomerOverrideUpdateOne { if value == nil { - return u.ClearItemCollectionPeriod() + return u.ClearLineCollectionPeriod() } - return u.SetItemCollectionPeriod(*value) + return u.SetLineCollectionPeriod(*value) } func (u *BillingCustomerOverrideUpdate) SetOrClearInvoiceAutoAdvance(value *bool) *BillingCustomerOverrideUpdate { @@ -237,6 +237,20 @@ func (u *BillingCustomerOverrideUpdateOne) SetOrClearInvoiceCollectionMethod(val return u.SetInvoiceCollectionMethod(*value) } +func (u *BillingInvoiceUpdate) SetOrClearMetadata(value *map[string]string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearMetadata() + } + return u.SetMetadata(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearMetadata(value *map[string]string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearMetadata() + } + return u.SetMetadata(*value) +} + func (u *BillingInvoiceUpdate) SetOrClearDeletedAt(value *time.Time) *BillingInvoiceUpdate { if value == nil { return u.ClearDeletedAt() @@ -251,46 +265,256 @@ func (u *BillingInvoiceUpdateOne) SetOrClearDeletedAt(value *time.Time) *Billing return u.SetDeletedAt(*value) } -func (u *BillingInvoiceUpdate) SetOrClearMetadata(value *map[string]string) *BillingInvoiceUpdate { +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressCountry(value *models.CountryCode) *BillingInvoiceUpdate { if value == nil { - return u.ClearMetadata() + return u.ClearSupplierAddressCountry() } - return u.SetMetadata(*value) + return u.SetSupplierAddressCountry(*value) } -func (u *BillingInvoiceUpdateOne) SetOrClearMetadata(value *map[string]string) *BillingInvoiceUpdateOne { +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressCountry(value *models.CountryCode) *BillingInvoiceUpdateOne { if value == nil { - return u.ClearMetadata() + return u.ClearSupplierAddressCountry() } - return u.SetMetadata(*value) + return u.SetSupplierAddressCountry(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressPostalCode(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressPostalCode() + } + return u.SetSupplierAddressPostalCode(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressPostalCode(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressPostalCode() + } + return u.SetSupplierAddressPostalCode(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressState(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressState() + } + return u.SetSupplierAddressState(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressState(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressState() + } + return u.SetSupplierAddressState(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressCity(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressCity() + } + return u.SetSupplierAddressCity(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressCity(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressCity() + } + return u.SetSupplierAddressCity(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressLine1(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressLine1() + } + return u.SetSupplierAddressLine1(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressLine1(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressLine1() + } + return u.SetSupplierAddressLine1(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressLine2(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressLine2() + } + return u.SetSupplierAddressLine2(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressLine2(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressLine2() + } + return u.SetSupplierAddressLine2(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierAddressPhoneNumber(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierAddressPhoneNumber() + } + return u.SetSupplierAddressPhoneNumber(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierAddressPhoneNumber(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierAddressPhoneNumber() + } + return u.SetSupplierAddressPhoneNumber(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressCountry(value *models.CountryCode) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressCountry() + } + return u.SetCustomerAddressCountry(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressCountry(value *models.CountryCode) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressCountry() + } + return u.SetCustomerAddressCountry(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressPostalCode(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressPostalCode() + } + return u.SetCustomerAddressPostalCode(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressPostalCode(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressPostalCode() + } + return u.SetCustomerAddressPostalCode(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressState(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressState() + } + return u.SetCustomerAddressState(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressState(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressState() + } + return u.SetCustomerAddressState(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressCity(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressCity() + } + return u.SetCustomerAddressCity(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressCity(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressCity() + } + return u.SetCustomerAddressCity(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressLine1(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressLine1() + } + return u.SetCustomerAddressLine1(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressLine1(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressLine1() + } + return u.SetCustomerAddressLine1(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressLine2(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressLine2() + } + return u.SetCustomerAddressLine2(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressLine2(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressLine2() + } + return u.SetCustomerAddressLine2(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerAddressPhoneNumber(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerAddressPhoneNumber() + } + return u.SetCustomerAddressPhoneNumber(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerAddressPhoneNumber(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerAddressPhoneNumber() + } + return u.SetCustomerAddressPhoneNumber(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearSupplierTaxCode(value *string) *BillingInvoiceUpdate { + if value == nil { + return u.ClearSupplierTaxCode() + } + return u.SetSupplierTaxCode(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearSupplierTaxCode(value *string) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearSupplierTaxCode() + } + return u.SetSupplierTaxCode(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearCustomerTimezone(value *timezone.Timezone) *BillingInvoiceUpdate { + if value == nil { + return u.ClearCustomerTimezone() + } + return u.SetCustomerTimezone(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearCustomerTimezone(value *timezone.Timezone) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearCustomerTimezone() + } + return u.SetCustomerTimezone(*value) } -func (u *BillingInvoiceUpdate) SetOrClearSeries(value *string) *BillingInvoiceUpdate { +func (u *BillingInvoiceUpdate) SetOrClearNumber(value *string) *BillingInvoiceUpdate { if value == nil { - return u.ClearSeries() + return u.ClearNumber() } - return u.SetSeries(*value) + return u.SetNumber(*value) } -func (u *BillingInvoiceUpdateOne) SetOrClearSeries(value *string) *BillingInvoiceUpdateOne { +func (u *BillingInvoiceUpdateOne) SetOrClearNumber(value *string) *BillingInvoiceUpdateOne { if value == nil { - return u.ClearSeries() + return u.ClearNumber() } - return u.SetSeries(*value) + return u.SetNumber(*value) } -func (u *BillingInvoiceUpdate) SetOrClearCode(value *string) *BillingInvoiceUpdate { +func (u *BillingInvoiceUpdate) SetOrClearDescription(value *string) *BillingInvoiceUpdate { if value == nil { - return u.ClearCode() + return u.ClearDescription() } - return u.SetCode(*value) + return u.SetDescription(*value) } -func (u *BillingInvoiceUpdateOne) SetOrClearCode(value *string) *BillingInvoiceUpdateOne { +func (u *BillingInvoiceUpdateOne) SetOrClearDescription(value *string) *BillingInvoiceUpdateOne { if value == nil { - return u.ClearCode() + return u.ClearDescription() } - return u.SetCode(*value) + return u.SetDescription(*value) } func (u *BillingInvoiceUpdate) SetOrClearVoidedAt(value *time.Time) *BillingInvoiceUpdate { @@ -307,62 +531,132 @@ func (u *BillingInvoiceUpdateOne) SetOrClearVoidedAt(value *time.Time) *BillingI return u.SetVoidedAt(*value) } -func (u *BillingInvoiceItemUpdate) SetOrClearDeletedAt(value *time.Time) *BillingInvoiceItemUpdate { +func (u *BillingInvoiceUpdate) SetOrClearIssuedAt(value *time.Time) *BillingInvoiceUpdate { if value == nil { - return u.ClearDeletedAt() + return u.ClearIssuedAt() } - return u.SetDeletedAt(*value) + return u.SetIssuedAt(*value) } -func (u *BillingInvoiceItemUpdateOne) SetOrClearDeletedAt(value *time.Time) *BillingInvoiceItemUpdateOne { +func (u *BillingInvoiceUpdateOne) SetOrClearIssuedAt(value *time.Time) *BillingInvoiceUpdateOne { if value == nil { - return u.ClearDeletedAt() + return u.ClearIssuedAt() } - return u.SetDeletedAt(*value) + return u.SetIssuedAt(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearDueAt(value *time.Time) *BillingInvoiceUpdate { + if value == nil { + return u.ClearDueAt() + } + return u.SetDueAt(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearDueAt(value *time.Time) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearDueAt() + } + return u.SetDueAt(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearPeriodStart(value *time.Time) *BillingInvoiceUpdate { + if value == nil { + return u.ClearPeriodStart() + } + return u.SetPeriodStart(*value) +} + +func (u *BillingInvoiceUpdateOne) SetOrClearPeriodStart(value *time.Time) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearPeriodStart() + } + return u.SetPeriodStart(*value) +} + +func (u *BillingInvoiceUpdate) SetOrClearPeriodEnd(value *time.Time) *BillingInvoiceUpdate { + if value == nil { + return u.ClearPeriodEnd() + } + return u.SetPeriodEnd(*value) } -func (u *BillingInvoiceItemUpdate) SetOrClearMetadata(value *map[string]string) *BillingInvoiceItemUpdate { +func (u *BillingInvoiceUpdateOne) SetOrClearPeriodEnd(value *time.Time) *BillingInvoiceUpdateOne { + if value == nil { + return u.ClearPeriodEnd() + } + return u.SetPeriodEnd(*value) +} + +func (u *BillingInvoiceLineUpdate) SetOrClearMetadata(value *map[string]string) *BillingInvoiceLineUpdate { if value == nil { return u.ClearMetadata() } return u.SetMetadata(*value) } -func (u *BillingInvoiceItemUpdateOne) SetOrClearMetadata(value *map[string]string) *BillingInvoiceItemUpdateOne { +func (u *BillingInvoiceLineUpdateOne) SetOrClearMetadata(value *map[string]string) *BillingInvoiceLineUpdateOne { if value == nil { return u.ClearMetadata() } return u.SetMetadata(*value) } -func (u *BillingInvoiceItemUpdate) SetOrClearInvoiceID(value *string) *BillingInvoiceItemUpdate { +func (u *BillingInvoiceLineUpdate) SetOrClearDeletedAt(value *time.Time) *BillingInvoiceLineUpdate { + if value == nil { + return u.ClearDeletedAt() + } + return u.SetDeletedAt(*value) +} + +func (u *BillingInvoiceLineUpdateOne) SetOrClearDeletedAt(value *time.Time) *BillingInvoiceLineUpdateOne { + if value == nil { + return u.ClearDeletedAt() + } + return u.SetDeletedAt(*value) +} + +func (u *BillingInvoiceLineUpdate) SetOrClearDescription(value *string) *BillingInvoiceLineUpdate { if value == nil { - return u.ClearInvoiceID() + return u.ClearDescription() } - return u.SetInvoiceID(*value) + return u.SetDescription(*value) } -func (u *BillingInvoiceItemUpdateOne) SetOrClearInvoiceID(value *string) *BillingInvoiceItemUpdateOne { +func (u *BillingInvoiceLineUpdateOne) SetOrClearDescription(value *string) *BillingInvoiceLineUpdateOne { if value == nil { - return u.ClearInvoiceID() + return u.ClearDescription() } - return u.SetInvoiceID(*value) + return u.SetDescription(*value) } -func (u *BillingInvoiceItemUpdate) SetOrClearQuantity(value *alpacadecimal.Decimal) *BillingInvoiceItemUpdate { +func (u *BillingInvoiceLineUpdate) SetOrClearQuantity(value *alpacadecimal.Decimal) *BillingInvoiceLineUpdate { if value == nil { return u.ClearQuantity() } return u.SetQuantity(*value) } -func (u *BillingInvoiceItemUpdateOne) SetOrClearQuantity(value *alpacadecimal.Decimal) *BillingInvoiceItemUpdateOne { +func (u *BillingInvoiceLineUpdateOne) SetOrClearQuantity(value *alpacadecimal.Decimal) *BillingInvoiceLineUpdateOne { if value == nil { return u.ClearQuantity() } return u.SetQuantity(*value) } +func (u *BillingInvoiceLineUpdate) SetOrClearTaxOverrides(value **billingentity.TaxOverrides) *BillingInvoiceLineUpdate { + if value == nil { + return u.ClearTaxOverrides() + } + return u.SetTaxOverrides(*value) +} + +func (u *BillingInvoiceLineUpdateOne) SetOrClearTaxOverrides(value **billingentity.TaxOverrides) *BillingInvoiceLineUpdateOne { + if value == nil { + return u.ClearTaxOverrides() + } + return u.SetTaxOverrides(*value) +} + func (u *BillingProfileUpdate) SetOrClearMetadata(value *map[string]string) *BillingProfileUpdate { if value == nil { return u.ClearMetadata() diff --git a/openmeter/ent/db/tx.go b/openmeter/ent/db/tx.go index e546fa25a..31b1a9e25 100644 --- a/openmeter/ent/db/tx.go +++ b/openmeter/ent/db/tx.go @@ -28,8 +28,10 @@ type Tx struct { BillingCustomerOverride *BillingCustomerOverrideClient // BillingInvoice is the client for interacting with the BillingInvoice builders. BillingInvoice *BillingInvoiceClient - // BillingInvoiceItem is the client for interacting with the BillingInvoiceItem builders. - BillingInvoiceItem *BillingInvoiceItemClient + // BillingInvoiceLine is the client for interacting with the BillingInvoiceLine builders. + BillingInvoiceLine *BillingInvoiceLineClient + // BillingInvoiceManualLineConfig is the client for interacting with the BillingInvoiceManualLineConfig builders. + BillingInvoiceManualLineConfig *BillingInvoiceManualLineConfigClient // BillingProfile is the client for interacting with the BillingProfile builders. BillingProfile *BillingProfileClient // BillingWorkflowConfig is the client for interacting with the BillingWorkflowConfig builders. @@ -192,7 +194,8 @@ func (tx *Tx) init() { tx.BalanceSnapshot = NewBalanceSnapshotClient(tx.config) tx.BillingCustomerOverride = NewBillingCustomerOverrideClient(tx.config) tx.BillingInvoice = NewBillingInvoiceClient(tx.config) - tx.BillingInvoiceItem = NewBillingInvoiceItemClient(tx.config) + tx.BillingInvoiceLine = NewBillingInvoiceLineClient(tx.config) + tx.BillingInvoiceManualLineConfig = NewBillingInvoiceManualLineConfigClient(tx.config) tx.BillingProfile = NewBillingProfileClient(tx.config) tx.BillingWorkflowConfig = NewBillingWorkflowConfigClient(tx.config) tx.Customer = NewCustomerClient(tx.config) diff --git a/openmeter/ent/schema/app.go b/openmeter/ent/schema/app.go index ab675dbe4..00ff49bdc 100644 --- a/openmeter/ent/schema/app.go +++ b/openmeter/ent/schema/app.go @@ -46,9 +46,12 @@ func (App) Edges() []ent.Edge { return []ent.Edge{ edge.To("customer_apps", AppCustomer.Type). Annotations(entsql.OnDelete(entsql.Cascade)), - edge.To("tax_app", BillingProfile.Type), - edge.To("invoicing_app", BillingProfile.Type), - edge.To("payment_app", BillingProfile.Type), + edge.To("billing_profile_tax_app", BillingProfile.Type), + edge.To("billing_profile_invoicing_app", BillingProfile.Type), + edge.To("billing_profile_payment_app", BillingProfile.Type), + edge.To("billing_invoice_tax_app", BillingInvoice.Type), + edge.To("billing_invoice_invoicing_app", BillingInvoice.Type), + edge.To("billing_invoice_payment_app", BillingInvoice.Type), } } diff --git a/openmeter/ent/schema/billing.go b/openmeter/ent/schema/billing.go index 58dd5b14d..9d41b479b 100644 --- a/openmeter/ent/schema/billing.go +++ b/openmeter/ent/schema/billing.go @@ -12,6 +12,7 @@ import ( "github.com/openmeterio/openmeter/pkg/currencyx" "github.com/openmeterio/openmeter/pkg/datex" "github.com/openmeterio/openmeter/pkg/framework/entutils" + "github.com/openmeterio/openmeter/pkg/timezone" ) type BillingProfile struct { @@ -66,19 +67,19 @@ func (BillingProfile) Edges() []ent.Edge { Unique(). Required(), edge.From("tax_app", App.Type). - Ref("tax_app"). + Ref("billing_profile_tax_app"). Field("tax_app_id"). Unique(). Immutable(). Required(), edge.From("invoicing_app", App.Type). - Ref("invoicing_app"). + Ref("billing_profile_invoicing_app"). Field("invoicing_app_id"). Unique(). Immutable(). Required(), edge.From("payment_app", App.Type). - Ref("payment_app"). + Ref("billing_profile_payment_app"). Field("payment_app_id"). Unique(). Immutable(). @@ -111,7 +112,7 @@ func (BillingWorkflowConfig) Fields() []ent.Field { field.Enum("collection_alignment"). GoType(billingentity.AlignmentKind("")), - field.String("item_collection_period").GoType(datex.ISOString("")), + field.String("line_collection_period").GoType(datex.ISOString("")), field.Bool("invoice_auto_advance"), @@ -177,7 +178,7 @@ func (BillingCustomerOverride) Fields() []ent.Field { Optional(). Nillable(), - field.String("item_collection_period"). + field.String("line_collection_period"). GoType(datex.ISOString("")). Optional(). Nillable(), @@ -225,30 +226,19 @@ func (BillingCustomerOverride) Edges() []ent.Edge { } } -type BillingInvoiceItem struct { +type BillingInvoiceLine struct { ent.Schema } -func (BillingInvoiceItem) Mixin() []ent.Mixin { +func (BillingInvoiceLine) Mixin() []ent.Mixin { return []ent.Mixin{ - entutils.IDMixin{}, - entutils.NamespaceMixin{}, - entutils.TimeMixin{}, - entutils.MetadataAnnotationsMixin{}, + entutils.ResourceMixin{}, } } -func (BillingInvoiceItem) Fields() []ent.Field { +func (BillingInvoiceLine) Fields() []ent.Field { return []ent.Field{ field.String("invoice_id"). - Optional(). - Nillable(). - SchemaType(map[string]string{ - "postgres": "char(26)", - }), - field.String("customer_id"). - NotEmpty(). - Immutable(). SchemaType(map[string]string{ "postgres": "char(26)", }), @@ -260,22 +250,11 @@ func (BillingInvoiceItem) Fields() []ent.Field { // TODO[dependency]: overrides (as soon as plan override entities are ready) field.Enum("type"). - GoType(billingentity.InvoiceItemType("")), + GoType(billingentity.InvoiceLineType("")), - field.String("name"). - NotEmpty(), + field.Enum("status"). + GoType(billingentity.InvoiceLineStatus("")), - // Quantity is only required for static items - field.Other("quantity", alpacadecimal.Decimal{}). - Optional(). - Nillable(). - SchemaType(map[string]string{ - "postgres": "numeric", - }), - field.Other("unit_price", alpacadecimal.Decimal{}). - SchemaType(map[string]string{ - "postgres": "numeric", - }), field.String("currency"). GoType(currencyx.Code("")). NotEmpty(). @@ -283,29 +262,71 @@ func (BillingInvoiceItem) Fields() []ent.Field { SchemaType(map[string]string{ "postgres": "varchar(3)", }), - field.JSON("tax_code_override", billingentity.TaxOverrides{}). + + // Quantity is optional as for usage-based billing we can only persist this value, + // when the invoice is issued + field.Other("quantity", alpacadecimal.Decimal{}). + Optional(). + Nillable(). SchemaType(map[string]string{ - "postgres": "jsonb", + "postgres": "numeric", }), + + field.JSON("tax_overrides", &billingentity.TaxOverrides{}). + SchemaType(map[string]string{ + "postgres": "jsonb", + }). + Optional(), } } -func (BillingInvoiceItem) Indexes() []ent.Index { +func (BillingInvoiceLine) Indexes() []ent.Index { return []ent.Index{ - index.Fields("namespace", "id"), index.Fields("namespace", "invoice_id"), - index.Fields("namespace", "customer_id"), } } -func (BillingInvoiceItem) Edges() []ent.Edge { +func (BillingInvoiceLine) Edges() []ent.Edge { return []ent.Edge{ edge.From("billing_invoice", BillingInvoice.Type). - Ref("billing_invoice_items"). + Ref("billing_invoice_lines"). Field("invoice_id"). + Unique(). + Required(), + edge.To("billing_invoice_manual_lines", BillingInvoiceManualLineConfig.Type). + StorageKey(edge.Column("manual_line_config_id")). Unique(), - // TODO[dependency]: Customer edge, as soon as customer entities are ready + } +} + +type BillingInvoiceManualLineConfig struct { + ent.Schema +} +func (BillingInvoiceManualLineConfig) Mixin() []ent.Mixin { + return []ent.Mixin{ + entutils.NamespaceMixin{}, + entutils.IDMixin{}, + } +} + +func (BillingInvoiceManualLineConfig) Fields() []ent.Field { + return []ent.Field{ + // Either coming from the + field.Other("unit_price", alpacadecimal.Decimal{}). + SchemaType(map[string]string{ + "postgres": "numeric", + }), + } +} + +func (BillingInvoiceManualLineConfig) Edgexs() []ent.Edge { + return []ent.Edge{ + edge.From("billing_invoice_line", BillingInvoiceLine.Type). + Ref("billing_invoice_manual_lines"). + Field("id"). + Unique(). + Required(), } } @@ -315,20 +336,47 @@ type BillingInvoice struct { func (BillingInvoice) Mixin() []ent.Mixin { return []ent.Mixin{ + // This cannot be a resource mixin as the invoice doesn't have a name field entutils.IDMixin{}, entutils.NamespaceMixin{}, - entutils.TimeMixin{}, entutils.MetadataAnnotationsMixin{}, + entutils.TimeMixin{}, + entutils.CustomerAddressMixin{ + FieldPrefix: "supplier", + }, + entutils.CustomerAddressMixin{ + FieldPrefix: "customer", + }, } } func (BillingInvoice) Fields() []ent.Field { return []ent.Field{ + // Customer/supplier + field.String("supplier_name"). + NotEmpty(), + + field.String("supplier_tax_code"). + Optional(). + Nillable(), + + field.String("customer_name"). + NotEmpty(), + + field.String("customer_timezone"). + GoType(timezone.Timezone("")). + Optional(). + Nillable(), + // Invoice number - field.String("series"). + field.String("number"). Optional(). Nillable(), - field.String("code"). + + field.Enum("type"). + GoType(billingentity.InvoiceType("")), + + field.String("description"). Optional(). Nillable(), @@ -338,34 +386,68 @@ func (BillingInvoice) Fields() []ent.Field { "postgres": "char(26)", }). Immutable(), - field.String("billing_profile_id"). + + field.String("source_billing_profile_id"). NotEmpty(). Immutable(). SchemaType(map[string]string{ "postgres": "char(26)", }), field.Time("voided_at"). - Optional(), + Optional(). + Nillable(), + + // issued_at can be in the future in case of pre-issuing invoices + field.Time("issued_at"). + Optional(). + Nillable(), + field.String("currency"). + GoType(currencyx.Code("")). NotEmpty(). Immutable(). SchemaType(map[string]string{ "postgres": "varchar(3)", }), - field.Time("due_date"), + field.Time("due_at"). + Optional(). + Nillable(), + field.Enum("status"). GoType(billingentity.InvoiceStatus("")), + // Cloned profile settings field.String("workflow_config_id"). SchemaType(map[string]string{ "postgres": "char(26)", }), - // TODO[later]: Add either provider annotations or typed provider status fields + field.String("tax_app_id"). + Immutable(). + SchemaType(map[string]string{ + dialect.Postgres: "char(26)", + }), + field.String("invoicing_app_id"). + Immutable(). + SchemaType(map[string]string{ + dialect.Postgres: "char(26)", + }), + field.String("payment_app_id"). + Immutable(). + SchemaType(map[string]string{ + dialect.Postgres: "char(26)", + }), + + // These fields are optional as they are calculated from the invoice lines, which might not + // be present on an invoice. + field.Time("period_start"). + Optional(). + Nillable(), - field.Time("period_start"), - field.Time("period_end"), + field.Time("period_end"). + Optional(). + Nillable(), } } @@ -373,18 +455,14 @@ func (BillingInvoice) Indexes() []ent.Index { return []ent.Index{ index.Fields("namespace", "id"), index.Fields("namespace", "customer_id"), - index.Fields("namespace", "due_date"), - index.Fields("namespace", "status"), - // Some countries require per seller uniqueness, but that's something we can't enforce here - index.Fields("namespace", "customer_id", "series", "code").Unique(), } } func (BillingInvoice) Edges() []ent.Edge { return []ent.Edge{ - edge.From("billing_profile", BillingProfile.Type). + edge.From("source_billing_profile", BillingProfile.Type). Ref("billing_invoices"). - Field("billing_profile_id"). + Field("source_billing_profile_id"). Required(). Unique(). Immutable(), // Billing profile changes are forbidden => invoice must be voided in this case @@ -393,6 +471,30 @@ func (BillingInvoice) Edges() []ent.Edge { Field("workflow_config_id"). Unique(). Required(), - edge.To("billing_invoice_items", BillingInvoiceItem.Type), + edge.To("billing_invoice_lines", BillingInvoiceLine.Type), + edge.From("billing_invoice_customer", Customer.Type). + Ref("billing_invoice"). + Field("customer_id"). + Unique(). + Required(). + Immutable(), + edge.From("tax_app", App.Type). + Ref("billing_invoice_tax_app"). + Field("tax_app_id"). + Unique(). + Immutable(). + Required(), + edge.From("invoicing_app", App.Type). + Ref("billing_invoice_invoicing_app"). + Field("invoicing_app_id"). + Unique(). + Immutable(). + Required(), + edge.From("payment_app", App.Type). + Ref("billing_invoice_payment_app"). + Field("payment_app_id"). + Unique(). + Immutable(). + Required(), } } diff --git a/openmeter/ent/schema/customer.go b/openmeter/ent/schema/customer.go index c07d986c8..c8d3d40cc 100644 --- a/openmeter/ent/schema/customer.go +++ b/openmeter/ent/schema/customer.go @@ -45,6 +45,7 @@ func (Customer) Edges() []ent.Edge { edge.To("billing_customer_override", BillingCustomerOverride.Type). Unique(). Annotations(entsql.OnDelete(entsql.Cascade)), + edge.To("billing_invoice", BillingInvoice.Type), } } diff --git a/openmeter/server/router/billing.go b/openmeter/server/router/billing.go index e99423883..203a28892 100644 --- a/openmeter/server/router/billing.go +++ b/openmeter/server/router/billing.go @@ -3,7 +3,10 @@ package router import ( "net/http" + "github.com/samber/lo" + "github.com/openmeterio/openmeter/api" + "github.com/openmeterio/openmeter/openmeter/billing/httpdriver" ) // List customer overrides @@ -33,7 +36,12 @@ func (a *Router) BillingUpsertCustomerOverride(w http.ResponseWriter, r *http.Re // List invoices // (GET /api/v1/billing/invoices) func (a *Router) BillingListInvoices(w http.ResponseWriter, r *http.Request, params api.BillingListInvoicesParams) { - w.WriteHeader(http.StatusNotImplemented) + if !a.config.BillingEnabled { + unimplemented.BillingListInvoices(w, r, params) + return + } + + a.billingHandler.ListInvoices().With(params).ServeHTTP(w, r) } // List invoices @@ -56,7 +64,8 @@ func (a *Router) BillingDeleteInvoiceByCustomerInvoiceId(w http.ResponseWriter, // Get an invoice // (GET /api/v1/billing/invoices/{customerIdOrKey}/invoices/{invoiceId}) -func (a *Router) BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string) { +func (a *Router) BillingGetInvoiceByCustomerInvoiceId(w http.ResponseWriter, r *http.Request, customerIdOrKey string, invoiceId string, params api.BillingGetInvoiceByCustomerInvoiceIdParams) { + // TODO: make sure we expand lines if there's no expand query param w.WriteHeader(http.StatusNotImplemented) } @@ -96,10 +105,15 @@ func (a *Router) BillingInvoiceWorkflowAdvance(w http.ResponseWriter, r *http.Re w.WriteHeader(http.StatusNotImplemented) } -// Create a new pending item +// Create a new item // (POST /api/v1/billing/invoices/{customerIdOrKey}/items) -func (a *Router) BillingCreatePendingItemByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { - w.WriteHeader(http.StatusNotImplemented) +func (a *Router) BillingCreateLineByCustomer(w http.ResponseWriter, r *http.Request, customerIdOrKey string) { + if !a.config.BillingEnabled { + unimplemented.BillingCreateLineByCustomer(w, r, customerIdOrKey) + return + } + + a.billingHandler.CreateLineByCustomer().With(customerIdOrKey).ServeHTTP(w, r) } // (GET /api/v1/billing/profile) @@ -136,13 +150,16 @@ func (a *Router) BillingArchiveProfile(w http.ResponseWriter, r *http.Request, i // Get a billing profile by ID // (GET /api/v1/billing/profile/{id}) -func (a *Router) BillingGetProfile(w http.ResponseWriter, r *http.Request, id string) { +func (a *Router) BillingGetProfile(w http.ResponseWriter, r *http.Request, id string, params api.BillingGetProfileParams) { if !a.config.BillingEnabled { - unimplemented.BillingGetProfile(w, r, id) + unimplemented.BillingGetProfile(w, r, id, params) return } - a.billingHandler.GetProfile().With(id).ServeHTTP(w, r) + a.billingHandler.GetProfile().With(httpdriver.GetProfileParams{ + ID: id, + Expand: lo.FromPtrOr(params.Expand, nil), + }).ServeHTTP(w, r) } // Update a billing profile diff --git a/pkg/currencyx/currency.go b/pkg/currencyx/currency.go index 447051842..7bc1497be 100644 --- a/pkg/currencyx/currency.go +++ b/pkg/currencyx/currency.go @@ -1,6 +1,8 @@ package currencyx import ( + "errors" + "github.com/alpacahq/alpacadecimal" "github.com/invopop/gobl/currency" ) @@ -13,3 +15,12 @@ func (c Code) RoundToPrecision(amount alpacadecimal.Decimal) alpacadecimal.Decim // TODO[OM-907]: find a library to handle currency codes and precisions. (e.g. JPY has a precision of 0) return amount.Round(2) } + +func (c Code) Validate() error { + if c == "" { + return errors.New("currency code is required") + } + + // TODO: we need to validate this against our currency code database + return nil +} diff --git a/pkg/timezone/tz.go b/pkg/timezone/tz.go index 2e3bd1841..9436577e0 100644 --- a/pkg/timezone/tz.go +++ b/pkg/timezone/tz.go @@ -12,3 +12,8 @@ func (t Timezone) LoadLocation() (*time.Location, error) { } return time.LoadLocation(string(t)) } + +func (t Timezone) Validate() error { + _, err := t.LoadLocation() + return err +} diff --git a/test/billing/invoice_test.go b/test/billing/invoice_test.go index 711e56434..1e2b19a26 100644 --- a/test/billing/invoice_test.go +++ b/test/billing/invoice_test.go @@ -2,8 +2,6 @@ package billing_test import ( "context" - "log/slog" - "sort" "testing" "time" @@ -15,10 +13,10 @@ import ( "github.com/openmeterio/openmeter/openmeter/billing" billingentity "github.com/openmeterio/openmeter/openmeter/billing/entity" - "github.com/openmeterio/openmeter/openmeter/billing/gobldriver" customerentity "github.com/openmeterio/openmeter/openmeter/customer/entity" "github.com/openmeterio/openmeter/pkg/currencyx" "github.com/openmeterio/openmeter/pkg/models" + "github.com/openmeterio/openmeter/pkg/pagination" ) type InvoicingTestSuite struct { @@ -29,7 +27,7 @@ func TestInvoicing(t *testing.T) { suite.Run(t, new(InvoicingTestSuite)) } -func (s *InvoicingTestSuite) TestPendingInvoiceValidation() { +func (s *InvoicingTestSuite) TestPendingLineCreation() { namespace := "ns-create-invoice-workflow" now := time.Now().Truncate(time.Microsecond) periodEnd := now.Add(-time.Hour) @@ -68,6 +66,7 @@ func (s *InvoicingTestSuite) TestPendingInvoiceValidation() { // Given we have a default profile for the namespace + var billingProfile billingentity.Profile s.T().Run("create default profile", func(t *testing.T) { minimalCreateProfileInput := minimalCreateProfileInputTemplate minimalCreateProfileInput.Namespace = namespace @@ -76,135 +75,254 @@ func (s *InvoicingTestSuite) TestPendingInvoiceValidation() { require.NoError(t, err) require.NotNil(t, profile) + billingProfile = *profile }) - var items []billingentity.InvoiceItem - var HUFItem billingentity.InvoiceItem + var items []billingentity.Line + var HUFItem billingentity.Line s.T().Run("CreateInvoiceItems", func(t *testing.T) { // When we create invoice items - items, err = s.BillingService.CreateInvoiceItems(ctx, - billing.CreateInvoiceItemsInput{ - InvoiceID: nil, - Namespace: namespace, - Items: []billingentity.InvoiceItem{ + res, err := s.BillingService.CreateInvoiceLines(ctx, + billing.CreateInvoiceLinesInput{ + Namespace: namespace, + CustomerKeyOrID: customerEntity.ID, + Lines: []billingentity.Line{ { - Namespace: namespace, - CustomerID: customerEntity.ID, - PeriodStart: periodStart, - PeriodEnd: periodEnd, + LineBase: billingentity.LineBase{ + Namespace: namespace, + Period: billingentity.Period{Start: periodStart, End: periodEnd}, - InvoiceAt: issueAt, + InvoiceAt: issueAt, - Type: billingentity.InvoiceItemTypeStatic, + Type: billingentity.InvoiceLineTypeManualFee, - Name: "Test item - USD", - Quantity: lo.ToPtr(alpacadecimal.NewFromFloat(1)), - UnitPrice: alpacadecimal.NewFromFloat(100), - Currency: currencyx.Code(currency.USD), + Name: "Test item - USD", + Currency: currencyx.Code(currency.USD), - Metadata: map[string]string{ - "key": "value", + Metadata: map[string]string{ + "key": "value", + }, + }, + ManualFee: &billingentity.ManualFeeLine{ + Price: alpacadecimal.NewFromFloat(100), + Quantity: alpacadecimal.NewFromFloat(1), }, }, { - Namespace: namespace, - CustomerID: customerEntity.ID, - PeriodStart: periodStart, - PeriodEnd: periodEnd, + LineBase: billingentity.LineBase{ + Namespace: namespace, + Period: billingentity.Period{Start: periodStart, End: periodEnd}, - InvoiceAt: issueAt, + InvoiceAt: issueAt, - Type: billingentity.InvoiceItemTypeStatic, + Type: billingentity.InvoiceLineTypeManualFee, - Name: "Test item - HUF", - Quantity: lo.ToPtr(alpacadecimal.NewFromFloat(3)), - UnitPrice: alpacadecimal.NewFromFloat(200), - Currency: currencyx.Code(currency.HUF), + Name: "Test item - HUF", + Currency: currencyx.Code(currency.HUF), + }, + ManualFee: &billingentity.ManualFeeLine{ + Price: alpacadecimal.NewFromFloat(200), + Quantity: alpacadecimal.NewFromFloat(3), + }, }, }, }) // Then we should have the items created require.NoError(s.T(), err) - require.Len(s.T(), items, 2) - require.Equal(s.T(), items[0], billingentity.InvoiceItem{ - ID: items[0].ID, + items = res.Lines + + // Then we should have an usd invoice automatically created + usdInvoices, err := s.BillingService.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, + Namespace: namespace, - CustomerID: customerEntity.ID, + Customers: []string{customerEntity.ID}, + Expand: billing.InvoiceExpandAll, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{currencyx.Code(currency.USD)}, + }) + require.NoError(s.T(), err) + require.Len(s.T(), usdInvoices.Items, 1) + usdInvoice := usdInvoices.Items[0] + + expectedUSDLine := billingentity.Line{ + LineBase: billingentity.LineBase{ + ID: items[0].ID, + Namespace: namespace, - PeriodStart: periodStart, - PeriodEnd: periodEnd, + Period: billingentity.Period{Start: periodStart.Truncate(time.Microsecond), End: periodEnd.Truncate(time.Microsecond)}, - InvoiceAt: issueAt, + InvoiceID: usdInvoice.ID, + InvoiceAt: issueAt, - Type: billingentity.InvoiceItemTypeStatic, + Type: billingentity.InvoiceLineTypeManualFee, - Name: "Test item - USD", - Quantity: lo.ToPtr(alpacadecimal.NewFromFloat(1)), - UnitPrice: alpacadecimal.NewFromFloat(100), - Currency: currencyx.Code(currency.USD), + Name: "Test item - USD", + Currency: currencyx.Code(currency.USD), - CreatedAt: items[0].CreatedAt, - UpdatedAt: items[0].UpdatedAt, + CreatedAt: usdInvoice.Lines[0].CreatedAt, + UpdatedAt: usdInvoice.Lines[0].UpdatedAt, - Metadata: map[string]string{ - "key": "value", + Metadata: map[string]string{ + "key": "value", + }, + }, + ManualFee: &billingentity.ManualFeeLine{ + Price: alpacadecimal.NewFromFloat(100), + Quantity: alpacadecimal.NewFromFloat(1), }, + } + // Let's make sure that the workflow config is cloned + require.NotEqual(s.T(), usdInvoice.Workflow.WorkflowConfig.ID, billingProfile.WorkflowConfig.ID) + + require.Equal(s.T(), usdInvoice, billingentity.Invoice{ + Namespace: namespace, + ID: usdInvoice.ID, + + Type: billingentity.InvoiceTypeStandard, + Currency: currencyx.Code(currency.USD), + Status: billingentity.InvoiceStatusGathering, + + CreatedAt: usdInvoice.CreatedAt, + UpdatedAt: usdInvoice.UpdatedAt, + + Workflow: &billingentity.InvoiceWorkflow{ + WorkflowConfig: billingentity.WorkflowConfig{ + ID: usdInvoice.Workflow.WorkflowConfig.ID, + CreatedAt: usdInvoice.Workflow.WorkflowConfig.CreatedAt, + UpdatedAt: usdInvoice.Workflow.WorkflowConfig.UpdatedAt, + + Timezone: billingProfile.WorkflowConfig.Timezone, + Collection: billingProfile.WorkflowConfig.Collection, + Invoicing: billingProfile.WorkflowConfig.Invoicing, + Payment: billingProfile.WorkflowConfig.Payment, + }, + SourceBillingProfileID: billingProfile.ID, + AppReferences: *billingProfile.AppReferences, + Apps: billingProfile.Apps, + }, + + Customer: billingentity.InvoiceCustomer{ + CustomerID: customerEntity.ID, + + Name: customerEntity.Name, + BillingAddress: customerEntity.BillingAddress, + }, + Supplier: billingProfile.Supplier, + + Lines: []billingentity.Line{expectedUSDLine}, }) + + require.Len(s.T(), items, 2) + // Validate that the create returns the expected items + items[0].CreatedAt = expectedUSDLine.CreatedAt + items[0].UpdatedAt = expectedUSDLine.UpdatedAt + require.Equal(s.T(), items[0], expectedUSDLine) require.NotEmpty(s.T(), items[1].ID) HUFItem = items[1] }) - var pendingInvoices []billingentity.InvoiceWithValidation - var USDInvoice billingentity.InvoiceWithValidation + s.T().Run("CreateInvoiceItems - HUF", func(t *testing.T) { + // Then a HUF item is also created + require.NotNil(s.T(), HUFItem.ID) - s.T().Run("Pending invoices", func(t *testing.T) { - // When we get the pending invoices - pendingInvoices, err = s.BillingService.GetPendingInvoiceItems(ctx, customerentity.CustomerID{ - Namespace: namespace, - ID: customerEntity.ID, - }) - - // Then we should receive the one invoice per currency - require.NoError(t, err) - require.NotNil(t, pendingInvoices) - require.Len(t, pendingInvoices, 2) + // Then we have a different invoice for HUF + hufInvoices, err := s.BillingService.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, - sort.SliceStable(pendingInvoices, func(i, j int) bool { - return pendingInvoices[i].Invoice.Currency < pendingInvoices[j].Invoice.Currency + Namespace: namespace, + Customers: []string{customerEntity.ID}, + Expand: billing.InvoiceExpandAll, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{currencyx.Code(currency.HUF)}, }) + require.NoError(s.T(), err) + require.Len(s.T(), hufInvoices.Items, 1) - for _, pendingInvoice := range pendingInvoices { - pendingInvoice.Invoice.Customer.CreatedAt = customerEntity.CreatedAt - pendingInvoice.Invoice.Customer.UpdatedAt = customerEntity.UpdatedAt + // Then we have one line item for the invoice + require.Len(s.T(), hufInvoices.Items[0].Lines, 1) + }) - require.EqualValues(t, billingentity.InvoiceCustomer(*customerEntity), pendingInvoice.Invoice.Customer) - } + s.T().Run("Expand scenarios - no expand", func(t *testing.T) { + invoices, err := s.BillingService.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, - require.EqualValues(t, HUFItem.ID, pendingInvoices[0].Invoice.Items[0].ID) + Namespace: namespace, + Customers: []string{customerEntity.ID}, + Expand: billing.InvoiceExpand{}, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{currencyx.Code(currency.USD)}, + }) + require.NoError(s.T(), err) + require.Len(s.T(), invoices.Items, 1) + invoice := invoices.Items[0] - USDInvoice = pendingInvoices[1] + require.Len(s.T(), invoice.Lines, 0, "no lines should be returned") + require.Nil(s.T(), invoice.Workflow, "no workflow should be returned") }) - s.T().Run("Pending invoice - GOBL validation", func(t *testing.T) { - // When we validate the invoice with GOBL - gobl, err := gobldriver.NewDriver(gobldriver.DriverConfig{ - Logger: slog.Default(), - }) + s.T().Run("Expand scenarios - no app expand", func(t *testing.T) { + invoices, err := s.BillingService.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, - // Then we should get no validation errors - require.NoError(t, err) - require.NotNil(t, gobl) + Namespace: namespace, + Customers: []string{customerEntity.ID}, + Expand: billing.InvoiceExpand{ + Workflow: true, + }, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{currencyx.Code(currency.USD)}, + }) + require.NoError(s.T(), err) + require.Len(s.T(), invoices.Items, 1) + invoice := invoices.Items[0] - invoice, err := gobl.Generate(context.Background(), USDInvoice) - require.NoError(t, err) + require.Len(s.T(), invoice.Lines, 0, "no lines should be returned") + require.NotNil(s.T(), invoice.Workflow, "workflow should be returned") + require.Nil(s.T(), invoice.Workflow.Apps, "apps should not be resolved") + }) - validationErrors, err := gobldriver.LookupValidationErrors(invoice) - require.NoError(t, err) + s.T().Run("Expand scenarios - app expand", func(t *testing.T) { + invoices, err := s.BillingService.ListInvoices(ctx, billing.ListInvoicesInput{ + Page: pagination.Page{ + PageNumber: 1, + PageSize: 10, + }, - require.False(t, validationErrors.HasErrors(), "no validation errors expected") + Namespace: namespace, + Customers: []string{customerEntity.ID}, + Expand: billing.InvoiceExpand{ + Workflow: true, + WorkflowApps: true, + }, + Statuses: []billingentity.InvoiceStatus{billingentity.InvoiceStatusGathering}, + Currencies: []currencyx.Code{currencyx.Code(currency.USD)}, + }) + require.NoError(s.T(), err) + require.Len(s.T(), invoices.Items, 1) + invoice := invoices.Items[0] + + require.Len(s.T(), invoice.Lines, 0, "no lines should be returned") + require.NotNil(s.T(), invoice.Workflow, "workflow should be returned") + require.NotNil(s.T(), invoice.Workflow.Apps, "apps should be resolved") + require.NotNil(s.T(), invoice.Workflow.Apps.Tax, "apps should be resolved") + require.NotNil(s.T(), invoice.Workflow.Apps.Invoicing, "apps should be resolved") + require.NotNil(s.T(), invoice.Workflow.Apps.Payment, "apps should be resolved") }) } diff --git a/test/billing/profile_test.go b/test/billing/profile_test.go index 370d63ed0..a9a715988 100644 --- a/test/billing/profile_test.go +++ b/test/billing/profile_test.go @@ -103,8 +103,13 @@ func (s *ProfileTestSuite) TestProfileLifecycle() { s.T().Run("fetching the profile by id", func(t *testing.T) { fetchedProfile, err := s.BillingService.GetProfile(ctx, billing.GetProfileInput{ - Namespace: ns, - ID: profile.ID, + Profile: models.NamespacedID{ + Namespace: ns, + ID: profile.ID, + }, + Expand: billing.ProfileExpand{ + Apps: true, + }, }) require.NoError(t, err) @@ -126,8 +131,10 @@ func (s *ProfileTestSuite) TestProfileLifecycle() { t.Run("fetching a deleted profile by id returns the profile", func(t *testing.T) { fetchedProfile, err := s.BillingService.GetProfile(ctx, billing.GetProfileInput{ - Namespace: ns, - ID: profile.ID, + Profile: models.NamespacedID{ + Namespace: ns, + ID: profile.ID, + }, }) require.NoError(t, err) @@ -211,8 +218,11 @@ func (s *ProfileTestSuite) TestProfileFieldSetting() { // Let's fetch the profile again fetchedProfile, err := s.BillingService.GetProfile(ctx, billing.GetProfileInput{ - Namespace: ns, - ID: profile.ID, + Profile: models.NamespacedID{ + Namespace: ns, + ID: profile.ID, + }, + Expand: billing.ProfileExpandAll, }) // Sanity check db conversion & fetching @@ -309,8 +319,11 @@ func (s *ProfileTestSuite) TestProfileUpdates() { // Let's fetch the profile again fetchedProfile, err := s.BillingService.GetProfile(ctx, billing.GetProfileInput{ - Namespace: ns, - ID: profile.ID, + Profile: models.NamespacedID{ + Namespace: ns, + ID: profile.ID, + }, + Expand: billing.ProfileExpandAll, }) // Sanity check db conversion & fetching diff --git a/test/billing/suite_test.go b/test/billing/suite_test.go index c256d1577..612017d7c 100644 --- a/test/billing/suite_test.go +++ b/test/billing/suite_test.go @@ -101,6 +101,7 @@ func (s *BaseSuite) SetupSuite() { Adapter: billingAdapter, CustomerService: s.CustomerService, AppService: s.AppService, + Logger: slog.Default(), }) require.NoError(t, err) s.BillingService = billingService diff --git a/tools/migrate/migrations/20240917172257_billing-entities.down.sql b/tools/migrate/migrations/20240917172257_billing-entities.down.sql index 80a0f78f4..017fe43ee 100644 --- a/tools/migrate/migrations/20240917172257_billing-entities.down.sql +++ b/tools/migrate/migrations/20240917172257_billing-entities.down.sql @@ -12,8 +12,6 @@ DROP TABLE "billing_invoice_items"; DROP INDEX "billinginvoice_namespace_status"; -- reverse: create index "billinginvoice_namespace_id" to table: "billing_invoices" DROP INDEX "billinginvoice_namespace_id"; --- reverse: create index "billinginvoice_namespace_due_date" to table: "billing_invoices" -DROP INDEX "billinginvoice_namespace_due_date"; -- reverse: create index "billinginvoice_namespace_customer_id" to table: "billing_invoices" DROP INDEX "billinginvoice_namespace_customer_id"; -- reverse: create index "billinginvoice_id" to table: "billing_invoices" diff --git a/tools/migrate/migrations/20240926164233_pending-invoice-items.down.sql b/tools/migrate/migrations/20240926164233_pending-invoice-items.down.sql index 2878906c6..932c30a37 100644 --- a/tools/migrate/migrations/20240926164233_pending-invoice-items.down.sql +++ b/tools/migrate/migrations/20240926164233_pending-invoice-items.down.sql @@ -1,5 +1,3 @@ --- reverse: create index "billinginvoice_namespace_customer_id_series_code" to table: "billing_invoices" -DROP INDEX "billinginvoice_namespace_customer_id_series_code"; -- reverse: modify "billing_invoices" table ALTER TABLE "billing_invoices" DROP COLUMN "code", DROP COLUMN "series", ADD COLUMN "total_amount" numeric NOT NULL, ADD COLUMN "key" character varying NOT NULL; -- reverse: modify "billing_invoice_items" table diff --git a/tools/migrate/migrations/20240926164233_pending-invoice-items.up.sql b/tools/migrate/migrations/20240926164233_pending-invoice-items.up.sql index 2fcb7ae20..9e2700def 100644 --- a/tools/migrate/migrations/20240926164233_pending-invoice-items.up.sql +++ b/tools/migrate/migrations/20240926164233_pending-invoice-items.up.sql @@ -4,6 +4,3 @@ ALTER TABLE "billing_invoice_items" ALTER COLUMN "quantity" DROP NOT NULL, ADD C -- modify "billing_invoices" table -- atlas:nolint DS103 ALTER TABLE "billing_invoices" DROP COLUMN "key", DROP COLUMN "total_amount", ADD COLUMN "series" character varying NULL, ADD COLUMN "code" character varying NULL; --- create index "billinginvoice_namespace_customer_id_series_code" to table: "billing_invoices" --- atlas:nolint MF101 -CREATE UNIQUE INDEX "billinginvoice_namespace_customer_id_series_code" ON "billing_invoices" ("namespace", "customer_id", "series", "code"); diff --git a/tools/migrate/migrations/20241024122007_line-item-fixes.down.sql b/tools/migrate/migrations/20241024122007_line-item-fixes.down.sql new file mode 100644 index 000000000..de651e079 --- /dev/null +++ b/tools/migrate/migrations/20241024122007_line-item-fixes.down.sql @@ -0,0 +1,60 @@ +-- reverse: drop "billing_invoice_items" table +CREATE TABLE "billing_invoice_items" ( + "id" character(26) NOT NULL, + "namespace" character varying NOT NULL, + "created_at" timestamptz NOT NULL, + "updated_at" timestamptz NOT NULL, + "deleted_at" timestamptz NULL, + "metadata" jsonb NULL, + "customer_id" character(26) NOT NULL, + "period_start" timestamptz NOT NULL, + "period_end" timestamptz NOT NULL, + "invoice_at" timestamptz NOT NULL, + "quantity" numeric NULL, + "unit_price" numeric NOT NULL, + "currency" character varying(3) NOT NULL, + "tax_code_override" jsonb NOT NULL, + "invoice_id" character(26) NULL, + "type" character varying NOT NULL, + "name" character varying NOT NULL, + PRIMARY KEY ("id"), + CONSTRAINT "billing_invoice_items_billing_invoices_billing_invoice_items" FOREIGN KEY ("invoice_id") REFERENCES "billing_invoices" ("id") ON UPDATE NO ACTION ON DELETE SET NULL +); +CREATE UNIQUE INDEX "billinginvoiceitem_id" ON "billing_invoice_items" ("id"); +CREATE INDEX "billinginvoiceitem_namespace" ON "billing_invoice_items" ("namespace"); +CREATE INDEX "billinginvoiceitem_namespace_customer_id" ON "billing_invoice_items" ("namespace", "customer_id"); +CREATE INDEX "billinginvoiceitem_namespace_id" ON "billing_invoice_items" ("namespace", "id"); +CREATE INDEX "billinginvoiceitem_namespace_invoice_id" ON "billing_invoice_items" ("namespace", "invoice_id"); +-- reverse: modify "billing_profiles" table +ALTER TABLE "billing_profiles" DROP CONSTRAINT "billing_profiles_apps_billing_profile_tax_app", DROP CONSTRAINT "billing_profiles_apps_billing_profile_payment_app", DROP CONSTRAINT "billing_profiles_apps_billing_profile_invoicing_app", ADD + CONSTRAINT "billing_profiles_apps_tax_app" FOREIGN KEY ("tax_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_profiles_apps_payment_app" FOREIGN KEY ("payment_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_profiles_apps_invoicing_app" FOREIGN KEY ("invoicing_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- reverse: create index "billinginvoiceline_namespace_invoice_id" to table: "billing_invoice_lines" +DROP INDEX "billinginvoiceline_namespace_invoice_id"; +-- reverse: create index "billinginvoiceline_namespace_id" to table: "billing_invoice_lines" +DROP INDEX "billinginvoiceline_namespace_id"; +-- reverse: create index "billinginvoiceline_namespace" to table: "billing_invoice_lines" +DROP INDEX "billinginvoiceline_namespace"; +-- reverse: create index "billinginvoiceline_id" to table: "billing_invoice_lines" +DROP INDEX "billinginvoiceline_id"; +-- reverse: create "billing_invoice_lines" table +DROP TABLE "billing_invoice_lines"; +-- reverse: rename a column from "code" to "number" +ALTER TABLE "billing_invoices" RENAME COLUMN "number" TO "code"; +-- reverse: rename a column from "billing_profile_id" to "source_billing_profile_id" +ALTER TABLE "billing_invoices" RENAME COLUMN "source_billing_profile_id" TO "billing_profile_id"; +-- reverse: modify "billing_invoices" table +ALTER TABLE "billing_invoices" DROP CONSTRAINT "billing_invoices_customers_billing_invoice", DROP CONSTRAINT "billing_invoices_apps_billing_invoice_tax_app", DROP CONSTRAINT "billing_invoices_apps_billing_invoice_payment_app", DROP CONSTRAINT "billing_invoices_apps_billing_invoice_invoicing_app", DROP COLUMN "payment_app_id", DROP COLUMN "invoicing_app_id", DROP COLUMN "tax_app_id", DROP COLUMN "due_at", DROP COLUMN "issued_at", DROP COLUMN "description", DROP COLUMN "type", DROP COLUMN "customer_timezone", DROP COLUMN "customer_name", DROP COLUMN "supplier_tax_code", DROP COLUMN "supplier_name", DROP COLUMN "customer_address_phone_number", DROP COLUMN "customer_address_line2", DROP COLUMN "customer_address_line1", DROP COLUMN "customer_address_city", DROP COLUMN "customer_address_state", DROP COLUMN "customer_address_postal_code", DROP COLUMN "customer_address_country", DROP COLUMN "supplier_address_phone_number", DROP COLUMN "supplier_address_line2", DROP COLUMN "supplier_address_line1", DROP COLUMN "supplier_address_city", DROP COLUMN "supplier_address_state", DROP COLUMN "supplier_address_postal_code", DROP COLUMN "supplier_address_country", ADD COLUMN "series" character varying NULL, ALTER COLUMN "period_end" SET NOT NULL, ALTER COLUMN "period_start" SET NOT NULL, ADD COLUMN "due_date" timestamptz NOT NULL; +-- reverse: drop index "billinginvoice_namespace_status" from table: "billing_invoices" +CREATE INDEX "billinginvoice_namespace_status" ON "billing_invoices" ("namespace", "status"); +-- reverse: create index "billinginvoicemanuallineconfig_namespace" to table: "billing_invoice_manual_line_configs" +DROP INDEX "billinginvoicemanuallineconfig_namespace"; +-- reverse: create index "billinginvoicemanuallineconfig_id" to table: "billing_invoice_manual_line_configs" +DROP INDEX "billinginvoicemanuallineconfig_id"; +-- reverse: create "billing_invoice_manual_line_configs" table +DROP TABLE "billing_invoice_manual_line_configs"; +-- reverse: rename a column from "item_collection_period" to "line_collection_period" +ALTER TABLE "billing_workflow_configs" RENAME COLUMN "line_collection_period" TO "item_collection_period"; +-- reverse: rename a column from "item_collection_period" to "line_collection_period" +ALTER TABLE "billing_customer_overrides" RENAME COLUMN "line_collection_period" TO "item_collection_period"; diff --git a/tools/migrate/migrations/20241024122007_line-item-fixes.up.sql b/tools/migrate/migrations/20241024122007_line-item-fixes.up.sql new file mode 100644 index 000000000..eecd32917 --- /dev/null +++ b/tools/migrate/migrations/20241024122007_line-item-fixes.up.sql @@ -0,0 +1,73 @@ +-- rename a column from "item_collection_period" to "line_collection_period" +-- atlas:nolint BC102 +ALTER TABLE "billing_customer_overrides" RENAME COLUMN "item_collection_period" TO "line_collection_period"; +-- rename a column from "item_collection_period" to "line_collection_period" +-- atlas:nolint BC102 +ALTER TABLE "billing_workflow_configs" RENAME COLUMN "item_collection_period" TO "line_collection_period"; +-- create "billing_invoice_manual_line_configs" table +CREATE TABLE "billing_invoice_manual_line_configs" ( + "id" character(26) NOT NULL, + "namespace" character varying NOT NULL, + "unit_price" numeric NOT NULL, + PRIMARY KEY ("id") +); +-- create index "billinginvoicemanuallineconfig_id" to table: "billing_invoice_manual_line_configs" +CREATE UNIQUE INDEX "billinginvoicemanuallineconfig_id" ON "billing_invoice_manual_line_configs" ("id"); +-- create index "billinginvoicemanuallineconfig_namespace" to table: "billing_invoice_manual_line_configs" +CREATE INDEX "billinginvoicemanuallineconfig_namespace" ON "billing_invoice_manual_line_configs" ("namespace"); +-- drop index "billinginvoice_namespace_status" from table: "billing_invoices" +DROP INDEX "billinginvoice_namespace_status"; +-- modify "billing_invoices" table +-- atlas:nolint DS103 MF103 +ALTER TABLE "billing_invoices" DROP COLUMN "due_date", ALTER COLUMN "period_start" DROP NOT NULL, ALTER COLUMN "period_end" DROP NOT NULL, DROP COLUMN "series", ADD COLUMN "supplier_address_country" character varying NULL, ADD COLUMN "supplier_address_postal_code" character varying NULL, ADD COLUMN "supplier_address_state" character varying NULL, ADD COLUMN "supplier_address_city" character varying NULL, ADD COLUMN "supplier_address_line1" character varying NULL, ADD COLUMN "supplier_address_line2" character varying NULL, ADD COLUMN "supplier_address_phone_number" character varying NULL, ADD COLUMN "customer_address_country" character varying NULL, ADD COLUMN "customer_address_postal_code" character varying NULL, ADD COLUMN "customer_address_state" character varying NULL, ADD COLUMN "customer_address_city" character varying NULL, ADD COLUMN "customer_address_line1" character varying NULL, ADD COLUMN "customer_address_line2" character varying NULL, ADD COLUMN "customer_address_phone_number" character varying NULL, ADD COLUMN "supplier_name" character varying NOT NULL, ADD COLUMN "supplier_tax_code" character varying NULL, ADD COLUMN "customer_name" character varying NOT NULL, ADD COLUMN "customer_timezone" character varying NULL, ADD COLUMN "type" character varying NOT NULL, ADD COLUMN "description" character varying NULL, ADD COLUMN "issued_at" timestamptz NULL, ADD COLUMN "due_at" timestamptz NULL, ADD COLUMN "tax_app_id" character(26) NOT NULL, ADD COLUMN "invoicing_app_id" character(26) NOT NULL, ADD COLUMN "payment_app_id" character(26) NOT NULL, ADD + CONSTRAINT "billing_invoices_apps_billing_invoice_invoicing_app" FOREIGN KEY ("invoicing_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_invoices_apps_billing_invoice_payment_app" FOREIGN KEY ("payment_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_invoices_apps_billing_invoice_tax_app" FOREIGN KEY ("tax_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_invoices_customers_billing_invoice" FOREIGN KEY ("customer_id") REFERENCES "customers" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- rename a column from "billing_profile_id" to "source_billing_profile_id" +-- atlas:nolint BC102 +ALTER TABLE "billing_invoices" RENAME COLUMN "billing_profile_id" TO "source_billing_profile_id"; +-- rename a column from "code" to "number" +-- atlas:nolint BC102 +ALTER TABLE "billing_invoices" RENAME COLUMN "code" TO "number"; +-- create "billing_invoice_lines" table +CREATE TABLE "billing_invoice_lines" ( + "id" character(26) NOT NULL, + "namespace" character varying NOT NULL, + "metadata" jsonb NULL, + "created_at" timestamptz NOT NULL, + "updated_at" timestamptz NOT NULL, + "deleted_at" timestamptz NULL, + "name" character varying NOT NULL, + "description" character varying NULL, + "period_start" timestamptz NOT NULL, + "period_end" timestamptz NOT NULL, + "invoice_at" timestamptz NOT NULL, + "type" character varying NOT NULL, + "status" character varying NOT NULL, + "currency" character varying(3) NOT NULL, + "quantity" numeric NULL, + "tax_overrides" jsonb NULL, + "invoice_id" character(26) NOT NULL, + "manual_line_config_id" character(26) NULL, + PRIMARY KEY ("id"), + CONSTRAINT "billing_invoice_lines_billing_invoice_manual_line_configs_billi" FOREIGN KEY ("manual_line_config_id") REFERENCES "billing_invoice_manual_line_configs" ("id") ON UPDATE NO ACTION ON DELETE SET NULL, + CONSTRAINT "billing_invoice_lines_billing_invoices_billing_invoice_lines" FOREIGN KEY ("invoice_id") REFERENCES "billing_invoices" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION +); +-- create index "billinginvoiceline_id" to table: "billing_invoice_lines" +CREATE UNIQUE INDEX "billinginvoiceline_id" ON "billing_invoice_lines" ("id"); +-- create index "billinginvoiceline_namespace" to table: "billing_invoice_lines" +CREATE INDEX "billinginvoiceline_namespace" ON "billing_invoice_lines" ("namespace"); +-- create index "billinginvoiceline_namespace_id" to table: "billing_invoice_lines" +CREATE UNIQUE INDEX "billinginvoiceline_namespace_id" ON "billing_invoice_lines" ("namespace", "id"); +-- create index "billinginvoiceline_namespace_invoice_id" to table: "billing_invoice_lines" +CREATE INDEX "billinginvoiceline_namespace_invoice_id" ON "billing_invoice_lines" ("namespace", "invoice_id"); +-- modify "billing_profiles" table +-- atlas:nolint CD101 +ALTER TABLE "billing_profiles" DROP CONSTRAINT "billing_profiles_apps_invoicing_app", DROP CONSTRAINT "billing_profiles_apps_payment_app", DROP CONSTRAINT "billing_profiles_apps_tax_app", ADD + CONSTRAINT "billing_profiles_apps_billing_profile_invoicing_app" FOREIGN KEY ("invoicing_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_profiles_apps_billing_profile_payment_app" FOREIGN KEY ("payment_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION, ADD + CONSTRAINT "billing_profiles_apps_billing_profile_tax_app" FOREIGN KEY ("tax_app_id") REFERENCES "apps" ("id") ON UPDATE NO ACTION ON DELETE NO ACTION; +-- drop "billing_invoice_items" table +-- atlas:nolint DS102 +DROP TABLE "billing_invoice_items"; diff --git a/tools/migrate/migrations/atlas.sum b/tools/migrate/migrations/atlas.sum index 19a88bbde..f05c7d951 100644 --- a/tools/migrate/migrations/atlas.sum +++ b/tools/migrate/migrations/atlas.sum @@ -1,31 +1,33 @@ -h1:4cBUGpRhyp4V7GFCH3Q2Tf6uKH45Yhth5Z3M+J85Z+g= +h1:Ujj5cNFyLFHPRjucUB4a7bSLAjf0ssECl/WWVP4ZdFc= 20240826120919_init.down.sql h1:AIbgwwngjkJEYa3yRZsIXQyBa2+qoZttwMXHxXEbHLI= 20240826120919_init.up.sql h1:/hYHWF3Z3dab8SMKnw99ixVktCuJe2bAw5wstCZIEN8= 20240903155435_entitlement-expired-index.down.sql h1:np2xgYs3KQ2z7qPBcobtGNhqWQ3V8NwEP9E5U3TmpSA= 20240903155435_entitlement-expired-index.up.sql h1:HegNgovI3MQxQMd/072kOchfm5B37SXzODZIteOwX78= -20240917172257_billing-entities.down.sql h1:qLZeGqtZ1SnbZ/QyVTgNesB0oO4tb4O/IvZL3mbIMqU= -20240917172257_billing-entities.up.sql h1:EHrNPwfVLPVsOcZpMd1iBIx3UekdBFS8LVXEahYZYiw= -20240918204720_customer.down.sql h1:h+OnA5lyG4InOrsXYHq8jfwHLMdatqK3jlD1WfxOVxA= -20240918204720_customer.up.sql h1:sYXaHCZvssE3PU1DIuxag2o5WgGyyI+HmHWNkfUSpVs= -20240919144910_customer-timezone.down.sql h1:I/KE1+uPTZKsyZt4dmW0sqQtyx1gw595qx8tUrBKWIE= -20240919144910_customer-timezone.up.sql h1:VeAiYnV7FIIIq7RbALKOEOQpTLfT5D/9Ndd1/CHt76Q= -20240920070940_indexing-fixes.down.sql h1:XbIYCfEmYn9NioUmm2OyotoUlGf2yvtw5MkvlEaJXkg= -20240920070940_indexing-fixes.up.sql h1:tl1PDkEsd3URcfMQUFhR9EJ/uGpFl0q2xQAdz1B02nc= -20240923170525_customer_drop_providers.down.sql h1:m6MT3W30Px7iTVdhSo5uWkPlWxsFPHSLC9Hm/PD0suY= -20240923170525_customer_drop_providers.up.sql h1:gJpex6Nnaq3kKBzM7J/z3bcmfpaqzThonRpeKqNYfRg= -20240923180033_customer_drop_key.down.sql h1:I6nSGRQO9qiV0rW2KkDqNflo8AfkvppovauE9j5dCqU= -20240923180033_customer_drop_key.up.sql h1:W7oJJ2uEgJ1FW/xFADlYcIOTSJwUPEByNluOtAZiSms= -20240924164504_billing-profile.down.sql h1:6mk0FnPZwr35vXOkNlAq1K7pz4HNUhRbjXtUVvXFpPE= -20240924164504_billing-profile.up.sql h1:fHYQAPKxxoVsGLNPaa2g/QfcaB/dB2GEHEqUt3/QDzc= -20240924220843_billing-customer-override.down.sql h1:DObaouXBF+HvGFOx0q/jlNDwudzKrJ/KmbqVFX2EdSI= -20240924220843_billing-customer-override.up.sql h1:T7Mzn5uHmwD/Byg6FfEUhnuQ/tx6epiLeY3yfjdVnN0= -20240926164233_pending-invoice-items.down.sql h1:geBZMibQpVt+4gk4khZiluGyEzIKRPrRRsBksMts+YU= -20240926164233_pending-invoice-items.up.sql h1:mQmcDk8d0qrGPytX+rSJ5kWak3F5sc4vE1zKOTjhttA= -20241013151355_apps.down.sql h1:nFLjVe0RfclvCW6GI9dGtVNcNhr7JsjhmsTFUrxdD9E= -20241013151355_apps.up.sql h1:Xw9g3PpSHtwoSScTIa8SCmjj3uZRWSOaWzfvlfl37Ic= -20241017090045_unify-resource-def.down.sql h1:9bG/nuSKS5ibqL2xL6elq80ld1XXm5E1ODjeAOBo54I= -20241017090045_unify-resource-def.up.sql h1:YSRP6iyb60Q2Zscc1MatXb+r6BTDXRYxDXmKvfwOOj8= -20241017135535_entitlement_scheduling.down.sql h1:Km2FQ5euyZfFas/85ESuLQSWJk8ZboMCtm7OXLDkdpk= -20241017135535_entitlement_scheduling.up.sql h1:ODE4LqknutPUtgjWF/DyvCLVJYjv1oSRsLAx1f5goYI= -20241021124045_billing-profile.down.sql h1:Irb1QA8YGH2e59OHjnwRcusPvykLbCzYxpCLIVsSiZU= -20241021124045_billing-profile.up.sql h1:KHLsYk7IcMxJhUZBK9ArQbtJKDxyxUwzf18LsjLlvik= +20240917172257_billing-entities.down.sql h1:6xaqwDKtoR2il8zQ2eAvgGObOw1rBzy8xaylK1pYz7Q= +20240917172257_billing-entities.up.sql h1:FT3Vnq3rXbuKZ091/eHYdmth8KOSEBSSZUWyh7NSraM= +20240918204720_customer.down.sql h1:8vGIEFEC8YhIWyWo/XTndwC0bR8ys6OXS+SjIGvE9b0= +20240918204720_customer.up.sql h1:b7GnnqJT6QsZx+pEfo4PdUnm9sAiMYun4W0upxeZZ9Q= +20240919144910_customer-timezone.down.sql h1:r8SZigIW5sTuKbmRQwmXZcRPAld3/nMsDm7egOksVuc= +20240919144910_customer-timezone.up.sql h1:Z7wBmxdCZkLmeYOOBG6UBLidUY42qZF1d7wOn9FFZD0= +20240920070940_indexing-fixes.down.sql h1:UhYWlb5+AYRk/fS03jni1y9mPJJs6rJt+eWsllq+zq8= +20240920070940_indexing-fixes.up.sql h1:efLgnyuLrsuw+WFN33tYugfzYbNaTqwdZIF7TJHxGpU= +20240923170525_customer_drop_providers.down.sql h1:ov5Y9pN//gvyXxMtzXKIt0fRH0SUjZPQ8RHIPjtvEOQ= +20240923170525_customer_drop_providers.up.sql h1:6Le5UEPGw4Nxj0I8XeuBJa/qGwviN79ZBv2KgTpvmb4= +20240923180033_customer_drop_key.down.sql h1:ln915NYRGSdwsfM3S6Teq6lxIUGKx5oWl1CaslQmAck= +20240923180033_customer_drop_key.up.sql h1:kUCoRN+QvmflcQzrgER35RdXppV2LcFIGS15qnXmCSE= +20240924164504_billing-profile.down.sql h1:EIdIoFlHM1ld/0wlPqt5oU180y439nYVQTJAYaVe6Sw= +20240924164504_billing-profile.up.sql h1:u0yMZ6PjCYWggMmarJfw+T7Qmb2Armm/PFVtBvlKpus= +20240924220843_billing-customer-override.down.sql h1:zQFW2gfTxNZOirzU4jskXXq0jERk52WmX/oEx7e/raw= +20240924220843_billing-customer-override.up.sql h1:pCRggY+t4TG/CL4CZs4DGzi0kL0sKS2EKksiKeGqGKA= +20240926164233_pending-invoice-items.down.sql h1:DiiI6jZFV6sfg586bkKd9r3QQgd/UYjNkIh5nOMZUjc= +20240926164233_pending-invoice-items.up.sql h1:fI2xw2sJNVpVP85m8cA5qTNivs8mNl8UDNXejr7Kgdc= +20241013151355_apps.down.sql h1:xqAawaC/w4T6JhoSyAaSOSN2hYfGao7VN7lT+Q4gnD8= +20241013151355_apps.up.sql h1:NGTSxj5IYz/Lfgj6QfjgDgt9MdrmjygkY7Nk4TqilF0= +20241017090045_unify-resource-def.down.sql h1:nnAIeLL84MunjR1ttc0lLinBLiuWbcdVsMYUlXd1I1A= +20241017090045_unify-resource-def.up.sql h1:5ndnvfOmN8EFq1x2o01KZWYwHWcrLAYCUUH5poPoPRo= +20241017135535_entitlement_scheduling.down.sql h1:dRL5iafu889PDUFdSETZp2A8a7rtC20gaQv+wNuJUtk= +20241017135535_entitlement_scheduling.up.sql h1:wJcK/PRWEW/ZpPJaEomLZTmv8F5zgpZ9vAn1Ek5vlW8= +20241021124045_billing-profile.down.sql h1:XEtAf06ffNHtPNvSHQQctRrKydSVhrIvwgjTNoI7qy0= +20241021124045_billing-profile.up.sql h1:9wXAjftZcFqmzmnKBeLFe2hv0FxBaSROC3trvs+sSo4= +20241024122007_line-item-fixes.down.sql h1:NlWHQnpzszNx0NlEDVo5MGBOoLdd+9v+x58CuiX9/e8= +20241024122007_line-item-fixes.up.sql h1:B9Efi4lli4HEgVnmizbVE4s2xr2Uiq8gjkLyJ57a5oM=