{
  "version": "1.0.0",
  "timestamp": 0,
  "packageName": "@happyvertical/smrt-marketing",
  "packageVersion": "0.51.10",
  "objects": {
    "@happyvertical/smrt-marketing:CampaignChannelCollection": {
      "name": "campaignchannelcollection",
      "className": "CampaignChannelCollection",
      "qualifiedName": "@happyvertical/smrt-marketing:CampaignChannelCollection",
      "collection": "campaignchannels",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/collections/CampaignChannelCollection.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "fields": {},
      "methods": {
        "findByCampaign": {
          "name": "findByCampaign",
          "async": true,
          "parameters": [
            {
              "name": "campaignId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignChannel[]>",
          "isStatic": false,
          "isPublic": true
        },
        "findByExecutionRef": {
          "name": "findByExecutionRef",
          "async": true,
          "parameters": [
            {
              "name": "channelKind",
              "type": "string",
              "optional": false
            },
            {
              "name": "channelRef",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignChannel[]>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaign_channels"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "CampaignChannel",
      "exportName": "CampaignChannelCollection",
      "collectionExportName": "CampaignChannelCollectionCollection",
      "schema": {
        "tableName": "campaign_channels",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaign_channels\" (\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  \"campaign_id\" UUID NOT NULL,\n  \"channel_kind\" TEXT NOT NULL DEFAULT '',\n  \"channel_ref\" TEXT NOT NULL DEFAULT '',\n  \"allocated_budget_cents\" INTEGER DEFAULT 0,\n  \"start_at\" TIMESTAMP,\n  \"end_at\" TIMESTAMP,\n  \"status\" TEXT DEFAULT 'planned'\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
          },
          "campaign_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": true,
            "unique": false,
            "foreignKey": {
              "table": "campaigns",
              "column": "id",
              "onDelete": "CASCADE",
              "onUpdate": "CASCADE"
            }
          },
          "channel_kind": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "channel_ref": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "allocated_budget_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "start_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "end_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "planned"
          }
        },
        "indexes": [
          {
            "name": "campaign_channels_campaign_id_channel_kind_idx",
            "columns": [
              "campaign_id",
              "channel_kind",
              "channel_ref"
            ],
            "unique": true
          },
          {
            "name": "campaign_channels_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaign_channels_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "cc045525"
      },
      "importPath": "@happyvertical/smrt-marketing"
    },
    "@happyvertical/smrt-marketing:CampaignCollection": {
      "name": "campaigncollection",
      "className": "CampaignCollection",
      "qualifiedName": "@happyvertical/smrt-marketing:CampaignCollection",
      "collection": "campaigns",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/collections/CampaignCollection.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "fields": {},
      "methods": {
        "get": {
          "name": "get",
          "async": true,
          "parameters": [
            {
              "name": "filter",
              "type": "string | SmrtWhereClause<Campaign>",
              "optional": false,
              "unionBranches": [
                {
                  "type": "string"
                },
                {
                  "type": "SmrtWhereClause<Campaign>"
                }
              ]
            },
            {
              "name": "options",
              "type": "object",
              "optional": true,
              "memberTypes": [
                "CollectionCacheConfig | false"
              ]
            }
          ],
          "returnType": "Promise<Campaign | null>",
          "isStatic": false,
          "isPublic": true
        },
        "list": {
          "name": "list",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "SmrtListOptions<Campaign>",
              "optional": true
            }
          ],
          "returnType": "Promise<Campaign[] | Record<string, unknown>[]>",
          "isStatic": false,
          "isPublic": true
        },
        "findByCampaignKey": {
          "name": "findByCampaignKey",
          "async": true,
          "parameters": [
            {
              "name": "campaignKey",
              "type": "string",
              "optional": false
            },
            {
              "name": "tenantId",
              "type": "string | null",
              "optional": true,
              "unionBranches": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            }
          ],
          "returnType": "Promise<Campaign | null>",
          "isStatic": false,
          "isPublic": true
        },
        "findByStatus": {
          "name": "findByStatus",
          "async": true,
          "parameters": [
            {
              "name": "status",
              "type": "CampaignStatus",
              "optional": false
            }
          ],
          "returnType": "Promise<Campaign[]>",
          "isStatic": false,
          "isPublic": true
        },
        "listByCustomer": {
          "name": "listByCustomer",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string | null",
              "optional": false,
              "unionBranches": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "name": "customerId",
              "type": "string",
              "optional": false
            },
            {
              "name": "options",
              "type": "ListCampaignsByCustomerOptions",
              "optional": true
            }
          ],
          "returnType": "Promise<CampaignCustomerPage>",
          "isStatic": false,
          "isPublic": true
        },
        "listReportingByCustomer": {
          "name": "listReportingByCustomer",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string | null",
              "optional": false,
              "unionBranches": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "name": "customerId",
              "type": "string",
              "optional": false
            },
            {
              "name": "options",
              "type": "ListCampaignReportingByCustomerOptions",
              "optional": true
            }
          ],
          "returnType": "Promise<CampaignReportingPage>",
          "isStatic": false,
          "isPublic": true
        },
        "summarizeByCustomers": {
          "name": "summarizeByCustomers",
          "async": true,
          "parameters": [
            {
              "name": "tenantId",
              "type": "string | null",
              "optional": false,
              "unionBranches": [
                {
                  "type": "string"
                },
                {
                  "type": "null"
                }
              ]
            },
            {
              "name": "customerIds",
              "type": "string[]",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignCustomerSummary[]>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaigns"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "Campaign",
      "exportName": "CampaignCollection",
      "collectionExportName": "CampaignCollectionCollection",
      "schema": {
        "tableName": "campaigns",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaigns\" (\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  \"customer_id\" UUID,\n  \"campaign_key\" TEXT NOT NULL DEFAULT '',\n  \"name\" TEXT NOT NULL DEFAULT '',\n  \"objective\" TEXT DEFAULT '',\n  \"status\" TEXT DEFAULT 'draft',\n  \"start_at\" TIMESTAMP,\n  \"end_at\" TIMESTAMP,\n  \"budget_cents\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\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
          },
          "customer_id": {
            "type": "UUID",
            "referenceKind": "crossPackageRef",
            "notNull": false,
            "unique": false
          },
          "campaign_key": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "name": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "objective": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "draft"
          },
          "start_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "end_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "budget_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "campaigns_tenant_id_campaign_key_idx",
            "columns": [
              "tenant_id",
              "campaign_key"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "campaigns_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaigns_tenant_id_customer_id_start_at_id_idx",
            "columns": [
              "tenant_id",
              "customer_id",
              "start_at",
              "id"
            ]
          },
          {
            "name": "campaigns_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "campaigns_customer_id_idx",
            "columns": [
              "customer_id"
            ]
          }
        ],
        "version": "d0945102"
      },
      "importPath": "@happyvertical/smrt-marketing"
    },
    "@happyvertical/smrt-marketing:CampaignMetricSnapshotCollection": {
      "name": "campaignmetricsnapshotcollection",
      "className": "CampaignMetricSnapshotCollection",
      "qualifiedName": "@happyvertical/smrt-marketing:CampaignMetricSnapshotCollection",
      "collection": "campaignmetricsnapshots",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/collections/CampaignMetricSnapshotCollection.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "fields": {},
      "methods": {
        "findByDedupeKey": {
          "name": "findByDedupeKey",
          "async": true,
          "parameters": [
            {
              "name": "dedupeKey",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignMetricSnapshot | null>",
          "isStatic": false,
          "isPublic": true
        },
        "getOrCreateByDedupeKey": {
          "name": "getOrCreateByDedupeKey",
          "async": true,
          "parameters": [
            {
              "name": "options",
              "type": "CampaignMetricSnapshotOptions",
              "optional": false
            }
          ],
          "returnType": "Promise<object>",
          "isStatic": false,
          "isPublic": true
        },
        "findByCampaign": {
          "name": "findByCampaign",
          "async": true,
          "parameters": [
            {
              "name": "campaignId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignMetricSnapshot[]>",
          "isStatic": false,
          "isPublic": true
        },
        "findByChannel": {
          "name": "findByChannel",
          "async": true,
          "parameters": [
            {
              "name": "campaignChannelId",
              "type": "string",
              "optional": false
            }
          ],
          "returnType": "Promise<CampaignMetricSnapshot[]>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaign_metric_snapshots"
      },
      "extends": "SmrtCollection",
      "extendsTypeArg": "CampaignMetricSnapshot",
      "exportName": "CampaignMetricSnapshotCollection",
      "collectionExportName": "CampaignMetricSnapshotCollectionCollection",
      "schema": {
        "tableName": "campaign_metric_snapshots",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaign_metric_snapshots\" (\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  \"campaign_id\" UUID NOT NULL,\n  \"campaign_channel_id\" UUID,\n  \"period_start\" TIMESTAMP NOT NULL,\n  \"period_end\" TIMESTAMP NOT NULL,\n  \"spend_cents\" INTEGER DEFAULT 0,\n  \"impressions\" INTEGER DEFAULT 0,\n  \"clicks\" INTEGER DEFAULT 0,\n  \"conversions\" INTEGER DEFAULT 0,\n  \"leads\" INTEGER DEFAULT 0,\n  \"revenue_cents\" INTEGER,\n  \"source\" TEXT NOT NULL DEFAULT '',\n  \"dedupe_key\" TEXT NOT NULL 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
          },
          "campaign_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": true,
            "unique": false,
            "foreignKey": {
              "table": "campaigns",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "campaign_channel_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "campaign_channels",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "period_start": {
            "type": "TIMESTAMP",
            "notNull": true,
            "unique": false
          },
          "period_end": {
            "type": "TIMESTAMP",
            "notNull": true,
            "unique": false
          },
          "spend_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "impressions": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "clicks": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "conversions": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "leads": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "revenue_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false
          },
          "source": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "dedupe_key": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          }
        },
        "indexes": [
          {
            "name": "campaign_metric_snapshots_dedupe_key_idx",
            "columns": [
              "dedupe_key"
            ],
            "unique": true
          },
          {
            "name": "campaign_metric_snapshots_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaign_metric_snapshots_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "campaign_metric_snapshots_campaign_id_idx",
            "columns": [
              "campaign_id"
            ]
          },
          {
            "name": "campaign_metric_snapshots_campaign_channel_id_idx",
            "columns": [
              "campaign_channel_id"
            ]
          }
        ],
        "version": "1ccd36b3"
      },
      "importPath": "@happyvertical/smrt-marketing"
    },
    "@happyvertical/smrt-marketing:Campaign": {
      "name": "campaign",
      "className": "Campaign",
      "qualifiedName": "@happyvertical/smrt-marketing:Campaign",
      "collection": "campaigns",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/models/Campaign.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "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
            }
          }
        },
        "customerId": {
          "type": "crossPackageRef",
          "required": false,
          "related": "@happyvertical/smrt-commerce:Customer",
          "_meta": {
            "validate": true,
            "nullable": true
          }
        },
        "campaignKey": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        },
        "name": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        },
        "objective": {
          "type": "text",
          "required": false,
          "default": ""
        },
        "status": {
          "type": "text",
          "required": false,
          "default": "draft"
        },
        "startAt": {
          "type": "datetime",
          "required": false
        },
        "endAt": {
          "type": "datetime",
          "required": false
        },
        "budgetCents": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "currency": {
          "type": "text",
          "required": false,
          "default": "USD"
        },
        "metadata": {
          "type": "text",
          "required": false,
          "default": "{}"
        }
      },
      "methods": {
        "initialize": {
          "name": "initialize",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        },
        "save": {
          "name": "save",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        },
        "transitionTo": {
          "name": "transitionTo",
          "async": false,
          "parameters": [
            {
              "name": "next",
              "type": "CampaignStatus",
              "optional": false
            }
          ],
          "returnType": "this",
          "isStatic": false,
          "isPublic": true
        },
        "getMetadata": {
          "name": "getMetadata",
          "async": false,
          "parameters": [],
          "returnType": "Record<string, unknown>",
          "isStatic": false,
          "isPublic": true
        },
        "setMetadata": {
          "name": "setMetadata",
          "async": false,
          "parameters": [
            {
              "name": "metadata",
              "type": "Record<string, unknown>",
              "optional": false
            }
          ],
          "returnType": "void",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaigns",
        "conflictColumns": [
          "tenant_id",
          "campaign_key"
        ],
        "indexes": [
          {
            "name": "campaigns_tenant_id_customer_id_start_at_id_idx",
            "columns": [
              "tenantId",
              "customerId",
              "startAt",
              "id"
            ]
          }
        ],
        "api": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "tenantScoped": {
          "mode": "optional"
        }
      },
      "extends": "SmrtObject",
      "exportName": "Campaign",
      "collectionExportName": "CampaignCollection",
      "validationRules": [
        {
          "field": "campaignKey",
          "rule": "required",
          "fieldType": "text"
        },
        {
          "field": "name",
          "rule": "required",
          "fieldType": "text"
        }
      ],
      "schema": {
        "tableName": "campaigns",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaigns\" (\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  \"customer_id\" UUID,\n  \"campaign_key\" TEXT NOT NULL DEFAULT '',\n  \"name\" TEXT NOT NULL DEFAULT '',\n  \"objective\" TEXT DEFAULT '',\n  \"status\" TEXT DEFAULT 'draft',\n  \"start_at\" TIMESTAMP,\n  \"end_at\" TIMESTAMP,\n  \"budget_cents\" INTEGER DEFAULT 0,\n  \"currency\" TEXT DEFAULT 'USD',\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
          },
          "customer_id": {
            "type": "UUID",
            "referenceKind": "crossPackageRef",
            "notNull": false,
            "unique": false
          },
          "campaign_key": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "name": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "objective": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": ""
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "draft"
          },
          "start_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "end_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "budget_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "currency": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "USD"
          },
          "metadata": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "{}"
          }
        },
        "indexes": [
          {
            "name": "campaigns_tenant_id_campaign_key_idx",
            "columns": [
              "tenant_id",
              "campaign_key"
            ],
            "unique": true,
            "nullsNotDistinct": true
          },
          {
            "name": "campaigns_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaigns_tenant_id_customer_id_start_at_id_idx",
            "columns": [
              "tenant_id",
              "customer_id",
              "start_at",
              "id"
            ]
          },
          {
            "name": "campaigns_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "campaigns_customer_id_idx",
            "columns": [
              "customer_id"
            ]
          }
        ],
        "version": "d0945102"
      },
      "importPath": "@happyvertical/smrt-marketing"
    },
    "@happyvertical/smrt-marketing:CampaignChannel": {
      "name": "campaignchannel",
      "className": "CampaignChannel",
      "qualifiedName": "@happyvertical/smrt-marketing:CampaignChannel",
      "collection": "campaignchannels",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/models/CampaignChannel.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "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
            }
          }
        },
        "campaignId": {
          "type": "foreignKey",
          "required": true,
          "related": "Campaign",
          "_meta": {
            "required": true
          }
        },
        "channelKind": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        },
        "channelRef": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        },
        "allocatedBudgetCents": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "startAt": {
          "type": "datetime",
          "required": false
        },
        "endAt": {
          "type": "datetime",
          "required": false
        },
        "status": {
          "type": "text",
          "required": false,
          "default": "planned"
        }
      },
      "methods": {
        "initialize": {
          "name": "initialize",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        },
        "save": {
          "name": "save",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaign_channels",
        "conflictColumns": [
          "campaign_id",
          "channel_kind",
          "channel_ref"
        ],
        "api": {
          "include": [
            "list",
            "get",
            "create",
            "update",
            "delete"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get",
            "create",
            "update"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get",
            "create",
            "update",
            "delete"
          ]
        },
        "tenantScoped": {
          "mode": "optional"
        }
      },
      "extends": "SmrtObject",
      "exportName": "CampaignChannel",
      "collectionExportName": "CampaignChannelCollection",
      "validationRules": [
        {
          "field": "campaignId",
          "rule": "required",
          "fieldType": "foreignKey"
        },
        {
          "field": "channelKind",
          "rule": "required",
          "fieldType": "text"
        },
        {
          "field": "channelRef",
          "rule": "required",
          "fieldType": "text"
        }
      ],
      "schema": {
        "tableName": "campaign_channels",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaign_channels\" (\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  \"campaign_id\" UUID NOT NULL,\n  \"channel_kind\" TEXT NOT NULL DEFAULT '',\n  \"channel_ref\" TEXT NOT NULL DEFAULT '',\n  \"allocated_budget_cents\" INTEGER DEFAULT 0,\n  \"start_at\" TIMESTAMP,\n  \"end_at\" TIMESTAMP,\n  \"status\" TEXT DEFAULT 'planned'\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
          },
          "campaign_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": true,
            "unique": false,
            "foreignKey": {
              "table": "campaigns",
              "column": "id",
              "onDelete": "CASCADE",
              "onUpdate": "CASCADE"
            }
          },
          "channel_kind": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "channel_ref": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "allocated_budget_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "start_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "end_at": {
            "type": "TIMESTAMP",
            "notNull": false,
            "unique": false
          },
          "status": {
            "type": "TEXT",
            "notNull": false,
            "unique": false,
            "default": "planned"
          }
        },
        "indexes": [
          {
            "name": "campaign_channels_campaign_id_channel_kind_idx",
            "columns": [
              "campaign_id",
              "channel_kind",
              "channel_ref"
            ],
            "unique": true
          },
          {
            "name": "campaign_channels_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaign_channels_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          }
        ],
        "version": "cc045525"
      },
      "importPath": "@happyvertical/smrt-marketing"
    },
    "@happyvertical/smrt-marketing:CampaignMetricSnapshot": {
      "name": "campaignmetricsnapshot",
      "className": "CampaignMetricSnapshot",
      "qualifiedName": "@happyvertical/smrt-marketing:CampaignMetricSnapshot",
      "collection": "campaignmetricsnapshots",
      "filePath": "/home/runner/work/smrt/smrt/packages/marketing/src/models/CampaignMetricSnapshot.ts",
      "packageName": "@happyvertical/smrt-marketing",
      "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
            }
          }
        },
        "campaignId": {
          "type": "foreignKey",
          "required": true,
          "related": "Campaign",
          "_meta": {
            "required": true
          }
        },
        "campaignChannelId": {
          "type": "foreignKey",
          "required": false,
          "related": "CampaignChannel",
          "_meta": {
            "nullable": true
          }
        },
        "periodStart": {
          "type": "datetime",
          "required": true,
          "_meta": {
            "required": true
          }
        },
        "periodEnd": {
          "type": "datetime",
          "required": true,
          "_meta": {
            "required": true
          }
        },
        "spendCents": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "impressions": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "clicks": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "conversions": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "leads": {
          "type": "integer",
          "required": false,
          "default": 0
        },
        "revenueCents": {
          "type": "integer",
          "required": false,
          "_meta": {
            "nullable": true
          }
        },
        "source": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        },
        "dedupeKey": {
          "type": "text",
          "required": true,
          "default": "",
          "_meta": {
            "required": true
          }
        }
      },
      "methods": {
        "initialize": {
          "name": "initialize",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        },
        "save": {
          "name": "save",
          "async": true,
          "parameters": [],
          "returnType": "Promise<this>",
          "isStatic": false,
          "isPublic": true
        },
        "delete": {
          "name": "delete",
          "async": true,
          "parameters": [],
          "returnType": "Promise<void>",
          "isStatic": false,
          "isPublic": true
        }
      },
      "decoratorConfig": {
        "tableName": "campaign_metric_snapshots",
        "conflictColumns": [
          "dedupe_key"
        ],
        "api": {
          "include": [
            "list",
            "get",
            "create"
          ]
        },
        "mcp": {
          "include": [
            "list",
            "get",
            "create"
          ]
        },
        "cli": {
          "include": [
            "list",
            "get",
            "create"
          ]
        },
        "tenantScoped": {
          "mode": "optional"
        }
      },
      "extends": "SmrtObject",
      "exportName": "CampaignMetricSnapshot",
      "collectionExportName": "CampaignMetricSnapshotCollection",
      "validationRules": [
        {
          "field": "campaignId",
          "rule": "required",
          "fieldType": "foreignKey"
        },
        {
          "field": "periodStart",
          "rule": "required",
          "fieldType": "datetime"
        },
        {
          "field": "periodEnd",
          "rule": "required",
          "fieldType": "datetime"
        },
        {
          "field": "source",
          "rule": "required",
          "fieldType": "text"
        },
        {
          "field": "dedupeKey",
          "rule": "required",
          "fieldType": "text"
        }
      ],
      "schema": {
        "tableName": "campaign_metric_snapshots",
        "ddl": "CREATE TABLE IF NOT EXISTS \"campaign_metric_snapshots\" (\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  \"campaign_id\" UUID NOT NULL,\n  \"campaign_channel_id\" UUID,\n  \"period_start\" TIMESTAMP NOT NULL,\n  \"period_end\" TIMESTAMP NOT NULL,\n  \"spend_cents\" INTEGER DEFAULT 0,\n  \"impressions\" INTEGER DEFAULT 0,\n  \"clicks\" INTEGER DEFAULT 0,\n  \"conversions\" INTEGER DEFAULT 0,\n  \"leads\" INTEGER DEFAULT 0,\n  \"revenue_cents\" INTEGER,\n  \"source\" TEXT NOT NULL DEFAULT '',\n  \"dedupe_key\" TEXT NOT NULL 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
          },
          "campaign_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": true,
            "unique": false,
            "foreignKey": {
              "table": "campaigns",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "campaign_channel_id": {
            "type": "UUID",
            "referenceKind": "foreignKey",
            "notNull": false,
            "unique": false,
            "foreignKey": {
              "table": "campaign_channels",
              "column": "id",
              "onDelete": "NO ACTION",
              "onUpdate": "CASCADE"
            }
          },
          "period_start": {
            "type": "TIMESTAMP",
            "notNull": true,
            "unique": false
          },
          "period_end": {
            "type": "TIMESTAMP",
            "notNull": true,
            "unique": false
          },
          "spend_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "impressions": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "clicks": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "conversions": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "leads": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false,
            "default": 0
          },
          "revenue_cents": {
            "type": "INTEGER",
            "notNull": false,
            "unique": false
          },
          "source": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          },
          "dedupe_key": {
            "type": "TEXT",
            "notNull": true,
            "unique": false,
            "default": ""
          }
        },
        "indexes": [
          {
            "name": "campaign_metric_snapshots_dedupe_key_idx",
            "columns": [
              "dedupe_key"
            ],
            "unique": true
          },
          {
            "name": "campaign_metric_snapshots_slug_context_idx",
            "columns": [
              "slug",
              "context"
            ]
          },
          {
            "name": "campaign_metric_snapshots_tenant_id_created_at_idx",
            "columns": [
              "tenant_id",
              "created_at"
            ]
          },
          {
            "name": "campaign_metric_snapshots_campaign_id_idx",
            "columns": [
              "campaign_id"
            ]
          },
          {
            "name": "campaign_metric_snapshots_campaign_channel_id_idx",
            "columns": [
              "campaign_channel_id"
            ]
          }
        ],
        "version": "1ccd36b3"
      },
      "importPath": "@happyvertical/smrt-marketing"
    }
  },
  "moduleType": "smrt",
  "smrtDependencies": [
    "@happyvertical/smrt-commerce",
    "@happyvertical/smrt-core",
    "@happyvertical/smrt-tenancy"
  ]
}