{
  "version": "1.0.0",
  "timestamp": 0,
  "packageName": "@happyvertical/smrt-subscriptions",
  "packageVersion": "0.51.10",
  "objects": {
    "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection": {
      "name": "subscriptionplancollection",
      "className": "SubscriptionPlanCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlanCollection",
      "collection": "subscriptionplans",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/SubscriptionPlanCollection.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {
        "findByPlanKey": {
          "name": "findByPlanKey",
          "async": true,
          "parameters": [
            {
              "name": "planKey",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<SubscriptionPlan | null>",
          "isStatic": false,
          "isPublic": true
        },
        "findActive": {
          "name": "findActive",
          "async": true,
          "parameters": [],
          "returnType": "Promise<SubscriptionPlan[]>",
          "isStatic": false,
          "isPublic": true
        },
        "findByStripePriceId": {
          "name": "findByStripePriceId",
          "async": true,
          "parameters": [
            {
              "name": "stripePriceId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<SubscriptionPlan | null>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_subscription_plans"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "SubscriptionPlan",
      "exportName": "SubscriptionPlanCollection",
      "collectionExportName": "SubscriptionPlanCollectionCollection",
      "schema": {
        "tableName": "_smrt_subscription_plans",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_subscription_plans\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID,\n  \"plan_key\" TEXT DEFAULT '',\n  \"name\" TEXT DEFAULT '',\n  \"description\" TEXT DEFAULT '',\n  \"status\" TEXT DEFAULT 'active',\n  \"sort_order\" INTEGER DEFAULT 0,\n  \"price_amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"billing_interval\" TEXT DEFAULT 'month',\n  \"external_provider\" TEXT DEFAULT 'stripe',\n  \"stripe_product_id\" TEXT DEFAULT '',\n  \"stripe_price_id\" TEXT DEFAULT '',\n  \"features\" TEXT DEFAULT '[]',\n  \"thresholds\" TEXT DEFAULT '[]',\n  \"metadata\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": false,
            "unique": false
          },
          "plan_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "name": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "description": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "active"
          },
          "sort_order": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "price_amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "billing_interval": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "month"
          },
          "external_provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "stripe"
          },
          "stripe_product_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_price_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "features": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "[]"
          },
          "thresholds": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "[]"
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_subscription_plans_plan_key_idx",
            "columns": [
              "plan_key"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_subscription_plans_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_subscription_plans_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "65765fd0"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection": {
      "name": "tenantsubscriptioncollection",
      "className": "TenantSubscriptionCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:TenantSubscriptionCollection",
      "collection": "tenantsubscriptions",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantSubscriptionCollection.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {
        "findByTenant": {
          "name": "findByTenant",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<TenantSubscription[]>",
          "isStatic": false,
          "isPublic": true
        },
        "findCurrentForTenant": {
          "name": "findCurrentForTenant",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string",
              "optional": false
            },
            {
              "name": "now",
              "type": "any",
              "optional": true
            }
          ],
          "returnType": "Promise<TenantSubscription | null>",
          "isStatic": false,
          "isPublic": true
        },
        "findCurrentForSubscriber": {
          "name": "findCurrentForSubscriber",
          "async": true,
          "parameters": [
            {
              "name": "subscriber",
              "type": "Subscriber",
              "optional": false
            },
            {
              "name": "now",
              "type": "any",
              "optional": true
            }
          ],
          "returnType": "Promise<TenantSubscription | null>",
          "isStatic": false,
          "isPublic": true
        },
        "findByStripeSubscriptionId": {
          "name": "findByStripeSubscriptionId",
          "async": true,
          "parameters": [
            {
              "name": "stripeSubscriptionId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<TenantSubscription | null>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_tenant_subscriptions"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "TenantSubscription",
      "exportName": "TenantSubscriptionCollection",
      "collectionExportName": "TenantSubscriptionCollectionCollection",
      "schema": {
        "tableName": "_smrt_tenant_subscriptions",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_subscriptions\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"plan_id\" UUID,\n  \"status\" TEXT DEFAULT 'incomplete',\n  \"started_at\" TIMESTAMP,\n  \"current_period_start\" TIMESTAMP,\n  \"current_period_end\" TIMESTAMP,\n  \"trial_ends_at\" TIMESTAMP,\n  \"cancel_at_period_end\" BOOLEAN DEFAULT FALSE,\n  \"canceled_at\" TIMESTAMP,\n  \"external_provider\" TEXT DEFAULT 'stripe',\n  \"stripe_customer_id\" TEXT DEFAULT '',\n  \"stripe_subscription_id\" TEXT DEFAULT '',\n  \"stripe_checkout_session_id\" TEXT DEFAULT '',\n  \"metadata\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "plan_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_subscription_plans",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "incomplete"
          },
          "started_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "current_period_start": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "current_period_end": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "trial_ends_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "cancel_at_period_end": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": false
          },
          "canceled_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "external_provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "stripe"
          },
          "stripe_customer_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_subscription_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_checkout_session_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx",
            "columns": [
              "tenant_id",
              "subscriber_kind",
              "subscriber_external_id"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_tenant_subscriptions_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_tenant_subscriptions_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_tenant_subscriptions_plan_id_idx",
            "columns": [
              "plan_id"
            ]
          }
        ],
        "version": "ac93fb43"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection": {
      "name": "tenantusagemetriccollection",
      "className": "TenantUsageMetricCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:TenantUsageMetricCollection",
      "collection": "tenantusagemetrics",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/collections/TenantUsageMetricCollection.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {
        "recordUsage": {
          "name": "recordUsage",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "RecordUsageOptions",
              "optional": false
            }
          ],
          "returnType": "Promise<TenantUsageMetric>",
          "isStatic": false,
          "isPublic": true
        },
        "findByTenantAndMetric": {
          "name": "findByTenantAndMetric",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string",
              "optional": false
            },
            {
              "name": "metricKey",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<TenantUsageMetric[]>",
          "isStatic": false,
          "isPublic": true
        },
        "summarizeUsage": {
          "name": "summarizeUsage",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "SummarizeUsageOptions",
              "optional": false
            }
          ],
          "returnType": "Promise<UsageSummary>",
          "isStatic": false,
          "isPublic": true
        },
        "summarizeUsageBatch": {
          "name": "summarizeUsageBatch",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "SummarizeUsageBatchOptions",
              "optional": false
            }
          ],
          "returnType": "Promise<UsageSummary[]>",
          "isStatic": false,
          "isPublic": true
        },
        "summarizeTenantAiUsage": {
          "name": "summarizeTenantAiUsage",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "SummarizeAiUsageOptions",
              "optional": false
            }
          ],
          "returnType": "Promise<AiUsageSummary>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_tenant_usage_metrics"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "TenantUsageMetric",
      "exportName": "TenantUsageMetricCollection",
      "collectionExportName": "TenantUsageMetricCollectionCollection",
      "schema": {
        "tableName": "_smrt_tenant_usage_metrics",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_usage_metrics\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"quantity\" REAL DEFAULT 0,\n  \"window_start\" TIMESTAMP,\n  \"window_end\" TIMESTAMP,\n  \"source\" TEXT DEFAULT '',\n  \"source_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"work_ref_type\" TEXT DEFAULT '',\n  \"work_ref_id\" TEXT DEFAULT '',\n  \"provider\" TEXT DEFAULT '',\n  \"dimensions\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "quantity": {
            "type": "REAL",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "window_start": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "window_end": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "source": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_type": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "dimensions": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_tenant_usage_metrics_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_tenant_usage_metrics_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "b799c746"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:SubscriptionPlan": {
      "name": "subscriptionplan",
      "className": "SubscriptionPlan",
      "qualifiedName": "@happyvertical/smrt-subscriptions:SubscriptionPlan",
      "collection": "subscriptionplans",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/SubscriptionPlan.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": false,
          "_meta": {
            "sqlType": "UUID",
            "nullable": true,
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": false,
              "autoPopulate": true,
              "nullable": true,
              "mode": "optional",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "planKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "name": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "description": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "status": {
          "type": "text",
          "required": false,
          "default": "active"
        },
        "sortOrder": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "priceAmount": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "billingInterval": {
          "type": "text",
          "required": false,
          "default": "month"
        },
        "externalProvider": {
          "type": "text",
          "required": false,
          "default": "stripe"
        },
        "stripeProductId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "stripePriceId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "features": {
          "type": "text",
          "required": false,
          "default": "[]"
        },
        "thresholds": {
          "type": "text",
          "required": false,
          "default": "[]"
        },
        "metadata": {
          "type": "text",
          "required": false,
          "default": "{}"
        }
      },
      "methods": {
        "isActive": {
          "name": "isActive",
          "async": false,
          "parameters": [],
          "returnType": "boolean",
          "isStatic": false,
          "isPublic": true
        },
        "getFeatureGrants": {
          "name": "getFeatureGrants",
          "async": false,
          "parameters": [],
          "returnType": "PlanFeatureGrant[]",
          "isStatic": false,
          "isPublic": true
        },
        "setFeatureGrants": {
          "name": "setFeatureGrants",
          "async": false,
          "parameters": [
            {
              "name": "grants",
              "type": "Array<string | PlanFeatureGrant>",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        },
        "getFeatureKeys": {
          "name": "getFeatureKeys",
          "async": false,
          "parameters": [],
          "returnType": "string[]",
          "isStatic": false,
          "isPublic": true
        },
        "getThresholds": {
          "name": "getThresholds",
          "async": false,
          "parameters": [],
          "returnType": "PlanThreshold[]",
          "isStatic": false,
          "isPublic": true
        },
        "setThresholds": {
          "name": "setThresholds",
          "async": false,
          "parameters": [
            {
              "name": "thresholds",
              "type": "PlanThreshold[]",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        },
        "getMetadata": {
          "name": "getMetadata",
          "async": false,
          "parameters": [],
          "returnType": "JsonObject",
          "isStatic": false,
          "isPublic": true
        },
        "setMetadata": {
          "name": "setMetadata",
          "async": false,
          "parameters": [
            {
              "name": "metadata",
              "type": "JsonObject",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_subscription_plans",
        "api": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "cli": {
          "skipApiCheck": true
        },
        "mcp": {
          "include": [
            "list",
            "get"
          ]
        },
        "conflictColumns": [
          "plan_key"
        ],
        "tenantScoped": {
          "mode": "optional"
        }
      },
      "extends": "SmrtObject",
      "exportName": "SubscriptionPlan",
      "collectionExportName": "SubscriptionPlanCollection",
      "schema": {
        "tableName": "_smrt_subscription_plans",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_subscription_plans\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID,\n  \"plan_key\" TEXT DEFAULT '',\n  \"name\" TEXT DEFAULT '',\n  \"description\" TEXT DEFAULT '',\n  \"status\" TEXT DEFAULT 'active',\n  \"sort_order\" INTEGER DEFAULT 0,\n  \"price_amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"billing_interval\" TEXT DEFAULT 'month',\n  \"external_provider\" TEXT DEFAULT 'stripe',\n  \"stripe_product_id\" TEXT DEFAULT '',\n  \"stripe_price_id\" TEXT DEFAULT '',\n  \"features\" TEXT DEFAULT '[]',\n  \"thresholds\" TEXT DEFAULT '[]',\n  \"metadata\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": false,
            "unique": false
          },
          "plan_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "name": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "description": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "active"
          },
          "sort_order": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "price_amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "billing_interval": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "month"
          },
          "external_provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "stripe"
          },
          "stripe_product_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_price_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "features": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "[]"
          },
          "thresholds": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "[]"
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_subscription_plans_plan_key_idx",
            "columns": [
              "plan_key"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_subscription_plans_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_subscription_plans_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "65765fd0"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:TenantSubscription": {
      "name": "tenantsubscription",
      "className": "TenantSubscription",
      "qualifiedName": "@happyvertical/smrt-subscriptions:TenantSubscription",
      "collection": "tenantsubscriptions",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantSubscription.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "subscriberKind": {
          "type": "text",
          "required": false,
          "default": "tenant"
        },
        "subscriberExternalId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "planId": {
          "type": "foreignKey",
          "required": false,
          "related": "SubscriptionPlan"
        },
        "status": {
          "type": "text",
          "required": false,
          "default": "incomplete"
        },
        "startedAt": {
          "type": "datetime",
          "required": false
        },
        "currentPeriodStart": {
          "type": "datetime",
          "required": false
        },
        "currentPeriodEnd": {
          "type": "datetime",
          "required": false
        },
        "trialEndsAt": {
          "type": "datetime",
          "required": false
        },
        "cancelAtPeriodEnd": {
          "type": "boolean",
          "required": false,
          "default": false
        },
        "canceledAt": {
          "type": "datetime",
          "required": false
        },
        "externalProvider": {
          "type": "text",
          "required": false,
          "default": "stripe"
        },
        "stripeCustomerId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "stripeSubscriptionId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "stripeCheckoutSessionId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "metadata": {
          "type": "text",
          "required": false,
          "default": "{}"
        }
      },
      "methods": {
        "isEntitled": {
          "name": "isEntitled",
          "async": false,
          "parameters": [
            {
              "name": "now",
              "type": "any",
              "optional": true
            }
          ],
          "returnType": "boolean",
          "isStatic": false,
          "isPublic": true
        },
        "getSubscriber": {
          "name": "getSubscriber",
          "async": false,
          "parameters": [],
          "returnType": "Subscriber | null",
          "isStatic": false,
          "isPublic": true
        },
        "getMetadata": {
          "name": "getMetadata",
          "async": false,
          "parameters": [],
          "returnType": "JsonObject",
          "isStatic": false,
          "isPublic": true
        },
        "setMetadata": {
          "name": "setMetadata",
          "async": false,
          "parameters": [
            {
              "name": "metadata",
              "type": "JsonObject",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_tenant_subscriptions",
        "api": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "cli": {
          "skipApiCheck": true
        },
        "mcp": {
          "include": [
            "list",
            "get"
          ]
        },
        "conflictColumns": [
          "tenant_id",
          "subscriber_kind",
          "subscriber_external_id"
        ],
        "tenantScoped": {
          "mode": "required"
        }
      },
      "extends": "SmrtObject",
      "exportName": "TenantSubscription",
      "collectionExportName": "TenantSubscriptionCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_tenant_subscriptions",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_subscriptions\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"plan_id\" UUID,\n  \"status\" TEXT DEFAULT 'incomplete',\n  \"started_at\" TIMESTAMP,\n  \"current_period_start\" TIMESTAMP,\n  \"current_period_end\" TIMESTAMP,\n  \"trial_ends_at\" TIMESTAMP,\n  \"cancel_at_period_end\" BOOLEAN DEFAULT FALSE,\n  \"canceled_at\" TIMESTAMP,\n  \"external_provider\" TEXT DEFAULT 'stripe',\n  \"stripe_customer_id\" TEXT DEFAULT '',\n  \"stripe_subscription_id\" TEXT DEFAULT '',\n  \"stripe_checkout_session_id\" TEXT DEFAULT '',\n  \"metadata\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "plan_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_subscription_plans",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "incomplete"
          },
          "started_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "current_period_start": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "current_period_end": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "trial_ends_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "cancel_at_period_end": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": false
          },
          "canceled_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "external_provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "stripe"
          },
          "stripe_customer_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_subscription_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "stripe_checkout_session_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_tenant_subscriptions_tenant_id_subscriber_kind_idx",
            "columns": [
              "tenant_id",
              "subscriber_kind",
              "subscriber_external_id"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_tenant_subscriptions_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_tenant_subscriptions_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_tenant_subscriptions_plan_id_idx",
            "columns": [
              "plan_id"
            ]
          }
        ],
        "version": "ac93fb43"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:TenantUsageMetric": {
      "name": "tenantusagemetric",
      "className": "TenantUsageMetric",
      "qualifiedName": "@happyvertical/smrt-subscriptions:TenantUsageMetric",
      "collection": "tenantusagemetrics",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/TenantUsageMetric.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "subscriberKind": {
          "type": "text",
          "required": false,
          "default": "tenant"
        },
        "subscriberExternalId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "metricKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "quantity": {
          "type": "decimal",
          "required": false,
          "default": 0
        },
        "windowStart": {
          "type": "datetime",
          "required": false
        },
        "windowEnd": {
          "type": "datetime",
          "required": false
        },
        "source": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "sourceId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "projectId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "workRefType": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "workRefId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "provider": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "dimensions": {
          "type": "text",
          "required": false,
          "default": "{}"
        }
      },
      "methods": {
        "getSubscriber": {
          "name": "getSubscriber",
          "async": false,
          "parameters": [],
          "returnType": "Subscriber | null",
          "isStatic": false,
          "isPublic": true
        },
        "getDimensions": {
          "name": "getDimensions",
          "async": false,
          "parameters": [],
          "returnType": "JsonObject",
          "isStatic": false,
          "isPublic": true
        },
        "setDimensions": {
          "name": "setDimensions",
          "async": false,
          "parameters": [
            {
              "name": "dimensions",
              "type": "JsonObject",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_tenant_usage_metrics",
        "api": {
          "include": [
            "list",
            "get",
            "create"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get",
            "create"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get"
          ]
        },
        "tenantScoped": {
          "mode": "required"
        },
        "conflictColumns": [
          "tenant_id",
          "slug",
          "context"
        ]
      },
      "extends": "SmrtObject",
      "exportName": "TenantUsageMetric",
      "collectionExportName": "TenantUsageMetricCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_tenant_usage_metrics",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_tenant_usage_metrics\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"quantity\" REAL DEFAULT 0,\n  \"window_start\" TIMESTAMP,\n  \"window_end\" TIMESTAMP,\n  \"source\" TEXT DEFAULT '',\n  \"source_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"work_ref_type\" TEXT DEFAULT '',\n  \"work_ref_id\" TEXT DEFAULT '',\n  \"provider\" TEXT DEFAULT '',\n  \"dimensions\" TEXT DEFAULT '{}'\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "quantity": {
            "type": "REAL",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "window_start": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "window_end": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "source": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_type": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "dimensions": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "_smrt_tenant_usage_metrics_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_tenant_usage_metrics_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "b799c746"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:PricingRule": {
      "name": "pricingrule",
      "className": "PricingRule",
      "qualifiedName": "@happyvertical/smrt-subscriptions:PricingRule",
      "collection": "pricingrules",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "ruleKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "metricKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "serviceKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "strategy": {
          "type": "text",
          "required": false,
          "default": "fixed_unit"
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "effectiveFrom": {
          "type": "datetime",
          "required": false
        },
        "effectiveTo": {
          "type": "datetime",
          "required": false
        },
        "priority": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "terms": {
          "type": "text",
          "required": false,
          "default": "{}"
        },
        "active": {
          "type": "boolean",
          "required": false,
          "default": true
        }
      },
      "methods": {
        "getTerms": {
          "name": "getTerms",
          "async": false,
          "parameters": [],
          "returnType": "Record<string, unknown>",
          "isStatic": false,
          "isPublic": true
        },
        "setTerms": {
          "name": "setTerms",
          "async": false,
          "parameters": [
            {
              "name": "value",
              "type": "Record<string, unknown>",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_pricing_rules",
        "api": true,
        "cli": true,
        "mcp": true,
        "tenantScoped": {
          "mode": "required"
        },
        "conflictColumns": [
          "tenant_id",
          "slug",
          "context"
        ]
      },
      "extends": "SmrtObject",
      "exportName": "PricingRule",
      "collectionExportName": "PricingRuleCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_pricing_rules",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"rule_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"strategy\" TEXT DEFAULT 'fixed_unit',\n  \"currency\" TEXT DEFAULT 'USD',\n  \"effective_from\" TIMESTAMP,\n  \"effective_to\" TIMESTAMP,\n  \"priority\" INTEGER DEFAULT 0,\n  \"terms\" TEXT DEFAULT '{}',\n  \"active\" BOOLEAN DEFAULT TRUE\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "rule_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "strategy": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "fixed_unit"
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "effective_from": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "effective_to": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "priority": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "terms": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          },
          "active": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": true
          }
        },
        "indexes": [
          {
            "name": "_smrt_pricing_rules_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_pricing_rules_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "88642897"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:ClientCharge": {
      "name": "clientcharge",
      "className": "ClientCharge",
      "qualifiedName": "@happyvertical/smrt-subscriptions:ClientCharge",
      "collection": "clientcharges",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "usageEventId": {
          "type": "foreignKey",
          "required": false,
          "related": "TenantUsageMetric"
        },
        "subscriberKind": {
          "type": "text",
          "required": false,
          "default": "tenant"
        },
        "subscriberExternalId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "projectId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "workRefType": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "workRefId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "provider": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "serviceKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "metricKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "quantity": {
          "type": "decimal",
          "required": false,
          "default": 0
        },
        "amount": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "pricingRuleId": {
          "type": "foreignKey",
          "required": false,
          "related": "PricingRule"
        },
        "pricingSnapshot": {
          "type": "text",
          "required": false,
          "default": "{}"
        },
        "status": {
          "type": "text",
          "required": false,
          "default": "draft"
        },
        "approvedAt": {
          "type": "datetime",
          "required": false
        }
      },
      "methods": {
        "getPricingSnapshot": {
          "name": "getPricingSnapshot",
          "async": false,
          "parameters": [],
          "returnType": "Record<string, unknown>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "_smrt_client_charges",
        "api": {
          "include": [
            "list",
            "get"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get"
          ]
        },
        "conflictColumns": [
          "usage_event_id"
        ],
        "tenantScoped": {
          "mode": "required"
        }
      },
      "extends": "SmrtObject",
      "exportName": "ClientCharge",
      "collectionExportName": "ClientChargeCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_client_charges",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"usage_event_id\" UUID,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"work_ref_type\" TEXT DEFAULT '',\n  \"work_ref_id\" TEXT DEFAULT '',\n  \"provider\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"quantity\" REAL DEFAULT 0,\n  \"amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"pricing_rule_id\" UUID,\n  \"pricing_snapshot\" TEXT DEFAULT '{}',\n  \"status\" TEXT DEFAULT 'draft',\n  \"approved_at\" TIMESTAMP\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "usage_event_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_tenant_usage_metrics",
              "column": "id",
              "onDelete": "CASCADE",
              "onUpdate": "CASCADE"
            }
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_type": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "quantity": {
            "type": "REAL",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "pricing_rule_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_pricing_rules",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "pricing_snapshot": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "draft"
          },
          "approved_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          }
        },
        "indexes": [
          {
            "name": "_smrt_client_charges_usage_event_id_idx",
            "columns": [
              "usage_event_id"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_client_charges_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_client_charges_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_client_charges_pricing_rule_id_idx",
            "columns": [
              "pricing_rule_id"
            ]
          }
        ],
        "version": "a1a33c54"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:BillingAdjustment": {
      "name": "billingadjustment",
      "className": "BillingAdjustment",
      "qualifiedName": "@happyvertical/smrt-subscriptions:BillingAdjustment",
      "collection": "billingadjustments",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "clientChargeId": {
          "type": "foreignKey",
          "required": false,
          "related": "ClientCharge"
        },
        "amount": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "reason": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "source": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "sourceId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "createdBy": {
          "type": "text",
          "required": false,
          "default": ""
        }
      },
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_billing_adjustments",
        "api": {
          "include": [
            "list",
            "get"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get"
          ]
        },
        "tenantScoped": {
          "mode": "required"
        },
        "conflictColumns": [
          "tenant_id",
          "slug",
          "context"
        ]
      },
      "extends": "SmrtObject",
      "exportName": "BillingAdjustment",
      "collectionExportName": "BillingAdjustmentCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_billing_adjustments",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_adjustments\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"client_charge_id\" UUID,\n  \"amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"reason\" TEXT DEFAULT '',\n  \"source\" TEXT DEFAULT '',\n  \"source_id\" TEXT DEFAULT '',\n  \"created_by\" TEXT DEFAULT ''\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "client_charge_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_client_charges",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "reason": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "created_by": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          }
        },
        "indexes": [
          {
            "name": "_smrt_billing_adjustments_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_billing_adjustments_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_billing_adjustments_client_charge_id_idx",
            "columns": [
              "client_charge_id"
            ]
          }
        ],
        "version": "cded0b52"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:SpendingPolicy": {
      "name": "spendingpolicy",
      "className": "SpendingPolicy",
      "qualifiedName": "@happyvertical/smrt-subscriptions:SpendingPolicy",
      "collection": "spendingpolicies",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {
        "tenantId": {
          "type": "text",
          "required": true,
          "_meta": {
            "sqlType": "UUID",
            "__tenancy": {
              "isTenantIdField": true,
              "autoFilter": true,
              "required": true,
              "autoPopulate": true,
              "nullable": false,
              "mode": "required",
              "field": "tenantId",
              "allowSuperAdminBypass": false
            }
          }
        },
        "name": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "subscriberKind": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "subscriberExternalId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "projectId": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "serviceKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "metricKey": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "period": {
          "type": "text",
          "required": false,
          "default": "month"
        },
        "rollingSeconds": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "limitAmount": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "behavior": {
          "type": "text",
          "required": false,
          "default": "observe"
        },
        "priority": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "active": {
          "type": "boolean",
          "required": false,
          "default": true
        }
      },
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_spending_policies",
        "conflictColumns": [
          "tenant_id",
          "subscriber_kind",
          "subscriber_external_id",
          "project_id",
          "service_key",
          "metric_key",
          "period",
          "name"
        ],
        "api": true,
        "cli": true,
        "mcp": true,
        "tenantScoped": {
          "mode": "required"
        }
      },
      "extends": "SmrtObject",
      "exportName": "SpendingPolicy",
      "collectionExportName": "SpendingPolicyCollection",
      "validationRules": [],
      "schema": {
        "tableName": "_smrt_spending_policies",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"name\" TEXT DEFAULT '',\n  \"subscriber_kind\" TEXT DEFAULT '',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"period\" TEXT DEFAULT 'month',\n  \"rolling_seconds\" INTEGER DEFAULT 0,\n  \"limit_amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"behavior\" TEXT DEFAULT 'observe',\n  \"priority\" INTEGER DEFAULT 0,\n  \"active\" BOOLEAN DEFAULT TRUE\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "name": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "period": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "month"
          },
          "rolling_seconds": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "limit_amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "behavior": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "observe"
          },
          "priority": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "active": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": true
          }
        },
        "indexes": [
          {
            "name": "_smrt_spending_policies_tenant_id_subscriber_kind_idx",
            "columns": [
              "tenant_id",
              "subscriber_kind",
              "subscriber_external_id",
              "project_id",
              "service_key",
              "metric_key",
              "period",
              "name"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_spending_policies_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_spending_policies_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "6a413cf4"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:PricingRuleCollection": {
      "name": "pricingrulecollection",
      "className": "PricingRuleCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:PricingRuleCollection",
      "collection": "pricingrules",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_pricing_rules"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "PricingRule",
      "exportName": "PricingRuleCollection",
      "collectionExportName": "PricingRuleCollectionCollection",
      "schema": {
        "tableName": "_smrt_pricing_rules",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_pricing_rules\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"rule_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"strategy\" TEXT DEFAULT 'fixed_unit',\n  \"currency\" TEXT DEFAULT 'USD',\n  \"effective_from\" TIMESTAMP,\n  \"effective_to\" TIMESTAMP,\n  \"priority\" INTEGER DEFAULT 0,\n  \"terms\" TEXT DEFAULT '{}',\n  \"active\" BOOLEAN DEFAULT TRUE\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "rule_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "strategy": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "fixed_unit"
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "effective_from": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "effective_to": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "priority": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "terms": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          },
          "active": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": true
          }
        },
        "indexes": [
          {
            "name": "_smrt_pricing_rules_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_pricing_rules_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "88642897"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:ClientChargeCollection": {
      "name": "clientchargecollection",
      "className": "ClientChargeCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:ClientChargeCollection",
      "collection": "clientcharges",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_client_charges"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "ClientCharge",
      "exportName": "ClientChargeCollection",
      "collectionExportName": "ClientChargeCollectionCollection",
      "schema": {
        "tableName": "_smrt_client_charges",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_client_charges\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"usage_event_id\" UUID,\n  \"subscriber_kind\" TEXT DEFAULT 'tenant',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"work_ref_type\" TEXT DEFAULT '',\n  \"work_ref_id\" TEXT DEFAULT '',\n  \"provider\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"quantity\" REAL DEFAULT 0,\n  \"amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"pricing_rule_id\" UUID,\n  \"pricing_snapshot\" TEXT DEFAULT '{}',\n  \"status\" TEXT DEFAULT 'draft',\n  \"approved_at\" TIMESTAMP\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "usage_event_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_tenant_usage_metrics",
              "column": "id",
              "onDelete": "CASCADE",
              "onUpdate": "CASCADE"
            }
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "tenant"
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_type": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "work_ref_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "provider": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "quantity": {
            "type": "REAL",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "pricing_rule_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_pricing_rules",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "pricing_snapshot": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "draft"
          },
          "approved_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          }
        },
        "indexes": [
          {
            "name": "_smrt_client_charges_usage_event_id_idx",
            "columns": [
              "usage_event_id"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_client_charges_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_client_charges_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_client_charges_pricing_rule_id_idx",
            "columns": [
              "pricing_rule_id"
            ]
          }
        ],
        "version": "a1a33c54"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection": {
      "name": "billingadjustmentcollection",
      "className": "BillingAdjustmentCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:BillingAdjustmentCollection",
      "collection": "billingadjustments",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_billing_adjustments"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "BillingAdjustment",
      "exportName": "BillingAdjustmentCollection",
      "collectionExportName": "BillingAdjustmentCollectionCollection",
      "schema": {
        "tableName": "_smrt_billing_adjustments",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_billing_adjustments\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"client_charge_id\" UUID,\n  \"amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"reason\" TEXT DEFAULT '',\n  \"source\" TEXT DEFAULT '',\n  \"source_id\" TEXT DEFAULT '',\n  \"created_by\" TEXT DEFAULT ''\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "client_charge_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "_smrt_client_charges",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "reason": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "source_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "created_by": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          }
        },
        "indexes": [
          {
            "name": "_smrt_billing_adjustments_slug_context_idx",
            "columns": [
              "tenant_id",
              "slug",
              "context"
            ],
            "unique": true
          },
          {
            "name": "_smrt_billing_adjustments_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "_smrt_billing_adjustments_client_charge_id_idx",
            "columns": [
              "client_charge_id"
            ]
          }
        ],
        "version": "cded0b52"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    },
    "@happyvertical/smrt-subscriptions:SpendingPolicyCollection": {
      "name": "spendingpolicycollection",
      "className": "SpendingPolicyCollection",
      "qualifiedName": "@happyvertical/smrt-subscriptions:SpendingPolicyCollection",
      "collection": "spendingpolicies",
      "filePath": "/home/runner/work/smrt/smrt/packages/subscriptions/src/models/commercial.ts",
      "packageName": "@happyvertical/smrt-subscriptions",
      "fields": {},
      "methods": {},
      "decoratorConfig": {
        "tableName": "_smrt_spending_policies"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "SpendingPolicy",
      "exportName": "SpendingPolicyCollection",
      "collectionExportName": "SpendingPolicyCollectionCollection",
      "schema": {
        "tableName": "_smrt_spending_policies",
        "ddl": "CREATE TABLE IF NOT EXISTS \"_smrt_spending_policies\" (\n  \"id\" UUID PRIMARY KEY NOT NULL,\n  \"slug\" TEXT NOT NULL,\n  \"context\" TEXT NOT NULL DEFAULT '',\n  \"created_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"updated_at\" TIMESTAMP NOT NULL DEFAULT current_timestamp,\n  \"tenant_id\" UUID NOT NULL,\n  \"name\" TEXT DEFAULT '',\n  \"subscriber_kind\" TEXT DEFAULT '',\n  \"subscriber_external_id\" TEXT DEFAULT '',\n  \"project_id\" TEXT DEFAULT '',\n  \"service_key\" TEXT DEFAULT '',\n  \"metric_key\" TEXT DEFAULT '',\n  \"period\" TEXT DEFAULT 'month',\n  \"rolling_seconds\" INTEGER DEFAULT 0,\n  \"limit_amount\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\n  \"behavior\" TEXT DEFAULT 'observe',\n  \"priority\" INTEGER DEFAULT 0,\n  \"active\" BOOLEAN DEFAULT TRUE\n);",
        "columns": {
          "id": {
            "type": "UUID",
            "primaryKey": true,
            "referenceKind": "id",
            "notNull": true
          },
          "slug": {
            "type": "TEXT",
            "notNull": true
          },
          "context": {
            "type": "TEXT",
            "notNull": true,
            "default": ""
          },
          "created_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "updated_at": {
            "type": "TIMESTAMP",
            "notNull": true,
            "default": "current_timestamp"
          },
          "tenant_id": {
            "type": "UUID",
            "referenceKind": "tenantId",
            "notNull": true,
            "unique": false
          },
          "name": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "subscriber_kind": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "subscriber_external_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "project_id": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "service_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "metric_key": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "period": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "month"
          },
          "rolling_seconds": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "limit_amount": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "behavior": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "observe"
          },
          "priority": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "active": {
            "type": "BOOLEAN",
            "notNull": false,
            "unique": false,
            "default": true
          }
        },
        "indexes": [
          {
            "name": "_smrt_spending_policies_tenant_id_subscriber_kind_idx",
            "columns": [
              "tenant_id",
              "subscriber_kind",
              "subscriber_external_id",
              "project_id",
              "service_key",
              "metric_key",
              "period",
              "name"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "_smrt_spending_policies_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "_smrt_spending_policies_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "6a413cf4"
      },
      "importPath": "@happyvertical/smrt-subscriptions"
    }
  },
  "moduleType": "smrt",
  "smrtDependencies": [
    "@happyvertical/smrt-core",
    "@happyvertical/smrt-tenancy"
  ]
}