{
  "id": "5fce5a38-debe-4b4d-983d-726e5b3df42c",
  "prevId": "00000000-0000-0000-0000-000000000000",
  "version": "7",
  "dialect": "postgresql",
  "tables": {
    "public.agent_versions": {
      "name": "agent_versions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "version_number": {
          "name": "version_number",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "snapshot": {
          "name": "snapshot",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "changes_summary": {
          "name": "changes_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "changed_fields": {
          "name": "changed_fields",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "edited_by": {
          "name": "edited_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "note": {
          "name": "note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "agent_versions_agent_id_agents_id_fk": {
          "name": "agent_versions_agent_id_agents_id_fk",
          "tableFrom": "agent_versions",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agent_versions_edited_by_users_id_fk": {
          "name": "agent_versions_edited_by_users_id_fk",
          "tableFrom": "agent_versions",
          "tableTo": "users",
          "columnsFrom": [
            "edited_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.agents": {
      "name": "agents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_credential_id": {
          "name": "eleven_labs_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "telephony_provider": {
          "name": "telephony_provider",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'twilio'"
        },
        "sip_trunk_id": {
          "name": "sip_trunk_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "sip_phone_number_id": {
          "name": "sip_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "openai_voice": {
          "name": "openai_voice",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "voice_tone": {
          "name": "voice_tone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "personality": {
          "name": "personality",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "system_prompt": {
          "name": "system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'en'"
        },
        "first_message": {
          "name": "first_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'Hello! How can I help you today?'"
        },
        "llm_model": {
          "name": "llm_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'gpt-4o-mini'"
        },
        "temperature": {
          "name": "temperature",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 0.5
        },
        "eleven_labs_agent_id": {
          "name": "eleven_labs_agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transfer_phone_number": {
          "name": "transfer_phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transfer_enabled": {
          "name": "transfer_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "detect_language_enabled": {
          "name": "detect_language_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "end_conversation_enabled": {
          "name": "end_conversation_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "appointment_booking_enabled": {
          "name": "appointment_booking_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "knowledge_base_ids": {
          "name": "knowledge_base_ids",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "eleven_labs_voice_id": {
          "name": "eleven_labs_voice_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "voice_stability": {
          "name": "voice_stability",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 0.55
        },
        "voice_similarity_boost": {
          "name": "voice_similarity_boost",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 0.85
        },
        "voice_speed": {
          "name": "voice_speed",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 1
        },
        "flow_id": {
          "name": "flow_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "max_duration_seconds": {
          "name": "max_duration_seconds",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 600
        },
        "agent_link": {
          "name": "agent_link",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "agents_user_id_users_id_fk": {
          "name": "agents_user_id_users_id_fk",
          "tableFrom": "agents",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "agents_eleven_labs_credential_id_eleven_labs_credentials_id_fk": {
          "name": "agents_eleven_labs_credential_id_eleven_labs_credentials_id_fk",
          "tableFrom": "agents",
          "tableTo": "eleven_labs_credentials",
          "columnsFrom": [
            "eleven_labs_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.analytics_scripts": {
      "name": "analytics_scripts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'custom'"
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "head_code": {
          "name": "head_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "body_code": {
          "name": "body_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "placement": {
          "name": "placement",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "ARRAY['head']::text[]"
        },
        "load_priority": {
          "name": "load_priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "async": {
          "name": "async",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "defer": {
          "name": "defer",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "enabled": {
          "name": "enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "hide_on_internal_pages": {
          "name": "hide_on_internal_pages",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "updated_by": {
          "name": "updated_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "analytics_scripts_updated_by_users_id_fk": {
          "name": "analytics_scripts_updated_by_users_id_fk",
          "tableFrom": "analytics_scripts",
          "tableTo": "users",
          "columnsFrom": [
            "updated_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.api_audit_logs": {
      "name": "api_audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "api_key_id": {
          "name": "api_key_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "method": {
          "name": "method",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "endpoint": {
          "name": "endpoint",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "path": {
          "name": "path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "request_body": {
          "name": "request_body",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "query_params": {
          "name": "query_params",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status_code": {
          "name": "status_code",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "response_time": {
          "name": "response_time",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "request_id": {
          "name": "request_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "api_audit_logs_user_id_users_id_fk": {
          "name": "api_audit_logs_user_id_users_id_fk",
          "tableFrom": "api_audit_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "api_audit_logs_api_key_id_api_keys_id_fk": {
          "name": "api_audit_logs_api_key_id_api_keys_id_fk",
          "tableFrom": "api_audit_logs",
          "tableTo": "api_keys",
          "columnsFrom": [
            "api_key_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.api_keys": {
      "name": "api_keys",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "key_prefix": {
          "name": "key_prefix",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "hashed_secret": {
          "name": "hashed_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "scopes": {
          "name": "scopes",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "ARRAY['calls:read', 'calls:write', 'campaigns:read', 'contacts:read']::text[]"
        },
        "rate_limit": {
          "name": "rate_limit",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "rate_limit_window": {
          "name": "rate_limit_window",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 60
        },
        "ip_whitelist": {
          "name": "ip_whitelist",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY[]::text[]"
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "last_used_ip": {
          "name": "last_used_ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "total_requests": {
          "name": "total_requests",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "api_keys_user_id_users_id_fk": {
          "name": "api_keys_user_id_users_id_fk",
          "tableFrom": "api_keys",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.api_rate_limits": {
      "name": "api_rate_limits",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "api_key_id": {
          "name": "api_key_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "window_start": {
          "name": "window_start",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "request_count": {
          "name": "request_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "api_rate_limits_api_key_id_api_keys_id_fk": {
          "name": "api_rate_limits_api_key_id_api_keys_id_fk",
          "tableFrom": "api_rate_limits",
          "tableTo": "api_keys",
          "columnsFrom": [
            "api_key_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.appointment_settings": {
      "name": "appointment_settings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "allow_overlapping": {
          "name": "allow_overlapping",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "buffer_minutes": {
          "name": "buffer_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "working_hours": {
          "name": "working_hours",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "appointment_settings_user_id_unique": {
          "name": "appointment_settings_user_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "user_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.appointments": {
      "name": "appointments",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "flow_id": {
          "name": "flow_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_name": {
          "name": "contact_name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "contact_phone": {
          "name": "contact_phone",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "contact_email": {
          "name": "contact_email",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false
        },
        "appointment_date": {
          "name": "appointment_date",
          "type": "date",
          "primaryKey": false,
          "notNull": true
        },
        "appointment_time": {
          "name": "appointment_time",
          "type": "time",
          "primaryKey": false,
          "notNull": true
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "service_name": {
          "name": "service_name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true,
          "default": "'scheduled'"
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "appointments_flow_id_flows_id_fk": {
          "name": "appointments_flow_id_flows_id_fk",
          "tableFrom": "appointments",
          "tableTo": "flows",
          "columnsFrom": [
            "flow_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.audit_logs": {
      "name": "audit_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "action": {
          "name": "action",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "target_user_id": {
          "name": "target_user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "resource_type": {
          "name": "resource_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "resource_id": {
          "name": "resource_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "severity": {
          "name": "severity",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'info'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "audit_logs_user_id_users_id_fk": {
          "name": "audit_logs_user_id_users_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "audit_logs_target_user_id_users_id_fk": {
          "name": "audit_logs_target_user_id_users_id_fk",
          "tableFrom": "audit_logs",
          "tableTo": "users",
          "columnsFrom": [
            "target_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.banned_words": {
      "name": "banned_words",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "word": {
          "name": "word",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'general'"
        },
        "severity": {
          "name": "severity",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'medium'"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "auto_block": {
          "name": "auto_block",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_by": {
          "name": "created_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "banned_words_created_by_users_id_fk": {
          "name": "banned_words_created_by_users_id_fk",
          "tableFrom": "banned_words",
          "tableTo": "users",
          "columnsFrom": [
            "created_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.calls": {
      "name": "calls",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "incoming_connection_id": {
          "name": "incoming_connection_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "widget_id": {
          "name": "widget_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "incoming_agent_id": {
          "name": "incoming_agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "phone_number": {
          "name": "phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "from_number": {
          "name": "from_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "to_number": {
          "name": "to_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "twilio_sid": {
          "name": "twilio_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "elevenlabs_conversation_id": {
          "name": "elevenlabs_conversation_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "call_direction": {
          "name": "call_direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'outgoing'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transcript": {
          "name": "transcript",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_summary": {
          "name": "ai_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "classification": {
          "name": "classification",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "was_transferred": {
          "name": "was_transferred",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "transferred_to": {
          "name": "transferred_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transferred_at": {
          "name": "transferred_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "calls_user_id_users_id_fk": {
          "name": "calls_user_id_users_id_fk",
          "tableFrom": "calls",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "calls_campaign_id_campaigns_id_fk": {
          "name": "calls_campaign_id_campaigns_id_fk",
          "tableFrom": "calls",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "calls_contact_id_contacts_id_fk": {
          "name": "calls_contact_id_contacts_id_fk",
          "tableFrom": "calls",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "calls_incoming_connection_id_incoming_connections_id_fk": {
          "name": "calls_incoming_connection_id_incoming_connections_id_fk",
          "tableFrom": "calls",
          "tableTo": "incoming_connections",
          "columnsFrom": [
            "incoming_connection_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "calls_incoming_agent_id_incoming_agents_id_fk": {
          "name": "calls_incoming_agent_id_incoming_agents_id_fk",
          "tableFrom": "calls",
          "tableTo": "incoming_agents",
          "columnsFrom": [
            "incoming_agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campaign_jobs": {
      "name": "campaign_jobs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "contact_id": {
          "name": "contact_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'plivo'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "worker_id": {
          "name": "worker_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "processed_at": {
          "name": "processed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.campaigns": {
      "name": "campaigns",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "voice_id": {
          "name": "voice_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone_number_id": {
          "name": "phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "sip_phone_number_id": {
          "name": "sip_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "plivo_phone_number_id": {
          "name": "plivo_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "flow_id": {
          "name": "flow_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "goal": {
          "name": "goal",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "script": {
          "name": "script",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "total_contacts": {
          "name": "total_contacts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "completed_calls": {
          "name": "completed_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "successful_calls": {
          "name": "successful_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "failed_calls": {
          "name": "failed_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "scheduled_for": {
          "name": "scheduled_for",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "schedule_enabled": {
          "name": "schedule_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "schedule_time_start": {
          "name": "schedule_time_start",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "schedule_time_end": {
          "name": "schedule_time_end",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "schedule_days": {
          "name": "schedule_days",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "schedule_timezone": {
          "name": "schedule_timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'America/New_York'"
        },
        "batch_job_id": {
          "name": "batch_job_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "batch_job_status": {
          "name": "batch_job_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "retry_enabled": {
          "name": "retry_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error_code": {
          "name": "error_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "campaigns_user_id_users_id_fk": {
          "name": "campaigns_user_id_users_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "campaigns_agent_id_agents_id_fk": {
          "name": "campaigns_agent_id_agents_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "campaigns_phone_number_id_phone_numbers_id_fk": {
          "name": "campaigns_phone_number_id_phone_numbers_id_fk",
          "tableFrom": "campaigns",
          "tableTo": "phone_numbers",
          "columnsFrom": [
            "phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.contacts": {
      "name": "contacts",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "first_name": {
          "name": "first_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "last_name": {
          "name": "last_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "custom_fields": {
          "name": "custom_fields",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "contacts_campaign_id_campaigns_id_fk": {
          "name": "contacts_campaign_id_campaigns_id_fk",
          "tableFrom": "contacts",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.content_violations": {
      "name": "content_violations",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "banned_word_id": {
          "name": "banned_word_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "detected_word": {
          "name": "detected_word",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "context": {
          "name": "context",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "severity": {
          "name": "severity",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'medium'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "reviewed_by": {
          "name": "reviewed_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "reviewed_at": {
          "name": "reviewed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "action_taken": {
          "name": "action_taken",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "notes": {
          "name": "notes",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "content_violations_call_id_calls_id_fk": {
          "name": "content_violations_call_id_calls_id_fk",
          "tableFrom": "content_violations",
          "tableTo": "calls",
          "columnsFrom": [
            "call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "content_violations_user_id_users_id_fk": {
          "name": "content_violations_user_id_users_id_fk",
          "tableFrom": "content_violations",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "content_violations_banned_word_id_banned_words_id_fk": {
          "name": "content_violations_banned_word_id_banned_words_id_fk",
          "tableFrom": "content_violations",
          "tableTo": "banned_words",
          "columnsFrom": [
            "banned_word_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "content_violations_reviewed_by_users_id_fk": {
          "name": "content_violations_reviewed_by_users_id_fk",
          "tableFrom": "content_violations",
          "tableTo": "users",
          "columnsFrom": [
            "reviewed_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.credit_packages": {
      "name": "credit_packages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credits": {
          "name": "credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "price": {
          "name": "price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "razorpay_price": {
          "name": "razorpay_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_product_id": {
          "name": "stripe_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_price_id": {
          "name": "stripe_price_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_item_id": {
          "name": "razorpay_item_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_price": {
          "name": "paypal_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_price": {
          "name": "paystack_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_price": {
          "name": "mercadopago_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.credit_transactions": {
      "name": "credit_transactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "reference": {
          "name": "reference",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_payment_id": {
          "name": "stripe_payment_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "widget_id": {
          "name": "widget_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "credit_transactions_user_id_users_id_fk": {
          "name": "credit_transactions_user_id_users_id_fk",
          "tableFrom": "credit_transactions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "credit_transactions_stripe_payment_id_unique": {
          "name": "credit_transactions_stripe_payment_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "stripe_payment_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.crm_category_preferences": {
      "name": "crm_category_preferences",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "column_order": {
          "name": "column_order",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "ARRAY['warm', 'hot', 'appointment_booked', 'form_submitted', 'call_transfer', 'need_follow_up']::text[]"
        },
        "color_overrides": {
          "name": "color_overrides",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "column_sort_preferences": {
          "name": "column_sort_preferences",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "hide_leads_without_phone": {
          "name": "hide_leads_without_phone",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "category_pipeline_mappings": {
          "name": "category_pipeline_mappings",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "hot_score_threshold": {
          "name": "hot_score_threshold",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 80
        },
        "warm_score_threshold": {
          "name": "warm_score_threshold",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 50
        },
        "hidden_categories": {
          "name": "hidden_categories",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY[]::text[]"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "crm_category_preferences_user_id_users_id_fk": {
          "name": "crm_category_preferences_user_id_users_id_fk",
          "tableFrom": "crm_category_preferences",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.demo_sessions": {
      "name": "demo_sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "session_token": {
          "name": "session_token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "visitor_ip": {
          "name": "visitor_ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "visitor_fingerprint": {
          "name": "visitor_fingerprint",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "voice": {
          "name": "voice",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'alloy'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "max_duration": {
          "name": "max_duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 60
        },
        "transcript": {
          "name": "transcript",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_session_id": {
          "name": "openai_session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "demo_sessions_openai_credential_id_openai_credentials_id_fk": {
          "name": "demo_sessions_openai_credential_id_openai_credentials_id_fk",
          "tableFrom": "demo_sessions",
          "tableTo": "openai_credentials",
          "columnsFrom": [
            "openai_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "demo_sessions_session_token_unique": {
          "name": "demo_sessions_session_token_unique",
          "nullsNotDistinct": false,
          "columns": [
            "session_token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.eleven_labs_credentials": {
      "name": "eleven_labs_credentials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_key": {
          "name": "api_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "webhook_secret": {
          "name": "webhook_secret",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "max_concurrency": {
          "name": "max_concurrency",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 30
        },
        "current_load": {
          "name": "current_load",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_assigned_agents": {
          "name": "total_assigned_agents",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_assigned_users": {
          "name": "total_assigned_users",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_agents_threshold": {
          "name": "max_agents_threshold",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "last_health_check": {
          "name": "last_health_check",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "health_status": {
          "name": "health_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'healthy'"
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.email_notification_settings": {
      "name": "email_notification_settings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "event_type": {
          "name": "event_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "template_id": {
          "name": "template_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "threshold_value": {
          "name": "threshold_value",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'general'"
        },
        "updated_by": {
          "name": "updated_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "email_notification_settings_template_id_email_templates_id_fk": {
          "name": "email_notification_settings_template_id_email_templates_id_fk",
          "tableFrom": "email_notification_settings",
          "tableTo": "email_templates",
          "columnsFrom": [
            "template_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "email_notification_settings_updated_by_users_id_fk": {
          "name": "email_notification_settings_updated_by_users_id_fk",
          "tableFrom": "email_notification_settings",
          "tableTo": "users",
          "columnsFrom": [
            "updated_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "email_notification_settings_event_type_unique": {
          "name": "email_notification_settings_event_type_unique",
          "nullsNotDistinct": false,
          "columns": [
            "event_type"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.email_templates": {
      "name": "email_templates",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "template_type": {
          "name": "template_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "subject": {
          "name": "subject",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "html_body": {
          "name": "html_body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "text_body": {
          "name": "text_body",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "variables": {
          "name": "variables",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "email_templates_template_type_unique": {
          "name": "email_templates_template_type_unique",
          "nullsNotDistinct": false,
          "columns": [
            "template_type"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.flow_executions": {
      "name": "flow_executions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "flow_id": {
          "name": "flow_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "current_node_id": {
          "name": "current_node_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "variables": {
          "name": "variables",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{}'::jsonb"
        },
        "path_taken": {
          "name": "path_taken",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "flow_executions_flow_id_flows_id_fk": {
          "name": "flow_executions_flow_id_flows_id_fk",
          "tableFrom": "flow_executions",
          "tableTo": "flows",
          "columnsFrom": [
            "flow_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.flows": {
      "name": "flows",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "nodes": {
          "name": "nodes",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "edges": {
          "name": "edges",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "voice_settings": {
          "name": "voice_settings",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "execution_config": {
          "name": "execution_config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "is_template": {
          "name": "is_template",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "compiled_system_prompt": {
          "name": "compiled_system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "compiled_first_message": {
          "name": "compiled_first_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "compiled_states": {
          "name": "compiled_states",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "compiled_tools": {
          "name": "compiled_tools",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.fonoster_credentials": {
      "name": "fonoster_credentials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "access_key_id": {
          "name": "access_key_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_key_encrypted": {
          "name": "api_key_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_secret_encrypted": {
          "name": "api_secret_encrypted",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "endpoint": {
          "name": "endpoint",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_primary": {
          "name": "is_primary",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "health_status": {
          "name": "health_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unknown'"
        },
        "last_health_check": {
          "name": "last_health_check",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.form_fields": {
      "name": "form_fields",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "form_id": {
          "name": "form_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "question": {
          "name": "question",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "field_type": {
          "name": "field_type",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": true
        },
        "options": {
          "name": "options",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "is_required": {
          "name": "is_required",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "order": {
          "name": "order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "form_fields_form_id_forms_id_fk": {
          "name": "form_fields_form_id_forms_id_fk",
          "tableFrom": "form_fields",
          "tableTo": "forms",
          "columnsFrom": [
            "form_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.form_submissions": {
      "name": "form_submissions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "form_id": {
          "name": "form_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "flow_execution_id": {
          "name": "flow_execution_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_name": {
          "name": "contact_name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": false
        },
        "contact_phone": {
          "name": "contact_phone",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": false
        },
        "responses": {
          "name": "responses",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "submitted_at": {
          "name": "submitted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "form_submissions_form_id_forms_id_fk": {
          "name": "form_submissions_form_id_forms_id_fk",
          "tableFrom": "form_submissions",
          "tableTo": "forms",
          "columnsFrom": [
            "form_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "form_submissions_flow_execution_id_flow_executions_id_fk": {
          "name": "form_submissions_flow_execution_id_flow_executions_id_fk",
          "tableFrom": "form_submissions",
          "tableTo": "flow_executions",
          "columnsFrom": [
            "flow_execution_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.forms": {
      "name": "forms",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.global_settings": {
      "name": "global_settings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "key": {
          "name": "key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "value": {
          "name": "value",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "updated_by": {
          "name": "updated_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "global_settings_updated_by_users_id_fk": {
          "name": "global_settings_updated_by_users_id_fk",
          "tableFrom": "global_settings",
          "tableTo": "users",
          "columnsFrom": [
            "updated_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "global_settings_key_unique": {
          "name": "global_settings_key_unique",
          "nullsNotDistinct": false,
          "columns": [
            "key"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.incoming_agents": {
      "name": "incoming_agents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_credential_id": {
          "name": "eleven_labs_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_agent_id": {
          "name": "eleven_labs_agent_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_voice_id": {
          "name": "eleven_labs_voice_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "language": {
          "name": "language",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'en'"
        },
        "system_prompt": {
          "name": "system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "personality": {
          "name": "personality",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'helpful'"
        },
        "voice_tone": {
          "name": "voice_tone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'professional'"
        },
        "first_message": {
          "name": "first_message",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Hello! How can I help you today?'"
        },
        "llm_model": {
          "name": "llm_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'gpt-4o-mini'"
        },
        "temperature": {
          "name": "temperature",
          "type": "double precision",
          "primaryKey": false,
          "notNull": false,
          "default": 0.5
        },
        "transfer_phone_number": {
          "name": "transfer_phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transfer_enabled": {
          "name": "transfer_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "business_hours_enabled": {
          "name": "business_hours_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "business_hours_start": {
          "name": "business_hours_start",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "business_hours_end": {
          "name": "business_hours_end",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "business_days": {
          "name": "business_days",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "business_hours_timezone": {
          "name": "business_hours_timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'America/New_York'"
        },
        "after_hours_message": {
          "name": "after_hours_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'Thank you for calling. We''re currently closed. Please call back during business hours.'"
        },
        "knowledge_base_ids": {
          "name": "knowledge_base_ids",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "incoming_agents_user_id_users_id_fk": {
          "name": "incoming_agents_user_id_users_id_fk",
          "tableFrom": "incoming_agents",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "incoming_agents_eleven_labs_credential_id_eleven_labs_credentials_id_fk": {
          "name": "incoming_agents_eleven_labs_credential_id_eleven_labs_credentials_id_fk",
          "tableFrom": "incoming_agents",
          "tableTo": "eleven_labs_credentials",
          "columnsFrom": [
            "eleven_labs_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.incoming_connections": {
      "name": "incoming_connections",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "phone_number_id": {
          "name": "phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "incoming_connections_user_id_users_id_fk": {
          "name": "incoming_connections_user_id_users_id_fk",
          "tableFrom": "incoming_connections",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "incoming_connections_agent_id_agents_id_fk": {
          "name": "incoming_connections_agent_id_agents_id_fk",
          "tableFrom": "incoming_connections",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "incoming_connections_phone_number_id_phone_numbers_id_fk": {
          "name": "incoming_connections_phone_number_id_phone_numbers_id_fk",
          "tableFrom": "incoming_connections",
          "tableTo": "phone_numbers",
          "columnsFrom": [
            "phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "incoming_connections_phone_number_id_unique": {
          "name": "incoming_connections_phone_number_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "phone_number_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.invoices": {
      "name": "invoices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "transaction_id": {
          "name": "transaction_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "invoice_number": {
          "name": "invoice_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_name": {
          "name": "customer_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_email": {
          "name": "customer_email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "customer_address": {
          "name": "customer_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "line_items": {
          "name": "line_items",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "subtotal": {
          "name": "subtotal",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "tax": {
          "name": "tax",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false,
          "default": "'0.00'"
        },
        "total": {
          "name": "total",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'USD'"
        },
        "gateway": {
          "name": "gateway",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "payment_method": {
          "name": "payment_method",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pdf_url": {
          "name": "pdf_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pdf_generated_at": {
          "name": "pdf_generated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'draft'"
        },
        "email_sent_at": {
          "name": "email_sent_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "email_sent_to": {
          "name": "email_sent_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "issued_at": {
          "name": "issued_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "due_at": {
          "name": "due_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "paid_at": {
          "name": "paid_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "invoices_transaction_id_payment_transactions_id_fk": {
          "name": "invoices_transaction_id_payment_transactions_id_fk",
          "tableFrom": "invoices",
          "tableTo": "payment_transactions",
          "columnsFrom": [
            "transaction_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "invoices_user_id_users_id_fk": {
          "name": "invoices_user_id_users_id_fk",
          "tableFrom": "invoices",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "invoices_invoice_number_unique": {
          "name": "invoices_invoice_number_unique",
          "nullsNotDistinct": false,
          "columns": [
            "invoice_number"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.knowledge_base": {
      "name": "knowledge_base",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "file_url": {
          "name": "file_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "eleven_labs_doc_id": {
          "name": "eleven_labs_doc_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "storage_size": {
          "name": "storage_size",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "knowledge_base_user_id_users_id_fk": {
          "name": "knowledge_base_user_id_users_id_fk",
          "tableFrom": "knowledge_base",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.knowledge_chunks": {
      "name": "knowledge_chunks",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "knowledge_base_id": {
          "name": "knowledge_base_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "chunk_index": {
          "name": "chunk_index",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "chunk_text": {
          "name": "chunk_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "embedding": {
          "name": "embedding",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "token_count": {
          "name": "token_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "knowledge_chunks_knowledge_base_id_knowledge_base_id_fk": {
          "name": "knowledge_chunks_knowledge_base_id_knowledge_base_id_fk",
          "tableFrom": "knowledge_chunks",
          "tableTo": "knowledge_base",
          "columnsFrom": [
            "knowledge_base_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "knowledge_chunks_user_id_users_id_fk": {
          "name": "knowledge_chunks_user_id_users_id_fk",
          "tableFrom": "knowledge_chunks",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.knowledge_processing_queue": {
      "name": "knowledge_processing_queue",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "knowledge_base_id": {
          "name": "knowledge_base_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "total_chunks": {
          "name": "total_chunks",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "processed_chunks": {
          "name": "processed_chunks",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "knowledge_processing_queue_knowledge_base_id_knowledge_base_id_fk": {
          "name": "knowledge_processing_queue_knowledge_base_id_knowledge_base_id_fk",
          "tableFrom": "knowledge_processing_queue",
          "tableTo": "knowledge_base",
          "columnsFrom": [
            "knowledge_base_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "knowledge_processing_queue_user_id_users_id_fk": {
          "name": "knowledge_processing_queue_user_id_users_id_fk",
          "tableFrom": "knowledge_processing_queue",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.lead_activities": {
      "name": "lead_activities",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "lead_id": {
          "name": "lead_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "activity_type": {
          "name": "activity_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "lead_activities_lead_id_leads_id_fk": {
          "name": "lead_activities_lead_id_leads_id_fk",
          "tableFrom": "lead_activities",
          "tableTo": "leads",
          "columnsFrom": [
            "lead_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "lead_activities_user_id_users_id_fk": {
          "name": "lead_activities_user_id_users_id_fk",
          "tableFrom": "lead_activities",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.lead_notes": {
      "name": "lead_notes",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "lead_id": {
          "name": "lead_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "content": {
          "name": "content",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "lead_notes_lead_id_leads_id_fk": {
          "name": "lead_notes_lead_id_leads_id_fk",
          "tableFrom": "lead_notes",
          "tableTo": "leads",
          "columnsFrom": [
            "lead_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "lead_notes_user_id_users_id_fk": {
          "name": "lead_notes_user_id_users_id_fk",
          "tableFrom": "lead_notes",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.lead_stages": {
      "name": "lead_stages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "color": {
          "name": "color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'#6B7280'"
        },
        "order": {
          "name": "order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_custom": {
          "name": "is_custom",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "lead_stages_user_id_users_id_fk": {
          "name": "lead_stages_user_id_users_id_fk",
          "tableFrom": "lead_stages",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.leads": {
      "name": "leads",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "source_type": {
          "name": "source_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "incoming_connection_id": {
          "name": "incoming_connection_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "first_name": {
          "name": "first_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_name": {
          "name": "last_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "phone": {
          "name": "phone",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "company": {
          "name": "company",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "custom_fields": {
          "name": "custom_fields",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "stage_id": {
          "name": "stage_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "stage": {
          "name": "stage",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'new'"
        },
        "lead_score": {
          "name": "lead_score",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "ai_summary": {
          "name": "ai_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_next_action": {
          "name": "ai_next_action",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_category": {
          "name": "ai_category",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "has_appointment": {
          "name": "has_appointment",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "has_form_submission": {
          "name": "has_form_submission",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "has_transfer": {
          "name": "has_transfer",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "has_callback": {
          "name": "has_callback",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "appointment_date": {
          "name": "appointment_date",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "appointment_details": {
          "name": "appointment_details",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "form_data": {
          "name": "form_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "transferred_to": {
          "name": "transferred_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transferred_at": {
          "name": "transferred_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "callback_scheduled": {
          "name": "callback_scheduled",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "callback_completed": {
          "name": "callback_completed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "plivo_call_id": {
          "name": "plivo_call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "twilio_openai_call_id": {
          "name": "twilio_openai_call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "total_calls": {
          "name": "total_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "last_call_at": {
          "name": "last_call_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "tags": {
          "name": "tags",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "assigned_user_id": {
          "name": "assigned_user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "leads_user_id_users_id_fk": {
          "name": "leads_user_id_users_id_fk",
          "tableFrom": "leads",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "leads_campaign_id_campaigns_id_fk": {
          "name": "leads_campaign_id_campaigns_id_fk",
          "tableFrom": "leads",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "leads_incoming_connection_id_incoming_connections_id_fk": {
          "name": "leads_incoming_connection_id_incoming_connections_id_fk",
          "tableFrom": "leads",
          "tableTo": "incoming_connections",
          "columnsFrom": [
            "incoming_connection_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "leads_stage_id_lead_stages_id_fk": {
          "name": "leads_stage_id_lead_stages_id_fk",
          "tableFrom": "leads",
          "tableTo": "lead_stages",
          "columnsFrom": [
            "stage_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "leads_call_id_calls_id_fk": {
          "name": "leads_call_id_calls_id_fk",
          "tableFrom": "leads",
          "tableTo": "calls",
          "columnsFrom": [
            "call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "leads_plivo_call_id_plivo_calls_id_fk": {
          "name": "leads_plivo_call_id_plivo_calls_id_fk",
          "tableFrom": "leads",
          "tableTo": "plivo_calls",
          "columnsFrom": [
            "plivo_call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "leads_twilio_openai_call_id_twilio_openai_calls_id_fk": {
          "name": "leads_twilio_openai_call_id_twilio_openai_calls_id_fk",
          "tableFrom": "leads",
          "tableTo": "twilio_openai_calls",
          "columnsFrom": [
            "twilio_openai_call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "leads_assigned_user_id_users_id_fk": {
          "name": "leads_assigned_user_id_users_id_fk",
          "tableFrom": "leads",
          "tableTo": "users",
          "columnsFrom": [
            "assigned_user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_deliveries": {
      "name": "webhook_deliveries",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "webhook_id": {
          "name": "webhook_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "response_code": {
          "name": "response_code",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "response_body": {
          "name": "response_body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attempt_count": {
          "name": "attempt_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "last_attempt_at": {
          "name": "last_attempt_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webhook_deliveries_webhook_id_webhooks_id_fk": {
          "name": "webhook_deliveries_webhook_id_webhooks_id_fk",
          "tableFrom": "webhook_deliveries",
          "tableTo": "webhooks",
          "columnsFrom": [
            "webhook_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "webhook_deliveries_call_id_calls_id_fk": {
          "name": "webhook_deliveries_call_id_calls_id_fk",
          "tableFrom": "webhook_deliveries",
          "tableTo": "calls",
          "columnsFrom": [
            "call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhooks": {
      "name": "webhooks",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "secret": {
          "name": "secret",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webhooks_user_id_users_id_fk": {
          "name": "webhooks_user_id_users_id_fk",
          "tableFrom": "webhooks",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "webhooks_campaign_id_campaigns_id_fk": {
          "name": "webhooks_campaign_id_campaigns_id_fk",
          "tableFrom": "webhooks",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.llm_models": {
      "name": "llm_models",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "model_id": {
          "name": "model_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "tier": {
          "name": "tier",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "llm_models_model_id_unique": {
          "name": "llm_models_model_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "model_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.notifications": {
      "name": "notifications",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "title": {
          "name": "title",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "message": {
          "name": "message",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "link": {
          "name": "link",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "icon": {
          "name": "icon",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "display_type": {
          "name": "display_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'bell'"
        },
        "priority": {
          "name": "priority",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "dismissible": {
          "name": "dismissible",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "is_read": {
          "name": "is_read",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_dismissed": {
          "name": "is_dismissed",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "notifications_user_id_users_id_fk": {
          "name": "notifications_user_id_users_id_fk",
          "tableFrom": "notifications",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.openai_credentials": {
      "name": "openai_credentials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "api_key": {
          "name": "api_key",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "model_tier": {
          "name": "model_tier",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'free'"
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "max_concurrency": {
          "name": "max_concurrency",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 50
        },
        "current_load": {
          "name": "current_load",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_assigned_agents": {
          "name": "total_assigned_agents",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_assigned_users": {
          "name": "total_assigned_users",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_agents_threshold": {
          "name": "max_agents_threshold",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "last_health_check": {
          "name": "last_health_check",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "health_status": {
          "name": "health_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'healthy'"
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.otp_verifications": {
      "name": "otp_verifications",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "otp_code": {
          "name": "otp_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "attempts": {
          "name": "attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "verified": {
          "name": "verified",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.payment_transactions": {
      "name": "payment_transactions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "gateway": {
          "name": "gateway",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "gateway_transaction_id": {
          "name": "gateway_transaction_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gateway_subscription_id": {
          "name": "gateway_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "amount": {
          "name": "amount",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'USD'"
        },
        "plan_id": {
          "name": "plan_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "credit_package_id": {
          "name": "credit_package_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "subscription_id": {
          "name": "subscription_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "billing_period": {
          "name": "billing_period",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "credits_awarded": {
          "name": "credits_awarded",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "invoice_id": {
          "name": "invoice_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "completed_at": {
          "name": "completed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "payment_transactions_user_id_users_id_fk": {
          "name": "payment_transactions_user_id_users_id_fk",
          "tableFrom": "payment_transactions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "payment_transactions_plan_id_plans_id_fk": {
          "name": "payment_transactions_plan_id_plans_id_fk",
          "tableFrom": "payment_transactions",
          "tableTo": "plans",
          "columnsFrom": [
            "plan_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "payment_transactions_credit_package_id_credit_packages_id_fk": {
          "name": "payment_transactions_credit_package_id_credit_packages_id_fk",
          "tableFrom": "payment_transactions",
          "tableTo": "credit_packages",
          "columnsFrom": [
            "credit_package_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "payment_transactions_subscription_id_user_subscriptions_id_fk": {
          "name": "payment_transactions_subscription_id_user_subscriptions_id_fk",
          "tableFrom": "payment_transactions",
          "tableTo": "user_subscriptions",
          "columnsFrom": [
            "subscription_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.payment_webhook_queue": {
      "name": "payment_webhook_queue",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "gateway": {
          "name": "gateway",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "event_type": {
          "name": "event_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "event_id": {
          "name": "event_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "attempt_count": {
          "name": "attempt_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_attempts": {
          "name": "max_attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5
        },
        "last_attempt_at": {
          "name": "last_attempt_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "next_retry_at": {
          "name": "next_retry_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "last_error": {
          "name": "last_error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "error_history": {
          "name": "error_history",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "transaction_id": {
          "name": "transaction_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "received_at": {
          "name": "received_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "processed_at": {
          "name": "processed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "payment_webhook_queue_user_id_users_id_fk": {
          "name": "payment_webhook_queue_user_id_users_id_fk",
          "tableFrom": "payment_webhook_queue",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "payment_webhook_queue_transaction_id_payment_transactions_id_fk": {
          "name": "payment_webhook_queue_transaction_id_payment_transactions_id_fk",
          "tableFrom": "payment_webhook_queue",
          "tableTo": "payment_transactions",
          "columnsFrom": [
            "transaction_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.phone_number_rentals": {
      "name": "phone_number_rentals",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "phone_number_id": {
          "name": "phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "credits_charged": {
          "name": "credits_charged",
          "type": "integer",
          "primaryKey": false,
          "notNull": true
        },
        "billing_date": {
          "name": "billing_date",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'success'"
        },
        "transaction_id": {
          "name": "transaction_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "phone_number_rentals_phone_number_id_phone_numbers_id_fk": {
          "name": "phone_number_rentals_phone_number_id_phone_numbers_id_fk",
          "tableFrom": "phone_number_rentals",
          "tableTo": "phone_numbers",
          "columnsFrom": [
            "phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "phone_number_rentals_user_id_users_id_fk": {
          "name": "phone_number_rentals_user_id_users_id_fk",
          "tableFrom": "phone_number_rentals",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "phone_number_rentals_transaction_id_credit_transactions_id_fk": {
          "name": "phone_number_rentals_transaction_id_credit_transactions_id_fk",
          "tableFrom": "phone_number_rentals",
          "tableTo": "credit_transactions",
          "columnsFrom": [
            "transaction_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.phone_numbers": {
      "name": "phone_numbers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "phone_number": {
          "name": "phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "twilio_sid": {
          "name": "twilio_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_phone_number_id": {
          "name": "eleven_labs_phone_number_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "eleven_labs_credential_id": {
          "name": "eleven_labs_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "friendly_name": {
          "name": "friendly_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "country": {
          "name": "country",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'US'"
        },
        "capabilities": {
          "name": "capabilities",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "is_system_pool": {
          "name": "is_system_pool",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "purchase_price": {
          "name": "purchase_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "monthly_price": {
          "name": "monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "monthly_credits": {
          "name": "monthly_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "next_billing_date": {
          "name": "next_billing_date",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "purchased_at": {
          "name": "purchased_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "assigned_incoming_agent_id": {
          "name": "assigned_incoming_agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        }
      },
      "indexes": {},
      "foreignKeys": {
        "phone_numbers_user_id_users_id_fk": {
          "name": "phone_numbers_user_id_users_id_fk",
          "tableFrom": "phone_numbers",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "phone_numbers_eleven_labs_credential_id_eleven_labs_credentials_id_fk": {
          "name": "phone_numbers_eleven_labs_credential_id_eleven_labs_credentials_id_fk",
          "tableFrom": "phone_numbers",
          "tableTo": "eleven_labs_credentials",
          "columnsFrom": [
            "eleven_labs_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "phone_numbers_assigned_incoming_agent_id_incoming_agents_id_fk": {
          "name": "phone_numbers_assigned_incoming_agent_id_incoming_agents_id_fk",
          "tableFrom": "phone_numbers",
          "tableTo": "incoming_agents",
          "columnsFrom": [
            "assigned_incoming_agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "phone_numbers_phone_number_unique": {
          "name": "phone_numbers_phone_number_unique",
          "nullsNotDistinct": false,
          "columns": [
            "phone_number"
          ]
        },
        "phone_numbers_twilio_sid_unique": {
          "name": "phone_numbers_twilio_sid_unique",
          "nullsNotDistinct": false,
          "columns": [
            "twilio_sid"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plans": {
      "name": "plans",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "display_name": {
          "name": "display_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "monthly_price": {
          "name": "monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "yearly_price": {
          "name": "yearly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_monthly_price": {
          "name": "razorpay_monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_yearly_price": {
          "name": "razorpay_yearly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_monthly_price_id": {
          "name": "stripe_monthly_price_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_yearly_price_id": {
          "name": "stripe_yearly_price_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_product_id": {
          "name": "stripe_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_plan_id": {
          "name": "razorpay_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_yearly_plan_id": {
          "name": "razorpay_yearly_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_monthly_price": {
          "name": "paypal_monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_yearly_price": {
          "name": "paypal_yearly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_product_id": {
          "name": "paypal_product_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_monthly_plan_id": {
          "name": "paypal_monthly_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_yearly_plan_id": {
          "name": "paypal_yearly_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_monthly_price": {
          "name": "paystack_monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_yearly_price": {
          "name": "paystack_yearly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_monthly_plan_code": {
          "name": "paystack_monthly_plan_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_yearly_plan_code": {
          "name": "paystack_yearly_plan_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_monthly_price": {
          "name": "mercadopago_monthly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_yearly_price": {
          "name": "mercadopago_yearly_price",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_monthly_plan_id": {
          "name": "mercadopago_monthly_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_yearly_plan_id": {
          "name": "mercadopago_yearly_plan_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "max_agents": {
          "name": "max_agents",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "max_campaigns": {
          "name": "max_campaigns",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "max_contacts_per_campaign": {
          "name": "max_contacts_per_campaign",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5
        },
        "max_webhooks": {
          "name": "max_webhooks",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 3
        },
        "max_knowledge_bases": {
          "name": "max_knowledge_bases",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5
        },
        "max_flows": {
          "name": "max_flows",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 3
        },
        "max_phone_numbers": {
          "name": "max_phone_numbers",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "max_widgets": {
          "name": "max_widgets",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "included_credits": {
          "name": "included_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "default_llm_model": {
          "name": "default_llm_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "can_choose_llm": {
          "name": "can_choose_llm",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "can_purchase_numbers": {
          "name": "can_purchase_numbers",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "use_system_pool": {
          "name": "use_system_pool",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "features": {
          "name": "features",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "sip_enabled": {
          "name": "sip_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "max_concurrent_sip_calls": {
          "name": "max_concurrent_sip_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "sip_engines_allowed": {
          "name": "sip_engines_allowed",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY['elevenlabs-sip']::text[]"
        },
        "rest_api_enabled": {
          "name": "rest_api_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "team_management_enabled": {
          "name": "team_management_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "max_team_members": {
          "name": "max_team_members",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "max_custom_roles": {
          "name": "max_custom_roles",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "plans_name_unique": {
          "name": "plans_name_unique",
          "nullsNotDistinct": false,
          "columns": [
            "name"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.platform_languages": {
      "name": "platform_languages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "native_name": {
          "name": "native_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "flag": {
          "name": "flag",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "direction": {
          "name": "direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'ltr'"
        },
        "is_enabled": {
          "name": "is_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "is_default": {
          "name": "is_default",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "translations": {
          "name": "translations",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "platform_languages_code_unique": {
          "name": "platform_languages_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plivo_calls": {
      "name": "plivo_calls",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "plivo_phone_number_id": {
          "name": "plivo_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "plivo_call_uuid": {
          "name": "plivo_call_uuid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "from_number": {
          "name": "from_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "to_number": {
          "name": "to_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "openai_session_id": {
          "name": "openai_session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_voice": {
          "name": "openai_voice",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'alloy'"
        },
        "openai_model": {
          "name": "openai_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'gpt-realtime-mini'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "call_direction": {
          "name": "call_direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'outbound'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "recording_id": {
          "name": "recording_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "recording_duration": {
          "name": "recording_duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "transcript": {
          "name": "transcript",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_summary": {
          "name": "ai_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lead_quality_score": {
          "name": "lead_quality_score",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "classification": {
          "name": "classification",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "key_points": {
          "name": "key_points",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "next_actions": {
          "name": "next_actions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "was_transferred": {
          "name": "was_transferred",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "transferred_to": {
          "name": "transferred_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transferred_at": {
          "name": "transferred_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "answered_at": {
          "name": "answered_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "plivo_calls_user_id_users_id_fk": {
          "name": "plivo_calls_user_id_users_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "plivo_calls_campaign_id_campaigns_id_fk": {
          "name": "plivo_calls_campaign_id_campaigns_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "plivo_calls_contact_id_contacts_id_fk": {
          "name": "plivo_calls_contact_id_contacts_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "plivo_calls_agent_id_agents_id_fk": {
          "name": "plivo_calls_agent_id_agents_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "plivo_calls_plivo_phone_number_id_plivo_phone_numbers_id_fk": {
          "name": "plivo_calls_plivo_phone_number_id_plivo_phone_numbers_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "plivo_phone_numbers",
          "columnsFrom": [
            "plivo_phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "plivo_calls_openai_credential_id_openai_credentials_id_fk": {
          "name": "plivo_calls_openai_credential_id_openai_credentials_id_fk",
          "tableFrom": "plivo_calls",
          "tableTo": "openai_credentials",
          "columnsFrom": [
            "openai_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "plivo_calls_plivo_call_uuid_unique": {
          "name": "plivo_calls_plivo_call_uuid_unique",
          "nullsNotDistinct": false,
          "columns": [
            "plivo_call_uuid"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plivo_credentials": {
      "name": "plivo_credentials",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "auth_id": {
          "name": "auth_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "auth_token": {
          "name": "auth_token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "is_primary": {
          "name": "is_primary",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plivo_phone_numbers": {
      "name": "plivo_phone_numbers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "plivo_credential_id": {
          "name": "plivo_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "phone_number": {
          "name": "phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "plivo_number_id": {
          "name": "plivo_number_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "friendly_name": {
          "name": "friendly_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "country": {
          "name": "country",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "region": {
          "name": "region",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "number_type": {
          "name": "number_type",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'local'"
        },
        "capabilities": {
          "name": "capabilities",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "purchase_credits": {
          "name": "purchase_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "monthly_credits": {
          "name": "monthly_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "next_billing_date": {
          "name": "next_billing_date",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "assigned_agent_id": {
          "name": "assigned_agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "purchased_at": {
          "name": "purchased_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "plivo_phone_numbers_user_id_users_id_fk": {
          "name": "plivo_phone_numbers_user_id_users_id_fk",
          "tableFrom": "plivo_phone_numbers",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "plivo_phone_numbers_plivo_credential_id_plivo_credentials_id_fk": {
          "name": "plivo_phone_numbers_plivo_credential_id_plivo_credentials_id_fk",
          "tableFrom": "plivo_phone_numbers",
          "tableTo": "plivo_credentials",
          "columnsFrom": [
            "plivo_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "plivo_phone_numbers_openai_credential_id_openai_credentials_id_fk": {
          "name": "plivo_phone_numbers_openai_credential_id_openai_credentials_id_fk",
          "tableFrom": "plivo_phone_numbers",
          "tableTo": "openai_credentials",
          "columnsFrom": [
            "openai_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "plivo_phone_numbers_assigned_agent_id_agents_id_fk": {
          "name": "plivo_phone_numbers_assigned_agent_id_agents_id_fk",
          "tableFrom": "plivo_phone_numbers",
          "tableTo": "agents",
          "columnsFrom": [
            "assigned_agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "plivo_phone_numbers_phone_number_unique": {
          "name": "plivo_phone_numbers_phone_number_unique",
          "nullsNotDistinct": false,
          "columns": [
            "phone_number"
          ]
        },
        "plivo_phone_numbers_plivo_number_id_unique": {
          "name": "plivo_phone_numbers_plivo_number_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "plivo_number_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.plivo_phone_pricing": {
      "name": "plivo_phone_pricing",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "country_code": {
          "name": "country_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "country_name": {
          "name": "country_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "purchase_credits": {
          "name": "purchase_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        },
        "monthly_credits": {
          "name": "monthly_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 50
        },
        "kyc_required": {
          "name": "kyc_required",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "plivo_phone_pricing_country_code_unique": {
          "name": "plivo_phone_pricing_country_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "country_code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.prompt_templates": {
      "name": "prompt_templates",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "category": {
          "name": "category",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'general'"
        },
        "system_prompt": {
          "name": "system_prompt",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "first_message": {
          "name": "first_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "variables": {
          "name": "variables",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false
        },
        "suggested_voice_tone": {
          "name": "suggested_voice_tone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "suggested_personality": {
          "name": "suggested_personality",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_system_template": {
          "name": "is_system_template",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "is_public": {
          "name": "is_public",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "usage_count": {
          "name": "usage_count",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "prompt_templates_user_id_users_id_fk": {
          "name": "prompt_templates_user_id_users_id_fk",
          "tableFrom": "prompt_templates",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.refresh_tokens": {
      "name": "refresh_tokens",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "token": {
          "name": "token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "expires_at": {
          "name": "expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "is_valid": {
          "name": "is_valid",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "user_agent": {
          "name": "user_agent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ip_address": {
          "name": "ip_address",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "last_used_at": {
          "name": "last_used_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "refresh_tokens_user_id_users_id_fk": {
          "name": "refresh_tokens_user_id_users_id_fk",
          "tableFrom": "refresh_tokens",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "refresh_tokens_token_unique": {
          "name": "refresh_tokens_token_unique",
          "nullsNotDistinct": false,
          "columns": [
            "token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.refunds": {
      "name": "refunds",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "transaction_id": {
          "name": "transaction_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "amount": {
          "name": "amount",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true
        },
        "currency": {
          "name": "currency",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'USD'"
        },
        "gateway": {
          "name": "gateway",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "gateway_refund_id": {
          "name": "gateway_refund_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "reason": {
          "name": "reason",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "initiated_by": {
          "name": "initiated_by",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "admin_id": {
          "name": "admin_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "credits_reversed": {
          "name": "credits_reversed",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "user_suspended": {
          "name": "user_suspended",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "admin_note": {
          "name": "admin_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "customer_note": {
          "name": "customer_note",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "refund_note_number": {
          "name": "refund_note_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pdf_url": {
          "name": "pdf_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "pdf_generated_at": {
          "name": "pdf_generated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "processed_at": {
          "name": "processed_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "refunds_transaction_id_payment_transactions_id_fk": {
          "name": "refunds_transaction_id_payment_transactions_id_fk",
          "tableFrom": "refunds",
          "tableTo": "payment_transactions",
          "columnsFrom": [
            "transaction_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "refunds_user_id_users_id_fk": {
          "name": "refunds_user_id_users_id_fk",
          "tableFrom": "refunds",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "refunds_admin_id_users_id_fk": {
          "name": "refunds_admin_id_users_id_fk",
          "tableFrom": "refunds",
          "tableTo": "users",
          "columnsFrom": [
            "admin_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.seo_settings": {
      "name": "seo_settings",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "default_title": {
          "name": "default_title",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'AI Calling Platform'"
        },
        "default_description": {
          "name": "default_description",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'Enterprise AI-powered bulk calling platform with voice agents, Twilio integration, and intelligent lead classification.'"
        },
        "default_keywords": {
          "name": "default_keywords",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY[]::text[]"
        },
        "default_og_image": {
          "name": "default_og_image",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'/og-image.png'"
        },
        "sitemap_enabled": {
          "name": "sitemap_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": true
        },
        "sitemap_urls": {
          "name": "sitemap_urls",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "sitemap_auto_generate": {
          "name": "sitemap_auto_generate",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": true
        },
        "robots_enabled": {
          "name": "robots_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": true
        },
        "robots_rules": {
          "name": "robots_rules",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[{\"userAgent\":\"*\",\"allow\":[\"/\",\"/pricing\",\"/features\",\"/blog\",\"/contact\"],\"disallow\":[\"/app/\",\"/admin/\",\"/api/\"]}]'::jsonb"
        },
        "robots_crawl_delay": {
          "name": "robots_crawl_delay",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "structured_data_enabled": {
          "name": "structured_data_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": true
        },
        "structured_data": {
          "name": "structured_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'{\"organizationName\":\"\",\"organizationUrl\":\"\",\"organizationLogo\":\"/logo.png\",\"organizationDescription\":\"AI-powered voice agents for automated calling\",\"socialProfiles\":[],\"contactEmail\":\"\",\"contactPhone\":\"\"}'::jsonb"
        },
        "structured_data_faq": {
          "name": "structured_data_faq",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'[]'::jsonb"
        },
        "structured_data_faq_enabled": {
          "name": "structured_data_faq_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "structured_data_product": {
          "name": "structured_data_product",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false,
          "default": "'null'::jsonb"
        },
        "structured_data_product_enabled": {
          "name": "structured_data_product_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "twitter_handle": {
          "name": "twitter_handle",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "facebook_app_id": {
          "name": "facebook_app_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "canonical_base_url": {
          "name": "canonical_base_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "google_verification": {
          "name": "google_verification",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "bing_verification": {
          "name": "bing_verification",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "updated_by": {
          "name": "updated_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "seo_settings_updated_by_users_id_fk": {
          "name": "seo_settings_updated_by_users_id_fk",
          "tableFrom": "seo_settings",
          "tableTo": "users",
          "columnsFrom": [
            "updated_by"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sip_calls": {
      "name": "sip_calls",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "sip_phone_number_id": {
          "name": "sip_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "direction": {
          "name": "direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "to_number": {
          "name": "to_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "from_number": {
          "name": "from_number",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "external_call_id": {
          "name": "external_call_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'initiated'"
        },
        "duration_seconds": {
          "name": "duration_seconds",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "transcript_json": {
          "name": "transcript_json",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "conversation_data": {
          "name": "conversation_data",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sip_calls_sip_phone_number_id_sip_phone_numbers_id_fk": {
          "name": "sip_calls_sip_phone_number_id_sip_phone_numbers_id_fk",
          "tableFrom": "sip_calls",
          "tableTo": "sip_phone_numbers",
          "columnsFrom": [
            "sip_phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "sip_calls_user_id_users_id_fk": {
          "name": "sip_calls_user_id_users_id_fk",
          "tableFrom": "sip_calls",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "sip_calls_agent_id_agents_id_fk": {
          "name": "sip_calls_agent_id_agents_id_fk",
          "tableFrom": "sip_calls",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "sip_calls_campaign_id_campaigns_id_fk": {
          "name": "sip_calls_campaign_id_campaigns_id_fk",
          "tableFrom": "sip_calls",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        },
        "sip_calls_contact_id_contacts_id_fk": {
          "name": "sip_calls_contact_id_contacts_id_fk",
          "tableFrom": "sip_calls",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sip_phone_numbers": {
      "name": "sip_phone_numbers",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "sip_trunk_id": {
          "name": "sip_trunk_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "phone_number": {
          "name": "phone_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "inbound_enabled": {
          "name": "inbound_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "outbound_enabled": {
          "name": "outbound_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "external_elevenlabs_phone_id": {
          "name": "external_elevenlabs_phone_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "external_fonoster_phone_id": {
          "name": "external_fonoster_phone_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sip_phone_numbers_sip_trunk_id_sip_trunks_id_fk": {
          "name": "sip_phone_numbers_sip_trunk_id_sip_trunks_id_fk",
          "tableFrom": "sip_phone_numbers",
          "tableTo": "sip_trunks",
          "columnsFrom": [
            "sip_trunk_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "sip_phone_numbers_user_id_users_id_fk": {
          "name": "sip_phone_numbers_user_id_users_id_fk",
          "tableFrom": "sip_phone_numbers",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "sip_phone_numbers_agent_id_agents_id_fk": {
          "name": "sip_phone_numbers_agent_id_agents_id_fk",
          "tableFrom": "sip_phone_numbers",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.sip_trunks": {
      "name": "sip_trunks",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "engine": {
          "name": "engine",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "provider": {
          "name": "provider",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'generic'"
        },
        "sip_host": {
          "name": "sip_host",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sip_port": {
          "name": "sip_port",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5060
        },
        "transport": {
          "name": "transport",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'tls'"
        },
        "media_encryption": {
          "name": "media_encryption",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'require'"
        },
        "inbound_transport": {
          "name": "inbound_transport",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'tcp'"
        },
        "inbound_port": {
          "name": "inbound_port",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 5060
        },
        "codecs_allowed": {
          "name": "codecs_allowed",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY['PCMU', 'PCMA']::text[]"
        },
        "username": {
          "name": "username",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "password": {
          "name": "password",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "realm": {
          "name": "realm",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "registrar_host": {
          "name": "registrar_host",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "external_elevenlabs_id": {
          "name": "external_elevenlabs_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "external_fonoster_trunk_id": {
          "name": "external_fonoster_trunk_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "fonoster_credential_id": {
          "name": "fonoster_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "health_status": {
          "name": "health_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'unknown'"
        },
        "last_health_check": {
          "name": "last_health_check",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "sip_trunks_user_id_users_id_fk": {
          "name": "sip_trunks_user_id_users_id_fk",
          "tableFrom": "sip_trunks",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "sip_trunks_fonoster_credential_id_fonoster_credentials_id_fk": {
          "name": "sip_trunks_fonoster_credential_id_fonoster_credentials_id_fk",
          "tableFrom": "sip_trunks",
          "tableTo": "fonoster_credentials",
          "columnsFrom": [
            "fonoster_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "no action",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.supported_languages": {
      "name": "supported_languages",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "code": {
          "name": "code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "label": {
          "name": "label",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "providers": {
          "name": "providers",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "supported_languages_code_unique": {
          "name": "supported_languages_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.synced_voices": {
      "name": "synced_voices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "credential_id": {
          "name": "credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "voice_id": {
          "name": "voice_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "public_owner_id": {
          "name": "public_owner_id",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "voice_name": {
          "name": "voice_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'synced'"
        },
        "error_message": {
          "name": "error_message",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "synced_at": {
          "name": "synced_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "synced_voices_credential_id_eleven_labs_credentials_id_fk": {
          "name": "synced_voices_credential_id_eleven_labs_credentials_id_fk",
          "tableFrom": "synced_voices",
          "tableTo": "eleven_labs_credentials",
          "columnsFrom": [
            "credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "synced_voices_credential_id_voice_id_unique": {
          "name": "synced_voices_credential_id_voice_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "credential_id",
            "voice_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.tools": {
      "name": "tools",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "config": {
          "name": "config",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "tools_user_id_users_id_fk": {
          "name": "tools_user_id_users_id_fk",
          "tableFrom": "tools",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.twilio_countries": {
      "name": "twilio_countries",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "code": {
          "name": "code",
          "type": "varchar(2)",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "dial_code": {
          "name": "dial_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "sort_order": {
          "name": "sort_order",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 100
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "twilio_countries_code_unique": {
          "name": "twilio_countries_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "code"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.twilio_openai_calls": {
      "name": "twilio_openai_calls",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "campaign_id": {
          "name": "campaign_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "contact_id": {
          "name": "contact_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "twilio_phone_number_id": {
          "name": "twilio_phone_number_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "twilio_call_sid": {
          "name": "twilio_call_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "from_number": {
          "name": "from_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "to_number": {
          "name": "to_number",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "openai_session_id": {
          "name": "openai_session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_voice": {
          "name": "openai_voice",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'alloy'"
        },
        "openai_model": {
          "name": "openai_model",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'gpt-realtime'"
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "call_direction": {
          "name": "call_direction",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'outbound'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "recording_duration": {
          "name": "recording_duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "transcript": {
          "name": "transcript",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_summary": {
          "name": "ai_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "lead_quality_score": {
          "name": "lead_quality_score",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "classification": {
          "name": "classification",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "key_points": {
          "name": "key_points",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "next_actions": {
          "name": "next_actions",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "was_transferred": {
          "name": "was_transferred",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false,
          "default": false
        },
        "transferred_to": {
          "name": "transferred_to",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transferred_at": {
          "name": "transferred_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "answered_at": {
          "name": "answered_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "metadata": {
          "name": "metadata",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "twilio_openai_calls_user_id_users_id_fk": {
          "name": "twilio_openai_calls_user_id_users_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "twilio_openai_calls_campaign_id_campaigns_id_fk": {
          "name": "twilio_openai_calls_campaign_id_campaigns_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "campaigns",
          "columnsFrom": [
            "campaign_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "twilio_openai_calls_contact_id_contacts_id_fk": {
          "name": "twilio_openai_calls_contact_id_contacts_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "contacts",
          "columnsFrom": [
            "contact_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "twilio_openai_calls_agent_id_agents_id_fk": {
          "name": "twilio_openai_calls_agent_id_agents_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "twilio_openai_calls_twilio_phone_number_id_phone_numbers_id_fk": {
          "name": "twilio_openai_calls_twilio_phone_number_id_phone_numbers_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "phone_numbers",
          "columnsFrom": [
            "twilio_phone_number_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        },
        "twilio_openai_calls_openai_credential_id_openai_credentials_id_fk": {
          "name": "twilio_openai_calls_openai_credential_id_openai_credentials_id_fk",
          "tableFrom": "twilio_openai_calls",
          "tableTo": "openai_credentials",
          "columnsFrom": [
            "openai_credential_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "twilio_openai_calls_twilio_call_sid_unique": {
          "name": "twilio_openai_calls_twilio_call_sid_unique",
          "nullsNotDistinct": false,
          "columns": [
            "twilio_call_sid"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.usage_records": {
      "name": "usage_records",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "subscription_id": {
          "name": "subscription_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "call_id": {
          "name": "call_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "type": {
          "name": "type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "minutes_used": {
          "name": "minutes_used",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "cost": {
          "name": "cost",
          "type": "numeric(10, 2)",
          "primaryKey": false,
          "notNull": true,
          "default": "'0.00'"
        },
        "billing_status": {
          "name": "billing_status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "usage_records_user_id_users_id_fk": {
          "name": "usage_records_user_id_users_id_fk",
          "tableFrom": "usage_records",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "usage_records_subscription_id_user_subscriptions_id_fk": {
          "name": "usage_records_subscription_id_user_subscriptions_id_fk",
          "tableFrom": "usage_records",
          "tableTo": "user_subscriptions",
          "columnsFrom": [
            "subscription_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "usage_records_call_id_calls_id_fk": {
          "name": "usage_records_call_id_calls_id_fk",
          "tableFrom": "usage_records",
          "tableTo": "calls",
          "columnsFrom": [
            "call_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_addresses": {
      "name": "user_addresses",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "customer_name": {
          "name": "customer_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "street": {
          "name": "street",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "city": {
          "name": "city",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "region": {
          "name": "region",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "postal_code": {
          "name": "postal_code",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "iso_country": {
          "name": "iso_country",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "twilio_address_sid": {
          "name": "twilio_address_sid",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "verification_status": {
          "name": "verification_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "validation_status": {
          "name": "validation_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "rejection_reason": {
          "name": "rejection_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "user_addresses_user_id_users_id_fk": {
          "name": "user_addresses_user_id_users_id_fk",
          "tableFrom": "user_addresses",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_knowledge_storage_limits": {
      "name": "user_knowledge_storage_limits",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "max_storage_bytes": {
          "name": "max_storage_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 20971520
        },
        "used_storage_bytes": {
          "name": "used_storage_bytes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "user_knowledge_storage_limits_user_id_users_id_fk": {
          "name": "user_knowledge_storage_limits_user_id_users_id_fk",
          "tableFrom": "user_knowledge_storage_limits",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "user_knowledge_storage_limits_user_id_unique": {
          "name": "user_knowledge_storage_limits_user_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "user_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_kyc_documents": {
      "name": "user_kyc_documents",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "document_type": {
          "name": "document_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_name": {
          "name": "file_name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_path": {
          "name": "file_path",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "mime_type": {
          "name": "mime_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "file_size": {
          "name": "file_size",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "uploaded_at": {
          "name": "uploaded_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "user_kyc_documents_user_id_users_id_fk": {
          "name": "user_kyc_documents_user_id_users_id_fk",
          "tableFrom": "user_kyc_documents",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.user_subscriptions": {
      "name": "user_subscriptions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "plan_id": {
          "name": "plan_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "current_period_start": {
          "name": "current_period_start",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "current_period_end": {
          "name": "current_period_end",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true
        },
        "stripe_subscription_id": {
          "name": "stripe_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "razorpay_subscription_id": {
          "name": "razorpay_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paypal_subscription_id": {
          "name": "paypal_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_subscription_code": {
          "name": "paystack_subscription_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_customer_code": {
          "name": "paystack_customer_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "paystack_email_token": {
          "name": "paystack_email_token",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "mercadopago_subscription_id": {
          "name": "mercadopago_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cancel_at_period_end": {
          "name": "cancel_at_period_end",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "billing_period": {
          "name": "billing_period",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'monthly'"
        },
        "override_max_agents": {
          "name": "override_max_agents",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_campaigns": {
          "name": "override_max_campaigns",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_contacts_per_campaign": {
          "name": "override_max_contacts_per_campaign",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_webhooks": {
          "name": "override_max_webhooks",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_knowledge_bases": {
          "name": "override_max_knowledge_bases",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_flows": {
          "name": "override_max_flows",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_phone_numbers": {
          "name": "override_max_phone_numbers",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_max_widgets": {
          "name": "override_max_widgets",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "override_included_credits": {
          "name": "override_included_credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "user_subscriptions_user_id_users_id_fk": {
          "name": "user_subscriptions_user_id_users_id_fk",
          "tableFrom": "user_subscriptions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "user_subscriptions_plan_id_plans_id_fk": {
          "name": "user_subscriptions_plan_id_plans_id_fk",
          "tableFrom": "user_subscriptions",
          "tableTo": "plans",
          "columnsFrom": [
            "plan_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "restrict",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "user_subscriptions_stripe_subscription_id_unique": {
          "name": "user_subscriptions_stripe_subscription_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "stripe_subscription_id"
          ]
        },
        "user_subscriptions_razorpay_subscription_id_unique": {
          "name": "user_subscriptions_razorpay_subscription_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "razorpay_subscription_id"
          ]
        },
        "user_subscriptions_paypal_subscription_id_unique": {
          "name": "user_subscriptions_paypal_subscription_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "paypal_subscription_id"
          ]
        },
        "user_subscriptions_paystack_subscription_code_unique": {
          "name": "user_subscriptions_paystack_subscription_code_unique",
          "nullsNotDistinct": false,
          "columns": [
            "paystack_subscription_code"
          ]
        },
        "user_subscriptions_mercadopago_subscription_id_unique": {
          "name": "user_subscriptions_mercadopago_subscription_id_unique",
          "nullsNotDistinct": false,
          "columns": [
            "mercadopago_subscription_id"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.users": {
      "name": "users",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "email": {
          "name": "email",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "password": {
          "name": "password",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "role": {
          "name": "role",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'user'"
        },
        "plan_type": {
          "name": "plan_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'free'"
        },
        "plan_expires_at": {
          "name": "plan_expires_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "credits": {
          "name": "credits",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "stripe_customer_id": {
          "name": "stripe_customer_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "stripe_subscription_id": {
          "name": "stripe_subscription_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "max_webhooks": {
          "name": "max_webhooks",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 3
        },
        "is_deleted": {
          "name": "is_deleted",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "deleted_at": {
          "name": "deleted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "deleted_by": {
          "name": "deleted_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "timezone": {
          "name": "timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "cookie_consent": {
          "name": "cookie_consent",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false
        },
        "analytics_consent": {
          "name": "analytics_consent",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false
        },
        "marketing_consent": {
          "name": "marketing_consent",
          "type": "boolean",
          "primaryKey": false,
          "notNull": false
        },
        "consent_timestamp": {
          "name": "consent_timestamp",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "terms_accepted_at": {
          "name": "terms_accepted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "privacy_accepted_at": {
          "name": "privacy_accepted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "blocked_reason": {
          "name": "blocked_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "blocked_at": {
          "name": "blocked_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "blocked_by": {
          "name": "blocked_by",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "eleven_labs_credential_id": {
          "name": "eleven_labs_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "kyc_status": {
          "name": "kyc_status",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'pending'"
        },
        "kyc_submitted_at": {
          "name": "kyc_submitted_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "kyc_approved_at": {
          "name": "kyc_approved_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "kyc_rejection_reason": {
          "name": "kyc_rejection_reason",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_name": {
          "name": "billing_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_address_line1": {
          "name": "billing_address_line1",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_address_line2": {
          "name": "billing_address_line2",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_city": {
          "name": "billing_city",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_state": {
          "name": "billing_state",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_postal_code": {
          "name": "billing_postal_code",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "billing_country": {
          "name": "billing_country",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "company": {
          "name": "company",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "users_email_unique": {
          "name": "users_email_unique",
          "nullsNotDistinct": false,
          "columns": [
            "email"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.voices": {
      "name": "voices",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "eleven_labs_voice_id": {
          "name": "eleven_labs_voice_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "gender": {
          "name": "gender",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "accent": {
          "name": "accent",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "tone": {
          "name": "tone",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "is_custom": {
          "name": "is_custom",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "voices_user_id_users_id_fk": {
          "name": "voices_user_id_users_id_fk",
          "tableFrom": "voices",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_logs": {
      "name": "webhook_logs",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "serial",
          "primaryKey": true,
          "notNull": true
        },
        "webhook_id": {
          "name": "webhook_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "event": {
          "name": "event",
          "type": "varchar(100)",
          "primaryKey": false,
          "notNull": true
        },
        "payload": {
          "name": "payload",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "success": {
          "name": "success",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true
        },
        "status_code": {
          "name": "status_code",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "response_body": {
          "name": "response_body",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "response_time": {
          "name": "response_time",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "error": {
          "name": "error",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "attempt": {
          "name": "attempt",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 1
        },
        "max_attempts": {
          "name": "max_attempts",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 3
        },
        "next_retry_at": {
          "name": "next_retry_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "webhook_logs_webhook_id_webhook_subscriptions_id_fk": {
          "name": "webhook_logs_webhook_id_webhook_subscriptions_id_fk",
          "tableFrom": "webhook_logs",
          "tableTo": "webhook_subscriptions",
          "columnsFrom": [
            "webhook_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.webhook_subscriptions": {
      "name": "webhook_subscriptions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "varchar(255)",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "url": {
          "name": "url",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "method": {
          "name": "method",
          "type": "varchar(10)",
          "primaryKey": false,
          "notNull": true,
          "default": "'POST'"
        },
        "headers": {
          "name": "headers",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "secret": {
          "name": "secret",
          "type": "varchar(64)",
          "primaryKey": false,
          "notNull": true
        },
        "auth_type": {
          "name": "auth_type",
          "type": "varchar(50)",
          "primaryKey": false,
          "notNull": false
        },
        "auth_credentials": {
          "name": "auth_credentials",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "events": {
          "name": "events",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": true
        },
        "campaign_ids": {
          "name": "campaign_ids",
          "type": "jsonb",
          "primaryKey": false,
          "notNull": false
        },
        "is_active": {
          "name": "is_active",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": true
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {},
      "compositePrimaryKeys": {},
      "uniqueConstraints": {},
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.website_widgets": {
      "name": "website_widgets",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "name": {
          "name": "name",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "description": {
          "name": "description",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'active'"
        },
        "agent_id": {
          "name": "agent_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "agent_type": {
          "name": "agent_type",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'natural'"
        },
        "icon_url": {
          "name": "icon_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "icon_path": {
          "name": "icon_path",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "brand_name": {
          "name": "brand_name",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "button_label": {
          "name": "button_label",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'VOICE CHAT'"
        },
        "primary_color": {
          "name": "primary_color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'#3B82F6'"
        },
        "accent_color": {
          "name": "accent_color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'#1E40AF'"
        },
        "background_color": {
          "name": "background_color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'#FFFFFF'"
        },
        "text_color": {
          "name": "text_color",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'#1F2937'"
        },
        "require_terms_acceptance": {
          "name": "require_terms_acceptance",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "welcome_message": {
          "name": "welcome_message",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Hi! Click to start a voice conversation.'"
        },
        "launcher_text": {
          "name": "launcher_text",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Talk to us'"
        },
        "offline_message": {
          "name": "offline_message",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'We''re currently unavailable. Please try again later.'"
        },
        "low_credits_message": {
          "name": "low_credits_message",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'Service temporarily unavailable.'"
        },
        "allowed_domains": {
          "name": "allowed_domains",
          "type": "text[]",
          "primaryKey": false,
          "notNull": true,
          "default": "ARRAY[]::text[]"
        },
        "business_hours_enabled": {
          "name": "business_hours_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "business_hours_start": {
          "name": "business_hours_start",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'09:00'"
        },
        "business_hours_end": {
          "name": "business_hours_end",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'17:00'"
        },
        "business_days": {
          "name": "business_days",
          "type": "text[]",
          "primaryKey": false,
          "notNull": false,
          "default": "ARRAY['monday', 'tuesday', 'wednesday', 'thursday', 'friday']::text[]"
        },
        "business_timezone": {
          "name": "business_timezone",
          "type": "text",
          "primaryKey": false,
          "notNull": false,
          "default": "'America/New_York'"
        },
        "max_concurrent_calls": {
          "name": "max_concurrent_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 5
        },
        "max_call_duration": {
          "name": "max_call_duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 300
        },
        "cooldown_minutes": {
          "name": "cooldown_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "appointment_booking_enabled": {
          "name": "appointment_booking_enabled",
          "type": "boolean",
          "primaryKey": false,
          "notNull": true,
          "default": false
        },
        "embed_token": {
          "name": "embed_token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "total_calls": {
          "name": "total_calls",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "total_minutes": {
          "name": "total_minutes",
          "type": "integer",
          "primaryKey": false,
          "notNull": true,
          "default": 0
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        },
        "updated_at": {
          "name": "updated_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "website_widgets_user_id_users_id_fk": {
          "name": "website_widgets_user_id_users_id_fk",
          "tableFrom": "website_widgets",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "website_widgets_agent_id_agents_id_fk": {
          "name": "website_widgets_agent_id_agents_id_fk",
          "tableFrom": "website_widgets",
          "tableTo": "agents",
          "columnsFrom": [
            "agent_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "set null",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "website_widgets_embed_token_unique": {
          "name": "website_widgets_embed_token_unique",
          "nullsNotDistinct": false,
          "columns": [
            "embed_token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    },
    "public.widget_call_sessions": {
      "name": "widget_call_sessions",
      "schema": "",
      "columns": {
        "id": {
          "name": "id",
          "type": "varchar",
          "primaryKey": true,
          "notNull": true,
          "default": "gen_random_uuid()"
        },
        "widget_id": {
          "name": "widget_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "user_id": {
          "name": "user_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": true
        },
        "session_token": {
          "name": "session_token",
          "type": "text",
          "primaryKey": false,
          "notNull": true
        },
        "visitor_ip": {
          "name": "visitor_ip",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "visitor_domain": {
          "name": "visitor_domain",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "status": {
          "name": "status",
          "type": "text",
          "primaryKey": false,
          "notNull": true,
          "default": "'pending'"
        },
        "duration": {
          "name": "duration",
          "type": "integer",
          "primaryKey": false,
          "notNull": false
        },
        "credits_used": {
          "name": "credits_used",
          "type": "integer",
          "primaryKey": false,
          "notNull": false,
          "default": 0
        },
        "recording_url": {
          "name": "recording_url",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "transcript": {
          "name": "transcript",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "ai_summary": {
          "name": "ai_summary",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "sentiment": {
          "name": "sentiment",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_session_id": {
          "name": "openai_session_id",
          "type": "text",
          "primaryKey": false,
          "notNull": false
        },
        "openai_credential_id": {
          "name": "openai_credential_id",
          "type": "varchar",
          "primaryKey": false,
          "notNull": false
        },
        "started_at": {
          "name": "started_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "ended_at": {
          "name": "ended_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": false
        },
        "created_at": {
          "name": "created_at",
          "type": "timestamp",
          "primaryKey": false,
          "notNull": true,
          "default": "now()"
        }
      },
      "indexes": {},
      "foreignKeys": {
        "widget_call_sessions_widget_id_website_widgets_id_fk": {
          "name": "widget_call_sessions_widget_id_website_widgets_id_fk",
          "tableFrom": "widget_call_sessions",
          "tableTo": "website_widgets",
          "columnsFrom": [
            "widget_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        },
        "widget_call_sessions_user_id_users_id_fk": {
          "name": "widget_call_sessions_user_id_users_id_fk",
          "tableFrom": "widget_call_sessions",
          "tableTo": "users",
          "columnsFrom": [
            "user_id"
          ],
          "columnsTo": [
            "id"
          ],
          "onDelete": "cascade",
          "onUpdate": "no action"
        }
      },
      "compositePrimaryKeys": {},
      "uniqueConstraints": {
        "widget_call_sessions_session_token_unique": {
          "name": "widget_call_sessions_session_token_unique",
          "nullsNotDistinct": false,
          "columns": [
            "session_token"
          ]
        }
      },
      "policies": {},
      "checkConstraints": {},
      "isRLSEnabled": false
    }
  },
  "enums": {},
  "schemas": {},
  "sequences": {},
  "roles": {},
  "policies": {},
  "views": {},
  "_meta": {
    "columns": {},
    "schemas": {},
    "tables": {}
  }
}