The Rules section is one record table grouped by kind, Limit then Boolean, on fixed columns, edited in place: Edit opens a row's controls in their columns, Add rule opens a dense row above the table, and every change is staged into a tray that lists the deltas with Undo and applies them as one rule-change act. The reduction policy is a column of the rule beside its limit. History shows counts only. Group rows are a quiet heading rather than a divider, the maintainer's pick from four rounds of outside-model ideation. Dense rows align to the top and render each error under its control in every form family (design D16), replacing the below-row error block; the forms library gains the batch form (rows plus one tray) and the RowField dense and label-hidden options. Migration 00019 records the governing reduction policy on effect rows. Archive staged-rule-changes with its spec updates (entitlement-set- management, entitlement-set-history, entitlements, form-library, form-conventions, ui-quality-gate). Screens accepted 2026-09-19.
228 lines
10 KiB
Go
228 lines
10 KiB
Go
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Commercial
|
|
// SPDX-FileCopyrightText: 2025-2026 Christian Galo
|
|
|
|
// Code generated by sqlc. DO NOT EDIT.
|
|
// versions:
|
|
// sqlc v1.29.0
|
|
|
|
package entitlements
|
|
|
|
import (
|
|
"database/sql"
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
"github.com/sqlc-dev/pqtype"
|
|
)
|
|
|
|
type BooleanEntitlement struct {
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
Granted bool `json:"granted"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type EntitlementSet struct {
|
|
SetID string `json:"set_id"`
|
|
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"`
|
|
Key sql.NullString `json:"key"`
|
|
}
|
|
|
|
// Append-only record of what each committed rule change did to each pool and key. Nothing updates or deletes a row.
|
|
type EntitlementSetChangeEffect struct {
|
|
EffectID string `json:"effect_id"`
|
|
ChangeID string `json:"change_id"`
|
|
PoolID string `json:"pool_id"`
|
|
OrgID string `json:"org_id"`
|
|
OrgName string `json:"org_name"`
|
|
ResourceKey string `json:"resource_key"`
|
|
ResourceLabel string `json:"resource_label"`
|
|
LimitBefore sql.NullInt64 `json:"limit_before"`
|
|
LimitAfter sql.NullInt64 `json:"limit_after"`
|
|
GrantedBefore sql.NullBool `json:"granted_before"`
|
|
GrantedAfter sql.NullBool `json:"granted_after"`
|
|
UsageAtEffect sql.NullInt64 `json:"usage_at_effect"`
|
|
OverUsage bool `json:"over_usage"`
|
|
WasOverBefore bool `json:"was_over_before"`
|
|
ReductionPolicy sql.NullString `json:"reduction_policy"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
// The reduction policy governing this pool and key after the act: the strongest across every rule funding the key. NULL on rows written before migration 19 and on a key no rule funds.
|
|
GoverningPolicy sql.NullString `json:"governing_policy"`
|
|
}
|
|
|
|
// Work list of pools a committed rule change owes a recomputation. Not history: rows move from pending to settled or failed.
|
|
type EntitlementSetChangeObligation struct {
|
|
ChangeID string `json:"change_id"`
|
|
PoolID string `json:"pool_id"`
|
|
Status string `json:"status"`
|
|
Attempts int32 `json:"attempts"`
|
|
LastAttemptAt sql.NullTime `json:"last_attempt_at"`
|
|
LastError sql.NullString `json:"last_error"`
|
|
SettledAt sql.NullTime `json:"settled_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
}
|
|
|
|
type EntitlementSetRule struct {
|
|
RuleID string `json:"rule_id"`
|
|
SetID string `json:"set_id"`
|
|
RuleType string `json:"rule_type"`
|
|
ResourceKey sql.NullString `json:"resource_key"`
|
|
ResourceValue sql.NullInt64 `json:"resource_value"`
|
|
ResourcePerUnit sql.NullBool `json:"resource_per_unit"`
|
|
StackingPolicy sql.NullString `json:"stacking_policy"`
|
|
ResetPeriod sql.NullString `json:"reset_period"`
|
|
CreditAmount sql.NullInt32 `json:"credit_amount"`
|
|
CreditCurrency sql.NullString `json:"credit_currency"`
|
|
Description sql.NullString `json:"description"`
|
|
IsActive bool `json:"is_active"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
TierReductionPolicy string `json:"tier_reduction_policy"`
|
|
}
|
|
|
|
type Grant struct {
|
|
GrantID string `json:"grant_id"`
|
|
ProductID string `json:"product_id"`
|
|
GrantedToBillingAccountID uuid.NullUUID `json:"granted_to_billing_account_id"`
|
|
GrantedToOrgID uuid.NullUUID `json:"granted_to_org_id"`
|
|
GrantedToPersonID uuid.NullUUID `json:"granted_to_person_id"`
|
|
GrantedByPersonID uuid.NullUUID `json:"granted_by_person_id"`
|
|
GrantReason string `json:"grant_reason"`
|
|
Description sql.NullString `json:"description"`
|
|
Quantity int32 `json:"quantity"`
|
|
ValidFrom time.Time `json:"valid_from"`
|
|
ValidUntil sql.NullTime `json:"valid_until"`
|
|
Status string `json:"status"`
|
|
RevokedAt sql.NullTime `json:"revoked_at"`
|
|
RevokedByPersonID uuid.NullUUID `json:"revoked_by_person_id"`
|
|
RevocationReason sql.NullString `json:"revocation_reason"`
|
|
Metadata pqtype.NullRawMessage `json:"metadata"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ExtendsGrantID uuid.NullUUID `json:"extends_grant_id"`
|
|
}
|
|
|
|
type NumericEntitlement struct {
|
|
EntitlementID string `json:"entitlement_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
EntitlementType string `json:"entitlement_type"`
|
|
ResourceLimit int64 `json:"resource_limit"`
|
|
ResetPeriod sql.NullString `json:"reset_period"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NumericEntitlementContribution struct {
|
|
ContributionID string `json:"contribution_id"`
|
|
EntitlementID string `json:"entitlement_id"`
|
|
ProvisionID string `json:"provision_id"`
|
|
ContributedValue int64 `json:"contributed_value"`
|
|
StackingPolicy string `json:"stacking_policy"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type NumericEntitlementUsage struct {
|
|
UsageID string `json:"usage_id"`
|
|
EntitlementID string `json:"entitlement_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ResourceKey string `json:"resource_key"`
|
|
CurrentUsage int64 `json:"current_usage"`
|
|
CurrentPeriodStart sql.NullTime `json:"current_period_start"`
|
|
CurrentPeriodEnd sql.NullTime `json:"current_period_end"`
|
|
LastResetAt sql.NullTime `json:"last_reset_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PoolAssignment struct {
|
|
AssignmentID string `json:"assignment_id"`
|
|
PoolID string `json:"pool_id"`
|
|
WorkspaceID string `json:"workspace_id"`
|
|
IsPrimary bool `json:"is_primary"`
|
|
Status string `json:"status"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|
|
|
|
type PoolProvision struct {
|
|
ProvisionID string `json:"provision_id"`
|
|
PoolID string `json:"pool_id"`
|
|
BillingAccountID uuid.NullUUID `json:"billing_account_id"`
|
|
SubscriptionID uuid.NullUUID `json:"subscription_id"`
|
|
PurchaseID uuid.NullUUID `json:"purchase_id"`
|
|
GrantID uuid.NullUUID `json:"grant_id"`
|
|
Quantity int32 `json:"quantity"`
|
|
Status string `json:"status"`
|
|
ActivatedAt time.Time `json:"activated_at"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
EndedAt sql.NullTime `json:"ended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
EntitlementSetID string `json:"entitlement_set_id"`
|
|
ProductID string `json:"product_id"`
|
|
}
|
|
|
|
type PoolProvisionLadder struct {
|
|
ProvisionID string `json:"provision_id"`
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
PoolID string `json:"pool_id"`
|
|
Status string `json:"status"`
|
|
ActivatedAt time.Time `json:"activated_at"`
|
|
EndedAt sql.NullTime `json:"ended_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ProductID string `json:"product_id"`
|
|
ProvisionLadderID string `json:"provision_ladder_id"`
|
|
}
|
|
|
|
type PoolProvisionTransition struct {
|
|
TransitionID string `json:"transition_id"`
|
|
PoolID string `json:"pool_id"`
|
|
ProvisionID uuid.NullUUID `json:"provision_id"`
|
|
PlanLadderID string `json:"plan_ladder_id"`
|
|
FromRank sql.NullInt32 `json:"from_rank"`
|
|
ToRank sql.NullInt32 `json:"to_rank"`
|
|
TransitionType string `json:"transition_type"`
|
|
ActorType string `json:"actor_type"`
|
|
ActorID uuid.NullUUID `json:"actor_id"`
|
|
Reason sql.NullString `json:"reason"`
|
|
EffectiveAt time.Time `json:"effective_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
ProvisionLadderID uuid.NullUUID `json:"provision_ladder_id"`
|
|
}
|
|
|
|
type ResourceKey struct {
|
|
ResourceKey string `json:"resource_key"`
|
|
DisplayName string `json:"display_name"`
|
|
Description sql.NullString `json:"description"`
|
|
Unit string `json:"unit"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
Provider sql.NullString `json:"provider"`
|
|
Kind string `json:"kind"`
|
|
OverLimitBehavior string `json:"over_limit_behavior"`
|
|
OverLimitConsequence sql.NullString `json:"over_limit_consequence"`
|
|
}
|
|
|
|
type ResourcePool struct {
|
|
PoolID string `json:"pool_id"`
|
|
OrgID string `json:"org_id"`
|
|
Name string `json:"name"`
|
|
Key sql.NullString `json:"key"`
|
|
PoolType string `json:"pool_type"`
|
|
IsAutoManaged bool `json:"is_auto_managed"`
|
|
Description sql.NullString `json:"description"`
|
|
Status string `json:"status"`
|
|
SuspendedAt sql.NullTime `json:"suspended_at"`
|
|
ArchivedAt sql.NullTime `json:"archived_at"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
}
|