Files
member-console/internal/billing/models.go
T
cgalo5758 1a19ebe971 Implement uniform conferral semantics
Replace product-kind branching and direct position writes with enclosed
database functions driven by structural product shape.

Migrate grant and provision data, unify operator issuance, update
subscription and expiry flows, and add migration and integration proofs.
2026-07-11 13:05:53 -05:00

192 lines
8.0 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.29.0
package billing
import (
"database/sql"
"encoding/json"
"time"
"github.com/google/uuid"
"github.com/sqlc-dev/pqtype"
)
type Account struct {
BillingAccountID string `json:"billing_account_id"`
OrgID string `json:"org_id"`
Name string `json:"name"`
Status string `json:"status"`
Metadata json.RawMessage `json:"metadata"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type CoreProductShape struct {
ProductID string `json:"product_id"`
LifecycleStatus string `json:"lifecycle_status"`
IsPublic bool `json:"is_public"`
SetPresent interface{} `json:"set_present"`
LadderCount int64 `json:"ladder_count"`
BillingShape string `json:"billing_shape"`
ConsumptionShape string `json:"consumption_shape"`
}
type Invoice struct {
InvoiceID string `json:"invoice_id"`
BillingAccountID string `json:"billing_account_id"`
SubscriptionID uuid.NullUUID `json:"subscription_id"`
Status string `json:"status"`
AmountDue int32 `json:"amount_due"`
AmountPaid int32 `json:"amount_paid"`
Currency string `json:"currency"`
PeriodStart sql.NullTime `json:"period_start"`
PeriodEnd sql.NullTime `json:"period_end"`
DueDate sql.NullTime `json:"due_date"`
PaidAt sql.NullTime `json:"paid_at"`
VoidedAt sql.NullTime `json:"voided_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type InvoiceLineItem struct {
LineItemID string `json:"line_item_id"`
InvoiceID string `json:"invoice_id"`
SubscriptionItemID uuid.NullUUID `json:"subscription_item_id"`
PriceID string `json:"price_id"`
Amount int32 `json:"amount"`
Currency string `json:"currency"`
Description sql.NullString `json:"description"`
Quantity int32 `json:"quantity"`
PeriodStart sql.NullTime `json:"period_start"`
PeriodEnd sql.NullTime `json:"period_end"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Payment struct {
PaymentID string `json:"payment_id"`
InvoiceID string `json:"invoice_id"`
BillingAccountID string `json:"billing_account_id"`
PaymentMethodID uuid.NullUUID `json:"payment_method_id"`
Amount int32 `json:"amount"`
Currency string `json:"currency"`
Status string `json:"status"`
FailedAt sql.NullTime `json:"failed_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type PaymentMethod struct {
PaymentMethodID string `json:"payment_method_id"`
BillingAccountID string `json:"billing_account_id"`
PmType string `json:"pm_type"`
CardBrand sql.NullString `json:"card_brand"`
CardLast4 sql.NullString `json:"card_last4"`
CardExpMonth sql.NullInt32 `json:"card_exp_month"`
CardExpYear sql.NullInt32 `json:"card_exp_year"`
Funding sql.NullString `json:"funding"`
IsDefault bool `json:"is_default"`
DetachedAt sql.NullTime `json:"detached_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type PlanLadder struct {
PlanLadderID string `json:"plan_ladder_id"`
LadderKey string `json:"ladder_key"`
Name string `json:"name"`
Description sql.NullString `json:"description"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
SortOrder int32 `json:"sort_order"`
}
type PlanLadderTier struct {
PlanLadderID string `json:"plan_ladder_id"`
ProductID string `json:"product_id"`
Rank int32 `json:"rank"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type Price struct {
PriceID string `json:"price_id"`
ProductID string `json:"product_id"`
Currency string `json:"currency"`
UnitAmount int32 `json:"unit_amount"`
RecurringInterval sql.NullString `json:"recurring_interval"`
TrialPeriodDays sql.NullInt32 `json:"trial_period_days"`
IsActive bool `json:"is_active"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
IsDefault bool `json:"is_default"`
UsageType sql.NullString `json:"usage_type"`
}
type Product struct {
ProductID string `json:"product_id"`
Name string `json:"name"`
Description sql.NullString `json:"description"`
// Presentation-layer grouping only (Doc 41 Decision 136): storefront sections and operator filters. No code may branch on this value for behavior — structural facts live in plan_ladder_tiers and per-price columns.
DisplayCategory sql.NullString `json:"display_category"`
Metadata pqtype.NullRawMessage `json:"metadata"`
IsActive bool `json:"is_active"`
IsPublic bool `json:"is_public"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
EntitlementSetID uuid.NullUUID `json:"entitlement_set_id"`
LifecycleStatus string `json:"lifecycle_status"`
}
type Subscription struct {
SubscriptionID string `json:"subscription_id"`
BillingAccountID string `json:"billing_account_id"`
Status string `json:"status"`
CurrentPeriodStart sql.NullTime `json:"current_period_start"`
CurrentPeriodEnd sql.NullTime `json:"current_period_end"`
CancelAtPeriodEnd bool `json:"cancel_at_period_end"`
CanceledAt sql.NullTime `json:"canceled_at"`
EndedAt sql.NullTime `json:"ended_at"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
CommitmentEnd sql.NullTime `json:"commitment_end"`
CommitmentRenewal sql.NullString `json:"commitment_renewal"`
EarlyTerminationPolicy sql.NullString `json:"early_termination_policy"`
}
type SubscriptionChange struct {
ChangeID string `json:"change_id"`
SubscriptionID string `json:"subscription_id"`
PreviousStatus sql.NullString `json:"previous_status"`
NewStatus string `json:"new_status"`
StripeEventID string `json:"stripe_event_id"`
ChangedAt time.Time `json:"changed_at"`
}
type SubscriptionItem struct {
SubscriptionItemID string `json:"subscription_item_id"`
SubscriptionID string `json:"subscription_id"`
ProductID string `json:"product_id"`
PriceID string `json:"price_id"`
Quantity int32 `json:"quantity"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type SubscriptionScheduledChange struct {
ScheduledChangeID string `json:"scheduled_change_id"`
SubscriptionID string `json:"subscription_id"`
ChangeType string `json:"change_type"`
TargetPriceID uuid.NullUUID `json:"target_price_id"`
TargetQuantity sql.NullInt32 `json:"target_quantity"`
EffectiveAt time.Time `json:"effective_at"`
EffectiveTrigger string `json:"effective_trigger"`
CreditDisposition sql.NullString `json:"credit_disposition"`
Status string `json:"status"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}