mirror of
https://github.com/melgarafael/DeskcommCRM.git
synced 2026-10-02 01:28:34 +08:00
fn_org_operante, fn_suspender_organizacao, fn_reativar_organizacao e fn_followup_turno_descartado estavam coladas nos blocos escritos à mão, fora da ordem alfabética e com os argumentos na ordem da assinatura. Passam ao trecho gerado, na posição alfabética e com os argumentos ordenados, como o `supabase gen types` escreve: a próxima regeneração não as move de lugar. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
11342 lines
347 KiB
TypeScript
11342 lines
347 KiB
TypeScript
export type Json =
|
|
| string
|
|
| number
|
|
| boolean
|
|
| null
|
|
| { [key: string]: Json | undefined }
|
|
| Json[]
|
|
|
|
export type Database = {
|
|
graphql_public: {
|
|
Tables: {
|
|
[_ in never]: never
|
|
}
|
|
Views: {
|
|
[_ in never]: never
|
|
}
|
|
Functions: {
|
|
graphql: {
|
|
Args: {
|
|
extensions?: Json
|
|
operationName?: string
|
|
query?: string
|
|
variables?: Json
|
|
}
|
|
Returns: Json
|
|
}
|
|
}
|
|
Enums: {
|
|
[_ in never]: never
|
|
}
|
|
CompositeTypes: {
|
|
[_ in never]: never
|
|
}
|
|
}
|
|
public: {
|
|
Tables: {
|
|
channel_integrations: {
|
|
Row: { organization_id: string; profile_id: string; credential_encrypted: string; created_at: string; updated_at: string }
|
|
Insert: { organization_id: string; profile_id: string; credential_encrypted: string; created_at?: string; updated_at?: string }
|
|
Update: { organization_id?: string; profile_id?: string; credential_encrypted?: string; created_at?: string; updated_at?: string }
|
|
Relationships: [{ foreignKeyName: "channel_integrations_organization_id_fkey"; columns: ["organization_id"]; isOneToOne: true; referencedRelation: "organizations"; referencedColumns: ["id"] }]
|
|
}
|
|
ai_reply_drafts: {
|
|
Row: {
|
|
id: string;
|
|
organization_id: string;
|
|
conversation_id: string;
|
|
contact_id: string;
|
|
agent_id: string;
|
|
agent_version_id: string;
|
|
channel_session_id: string;
|
|
service_boundary: Json;
|
|
context_revision: number;
|
|
operation_revision: number;
|
|
generation_token: string;
|
|
revision: number;
|
|
status: string;
|
|
original_body: string | null;
|
|
edited_body: string | null;
|
|
approved_body: string | null;
|
|
proposals: Json;
|
|
trace: Json;
|
|
feedback: Json | null;
|
|
approved_by: string | null;
|
|
approved_support_session_id: string | null;
|
|
approved_at: string | null;
|
|
send_job_id: string | null;
|
|
message_id: string | null;
|
|
error_code: string | null;
|
|
created_at: string;
|
|
updated_at: string;
|
|
};
|
|
Insert: {
|
|
id?: string;
|
|
organization_id?: string;
|
|
conversation_id?: string;
|
|
contact_id?: string;
|
|
agent_id?: string;
|
|
agent_version_id?: string;
|
|
channel_session_id?: string;
|
|
service_boundary?: Json;
|
|
context_revision?: number;
|
|
operation_revision?: number;
|
|
generation_token?: string;
|
|
revision?: number;
|
|
status?: string;
|
|
original_body?: string | null;
|
|
edited_body?: string | null;
|
|
approved_body?: string | null;
|
|
proposals?: Json;
|
|
trace?: Json;
|
|
feedback?: Json | null;
|
|
approved_by?: string | null;
|
|
approved_support_session_id?: string | null;
|
|
approved_at?: string | null;
|
|
send_job_id?: string | null;
|
|
message_id?: string | null;
|
|
error_code?: string | null;
|
|
created_at?: string;
|
|
updated_at?: string;
|
|
};
|
|
Update: {
|
|
id?: string;
|
|
organization_id?: string;
|
|
conversation_id?: string;
|
|
contact_id?: string;
|
|
agent_id?: string;
|
|
agent_version_id?: string;
|
|
channel_session_id?: string;
|
|
service_boundary?: Json;
|
|
context_revision?: number;
|
|
operation_revision?: number;
|
|
generation_token?: string;
|
|
revision?: number;
|
|
status?: string;
|
|
original_body?: string | null;
|
|
edited_body?: string | null;
|
|
approved_body?: string | null;
|
|
proposals?: Json;
|
|
trace?: Json;
|
|
feedback?: Json | null;
|
|
approved_by?: string | null;
|
|
approved_support_session_id?: string | null;
|
|
approved_at?: string | null;
|
|
send_job_id?: string | null;
|
|
message_id?: string | null;
|
|
error_code?: string | null;
|
|
created_at?: string;
|
|
updated_at?: string;
|
|
};
|
|
Relationships: [];
|
|
}
|
|
companies: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
legal_name: string | null
|
|
trade_name: string | null
|
|
cnpj: string | null
|
|
normalized_cnpj: string | null
|
|
registration_status: string | null
|
|
legal_nature: string | null
|
|
company_size: string | null
|
|
share_capital: number | null
|
|
opened_at: string | null
|
|
main_cnae_code: string | null
|
|
main_cnae_description: string | null
|
|
secondary_cnaes: Json
|
|
street: string | null
|
|
number: string | null
|
|
complement: string | null
|
|
district: string | null
|
|
city: string | null
|
|
state: string | null
|
|
zip_code: string | null
|
|
email: string | null
|
|
phone: string | null
|
|
enrichment_status: string
|
|
enriched_at: string | null
|
|
enrichment_error: string | null
|
|
brasilapi_raw: Json | null
|
|
created_by: string | null
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
legal_name?: string | null
|
|
trade_name?: string | null
|
|
cnpj?: string | null
|
|
normalized_cnpj?: string | null
|
|
registration_status?: string | null
|
|
legal_nature?: string | null
|
|
company_size?: string | null
|
|
share_capital?: number | null
|
|
opened_at?: string | null
|
|
main_cnae_code?: string | null
|
|
main_cnae_description?: string | null
|
|
secondary_cnaes?: Json
|
|
street?: string | null
|
|
number?: string | null
|
|
complement?: string | null
|
|
district?: string | null
|
|
city?: string | null
|
|
state?: string | null
|
|
zip_code?: string | null
|
|
email?: string | null
|
|
phone?: string | null
|
|
enrichment_status?: string
|
|
enriched_at?: string | null
|
|
enrichment_error?: string | null
|
|
brasilapi_raw?: Json | null
|
|
created_by?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
legal_name?: string | null
|
|
trade_name?: string | null
|
|
cnpj?: string | null
|
|
normalized_cnpj?: string | null
|
|
registration_status?: string | null
|
|
legal_nature?: string | null
|
|
company_size?: string | null
|
|
share_capital?: number | null
|
|
opened_at?: string | null
|
|
main_cnae_code?: string | null
|
|
main_cnae_description?: string | null
|
|
secondary_cnaes?: Json
|
|
street?: string | null
|
|
number?: string | null
|
|
complement?: string | null
|
|
district?: string | null
|
|
city?: string | null
|
|
state?: string | null
|
|
zip_code?: string | null
|
|
email?: string | null
|
|
phone?: string | null
|
|
enrichment_status?: string
|
|
enriched_at?: string | null
|
|
enrichment_error?: string | null
|
|
brasilapi_raw?: Json | null
|
|
created_by?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "companies_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
company_people: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
company_id: string
|
|
person_id: string
|
|
job_title: string | null
|
|
department: string | null
|
|
is_decision_maker: boolean
|
|
is_primary: boolean
|
|
notes: string | null
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
company_id: string
|
|
person_id: string
|
|
job_title?: string | null
|
|
department?: string | null
|
|
is_decision_maker?: boolean
|
|
is_primary?: boolean
|
|
notes?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
company_id?: string
|
|
person_id?: string
|
|
job_title?: string | null
|
|
department?: string | null
|
|
is_decision_maker?: boolean
|
|
is_primary?: boolean
|
|
notes?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "company_people_company_id_fkey"
|
|
columns: ["company_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "companies"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "company_people_person_id_fkey"
|
|
columns: ["person_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "people"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "company_people_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
financial_accounts: {
|
|
Row: {
|
|
created_at: string
|
|
currency: string
|
|
id: string
|
|
is_active: boolean
|
|
kind: string
|
|
name: string
|
|
opening_balance_cents: number
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
currency?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
kind?: string
|
|
name: string
|
|
opening_balance_cents?: number
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
currency?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
kind?: string
|
|
name?: string
|
|
opening_balance_cents?: number
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "financial_accounts_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
import_batches: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
kind: string
|
|
filename: string
|
|
status: string
|
|
total_rows: number
|
|
processed_rows: number
|
|
successful_rows: number
|
|
failed_rows: number
|
|
conflict_rows: number
|
|
column_mapping: Json
|
|
created_by: string | null
|
|
created_at: string
|
|
completed_at: string | null
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
kind?: string
|
|
filename: string
|
|
status?: string
|
|
total_rows?: number
|
|
processed_rows?: number
|
|
successful_rows?: number
|
|
failed_rows?: number
|
|
conflict_rows?: number
|
|
column_mapping?: Json
|
|
created_by?: string | null
|
|
created_at?: string
|
|
completed_at?: string | null
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
kind?: string
|
|
filename?: string
|
|
status?: string
|
|
total_rows?: number
|
|
processed_rows?: number
|
|
successful_rows?: number
|
|
failed_rows?: number
|
|
conflict_rows?: number
|
|
column_mapping?: Json
|
|
created_by?: string | null
|
|
created_at?: string
|
|
completed_at?: string | null
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "import_batches_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
import_rows: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
batch_id: string
|
|
row_number: number
|
|
raw_data: Json
|
|
normalized_data: Json
|
|
status: string
|
|
error: string | null
|
|
company_id: string | null
|
|
person_id: string | null
|
|
contact_id: string | null
|
|
created_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
batch_id: string
|
|
row_number: number
|
|
raw_data?: Json
|
|
normalized_data?: Json
|
|
status?: string
|
|
error?: string | null
|
|
company_id?: string | null
|
|
person_id?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
batch_id?: string
|
|
row_number?: number
|
|
raw_data?: Json
|
|
normalized_data?: Json
|
|
status?: string
|
|
error?: string | null
|
|
company_id?: string | null
|
|
person_id?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "import_rows_batch_id_fkey"
|
|
columns: ["batch_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "import_batches"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "import_rows_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
payment_methods: {
|
|
Row: {
|
|
account_id: string | null
|
|
created_at: string
|
|
id: string
|
|
is_active: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
account_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
account_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "payment_methods_account_id_fkey"
|
|
columns: ["account_id"]
|
|
referencedRelation: "financial_accounts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "payment_methods_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
account_plans: {
|
|
Row: {
|
|
created_at: string
|
|
direction: string
|
|
id: string
|
|
is_active: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
direction: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
direction?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "account_plans_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
people: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
full_name: string
|
|
normalized_name: string | null
|
|
email: string | null
|
|
notes: string | null
|
|
created_by: string | null
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
full_name: string
|
|
normalized_name?: string | null
|
|
email?: string | null
|
|
notes?: string | null
|
|
created_by?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
full_name?: string
|
|
normalized_name?: string | null
|
|
email?: string | null
|
|
notes?: string | null
|
|
created_by?: string | null
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "people_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
sales: {
|
|
Row: {
|
|
appointment_id: string | null
|
|
attendant_user_id: string | null
|
|
cancel_reason: string | null
|
|
cancelled_at: string | null
|
|
contact_id: string | null
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
currency: string
|
|
discount_cents: number
|
|
finalized_at: string | null
|
|
id: string
|
|
notes: string | null
|
|
number: number
|
|
organization_id: string
|
|
payment_method_id: string | null
|
|
reverse_reason: string | null
|
|
reversed_at: string | null
|
|
status: string
|
|
total_cents: number
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
appointment_id?: string | null
|
|
attendant_user_id?: string | null
|
|
cancel_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
discount_cents?: number
|
|
finalized_at?: string | null
|
|
id?: string
|
|
notes?: string | null
|
|
number: number
|
|
organization_id: string
|
|
payment_method_id?: string | null
|
|
reverse_reason?: string | null
|
|
reversed_at?: string | null
|
|
status?: string
|
|
total_cents?: number
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
appointment_id?: string | null
|
|
attendant_user_id?: string | null
|
|
cancel_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
discount_cents?: number
|
|
finalized_at?: string | null
|
|
id?: string
|
|
notes?: string | null
|
|
number?: number
|
|
organization_id?: string
|
|
payment_method_id?: string | null
|
|
reverse_reason?: string | null
|
|
reversed_at?: string | null
|
|
status?: string
|
|
total_cents?: number
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "sales_appointment_id_fkey"
|
|
columns: ["appointment_id"]
|
|
referencedRelation: "calendar_appointments"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "sales_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "sales_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "sales_payment_method_id_fkey"
|
|
columns: ["payment_method_id"]
|
|
referencedRelation: "payment_methods"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
sale_items: {
|
|
Row: {
|
|
attendant_user_id: string | null
|
|
commission_percent: number
|
|
created_at: string
|
|
description: string
|
|
discount_cents: number
|
|
event_type_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
quantity: number
|
|
sale_id: string
|
|
total_cents: number
|
|
unit_price_cents: number
|
|
}
|
|
Insert: {
|
|
attendant_user_id?: string | null
|
|
commission_percent?: number
|
|
created_at?: string
|
|
description: string
|
|
discount_cents?: number
|
|
event_type_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
quantity?: number
|
|
sale_id: string
|
|
total_cents: number
|
|
unit_price_cents: number
|
|
}
|
|
Update: {
|
|
attendant_user_id?: string | null
|
|
commission_percent?: number
|
|
created_at?: string
|
|
description?: string
|
|
discount_cents?: number
|
|
event_type_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
quantity?: number
|
|
sale_id?: string
|
|
total_cents?: number
|
|
unit_price_cents?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "sale_items_event_type_id_fkey"
|
|
columns: ["event_type_id"]
|
|
referencedRelation: "calendar_event_types"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "sale_items_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "sale_items_sale_id_fkey"
|
|
columns: ["sale_id"]
|
|
referencedRelation: "sales"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
commission_rules: {
|
|
Row: {
|
|
attendant_user_id: string | null
|
|
created_at: string
|
|
event_type_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
percent: number
|
|
name: string
|
|
is_active: boolean
|
|
}
|
|
Insert: {
|
|
attendant_user_id?: string | null
|
|
created_at?: string
|
|
event_type_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
percent: number
|
|
name?: string
|
|
is_active?: boolean
|
|
}
|
|
Update: {
|
|
attendant_user_id?: string | null
|
|
created_at?: string
|
|
event_type_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
percent?: number
|
|
name?: string
|
|
is_active?: boolean
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "commission_rules_event_type_id_fkey"
|
|
columns: ["event_type_id"]
|
|
referencedRelation: "calendar_event_types"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "commission_rules_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
commissions: {
|
|
Row: {
|
|
amount_cents: number
|
|
attendant_user_id: string
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
paid_at: string | null
|
|
percent: number
|
|
reversed_at: string | null
|
|
sale_item_id: string
|
|
status: string
|
|
}
|
|
Insert: {
|
|
amount_cents: number
|
|
attendant_user_id: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
paid_at?: string | null
|
|
percent: number
|
|
reversed_at?: string | null
|
|
sale_item_id: string
|
|
status?: string
|
|
}
|
|
Update: {
|
|
amount_cents?: number
|
|
attendant_user_id?: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
paid_at?: string | null
|
|
percent?: number
|
|
reversed_at?: string | null
|
|
sale_item_id?: string
|
|
status?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "commissions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "commissions_sale_item_id_fkey"
|
|
columns: ["sale_item_id"]
|
|
referencedRelation: "sale_items"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
financial_entries: {
|
|
Row: {
|
|
account_id: string
|
|
account_plan_id: string | null
|
|
amount_cents: number
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
currency: string
|
|
description: string | null
|
|
direction: string
|
|
entry_date: string
|
|
id: string
|
|
organization_id: string
|
|
origin: string
|
|
paid_at: string | null
|
|
reverses_entry_id: string | null
|
|
recurring_entry_id: string | null
|
|
sale_id: string | null
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
account_id: string
|
|
account_plan_id?: string | null
|
|
amount_cents: number
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
description?: string | null
|
|
direction: string
|
|
entry_date?: string
|
|
id?: string
|
|
organization_id: string
|
|
origin?: string
|
|
paid_at?: string | null
|
|
reverses_entry_id?: string | null
|
|
recurring_entry_id?: string | null
|
|
sale_id?: string | null
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
account_id?: string
|
|
account_plan_id?: string | null
|
|
amount_cents?: number
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
description?: string | null
|
|
direction?: string
|
|
entry_date?: string
|
|
id?: string
|
|
organization_id?: string
|
|
origin?: string
|
|
paid_at?: string | null
|
|
reverses_entry_id?: string | null
|
|
recurring_entry_id?: string | null
|
|
sale_id?: string | null
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "financial_entries_account_id_fkey"
|
|
columns: ["account_id"]
|
|
referencedRelation: "financial_accounts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "financial_entries_account_plan_id_fkey"
|
|
columns: ["account_plan_id"]
|
|
referencedRelation: "account_plans"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "financial_entries_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "financial_entries_sale_id_fkey"
|
|
columns: ["sale_id"]
|
|
referencedRelation: "sales"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
loyalty_ledger: {
|
|
Row: {
|
|
contact_id: string
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
id: string
|
|
idempotency_key: string | null
|
|
organization_id: string
|
|
points: number
|
|
reason: string
|
|
sale_id: string | null
|
|
sale_item_id: string | null
|
|
}
|
|
Insert: {
|
|
contact_id: string
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
idempotency_key?: string | null
|
|
organization_id: string
|
|
points: number
|
|
reason: string
|
|
sale_id?: string | null
|
|
sale_item_id?: string | null
|
|
}
|
|
Update: {
|
|
contact_id?: string
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
idempotency_key?: string | null
|
|
organization_id?: string
|
|
points?: number
|
|
reason?: string
|
|
sale_id?: string | null
|
|
sale_item_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "loyalty_ledger_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "loyalty_ledger_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "loyalty_ledger_sale_id_fkey"
|
|
columns: ["sale_id"]
|
|
referencedRelation: "sales"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
recurring_entries: {
|
|
Row: {
|
|
account_id: string
|
|
account_plan_id: string | null
|
|
amount_cents: number
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
currency: string
|
|
day_of_month: number
|
|
direction: string
|
|
id: string
|
|
is_active: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
account_id: string
|
|
account_plan_id?: string | null
|
|
amount_cents: number
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
day_of_month: number
|
|
direction: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
account_id?: string
|
|
account_plan_id?: string | null
|
|
amount_cents?: number
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string
|
|
day_of_month?: number
|
|
direction?: string
|
|
id?: string
|
|
is_active?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "recurring_entries_account_id_fkey"
|
|
columns: ["account_id"]
|
|
referencedRelation: "financial_accounts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "recurring_entries_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_routing_policies: {
|
|
Row: {
|
|
channel_session_id: string
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_routing_policies_organization_id_channel_session_i_fkey"
|
|
columns: ["organization_id", "channel_session_id"]
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["organization_id", "id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_routing_policies_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_routing_responsibles: {
|
|
Row: {
|
|
created_at: string
|
|
organization_id: string
|
|
policy_id: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
organization_id: string
|
|
policy_id: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
organization_id?: string
|
|
policy_id?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_routing_responsibles_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_routing_responsibles_organization_id_policy_id_fkey"
|
|
columns: ["organization_id", "policy_id"]
|
|
referencedRelation: "channel_routing_policies"
|
|
referencedColumns: ["organization_id", "id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_routing_responsibles_organization_id_user_id_fkey"
|
|
columns: ["organization_id", "user_id"]
|
|
referencedRelation: "user_organizations"
|
|
referencedColumns: ["organization_id", "user_id"]
|
|
},
|
|
]
|
|
}
|
|
channel_connection_requests: {
|
|
Row: {
|
|
channel_session_id: string | null
|
|
created_at: string
|
|
id: string
|
|
idempotency_key: string
|
|
lease_token: string
|
|
lease_until: string
|
|
organization_id: string
|
|
remote_created: boolean
|
|
request_hash: string
|
|
state: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
idempotency_key: string
|
|
lease_token?: string
|
|
lease_until?: string
|
|
organization_id: string
|
|
remote_created?: boolean
|
|
request_hash: string
|
|
state?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
idempotency_key?: string
|
|
lease_token?: string
|
|
lease_until?: string
|
|
organization_id?: string
|
|
remote_created?: boolean
|
|
request_hash?: string
|
|
state?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_connection_requests_organization_id_channel_sessio_fkey"
|
|
columns: ["organization_id", "channel_session_id"]
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["organization_id", "id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_connection_requests_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
|
|
appointment_recovery_receipts: {
|
|
Row: { organization_id: string; appointment_id: string; appointment_revision: number; source_event_id: string | null; result: string; pointer_id: string | null; enrollment_id: string | null; recorded_at: string; invalidated_at: string | null }
|
|
Insert: { organization_id: string; appointment_id: string; appointment_revision: number; source_event_id?: string | null; result: string; pointer_id?: string | null; enrollment_id?: string | null; recorded_at?: string; invalidated_at?: string | null }
|
|
Update: { organization_id?: string; appointment_id?: string; appointment_revision?: number; source_event_id?: string | null; result?: string; pointer_id?: string | null; enrollment_id?: string | null; recorded_at?: string; invalidated_at?: string | null }
|
|
Relationships: [
|
|
{ foreignKeyName: "appointment_recovery_receipts_organization_id_fkey"; columns: ["organization_id"]; isOneToOne: false; referencedRelation: "organizations"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "appointment_recovery_receipts_appointment_id_fkey"; columns: ["appointment_id"]; isOneToOne: false; referencedRelation: "calendar_appointments"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "appointment_recovery_receipts_source_event_id_fkey"; columns: ["source_event_id"]; isOneToOne: false; referencedRelation: "event_log"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "appointment_recovery_receipts_pointer_id_fkey"; columns: ["pointer_id"]; isOneToOne: false; referencedRelation: "followup_flow_pointers"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "appointment_recovery_receipts_enrollment_id_fkey"; columns: ["enrollment_id"]; isOneToOne: false; referencedRelation: "followup_enrollments"; referencedColumns: ["id"] }
|
|
]
|
|
}
|
|
event_service_origins: {
|
|
Row: { event_id: string; channel_session_id: string; organization_id: string; service_boundary: Json }
|
|
Insert: { event_id: string; channel_session_id: string; organization_id: string; service_boundary: Json }
|
|
Update: { event_id?: string; channel_session_id?: string; organization_id?: string; service_boundary?: Json }
|
|
Relationships: [
|
|
{ foreignKeyName: "event_service_origins_channel_session_id_fkey"; columns: ["channel_session_id"]; isOneToOne: false; referencedRelation: "channel_sessions"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "event_service_origins_event_id_fkey"; columns: ["event_id"]; isOneToOne: false; referencedRelation: "event_log"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "event_service_origins_organization_id_fkey"; columns: ["organization_id"]; isOneToOne: false; referencedRelation: "organizations"; referencedColumns: ["id"] }
|
|
]
|
|
}
|
|
|
|
platform_support_sessions: {
|
|
Row: { id: string; organization_id: string; actor_user_id: string; auth_session_id: string; access_mode: string; previous_organization_id: string | null; created_at: string; expires_at: string; ended_at: string | null }
|
|
Insert: { id?: string; organization_id: string; actor_user_id: string; auth_session_id: string; access_mode: string; previous_organization_id?: string | null; created_at?: string; expires_at: string; ended_at?: string | null }
|
|
Update: { id?: string; organization_id?: string; actor_user_id?: string; auth_session_id?: string; access_mode?: string; previous_organization_id?: string | null; created_at?: string; expires_at?: string; ended_at?: string | null }
|
|
Relationships: [{ foreignKeyName: "platform_support_sessions_organization_id_fkey"; columns: ["organization_id"]; isOneToOne: false; referencedRelation: "organizations"; referencedColumns: ["id"] }]
|
|
}
|
|
ad_conversion_dispatches: {
|
|
Row: {
|
|
attempted_at: string
|
|
created_at: string
|
|
currency: string | null
|
|
detail: string | null
|
|
event_id: string | null
|
|
event_name: string
|
|
event_occurred_at: string | null
|
|
google_action_id: string | null
|
|
id: string
|
|
lead_id: string
|
|
organization_id: string
|
|
platform: string
|
|
reason: string | null
|
|
remote_request_id: string | null
|
|
remote_requested_at: string | null
|
|
status: string
|
|
updated_at: string
|
|
value_cents: number | null
|
|
}
|
|
Insert: {
|
|
attempted_at?: string
|
|
created_at?: string
|
|
currency?: string | null
|
|
detail?: string | null
|
|
event_id?: string | null
|
|
event_name: string
|
|
event_occurred_at?: string | null
|
|
google_action_id?: string | null
|
|
id?: string
|
|
lead_id: string
|
|
organization_id: string
|
|
platform: string
|
|
reason?: string | null
|
|
remote_request_id?: string | null
|
|
remote_requested_at?: string | null
|
|
status: string
|
|
updated_at?: string
|
|
value_cents?: number | null
|
|
}
|
|
Update: {
|
|
attempted_at?: string
|
|
created_at?: string
|
|
currency?: string | null
|
|
detail?: string | null
|
|
event_id?: string | null
|
|
event_name?: string
|
|
event_occurred_at?: string | null
|
|
google_action_id?: string | null
|
|
id?: string
|
|
lead_id?: string
|
|
organization_id?: string
|
|
platform?: string
|
|
reason?: string | null
|
|
remote_request_id?: string | null
|
|
remote_requested_at?: string | null
|
|
status?: string
|
|
updated_at?: string
|
|
value_cents?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ad_conversion_dispatches_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ad_conversion_dispatches_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ad_platform_connections: {
|
|
Row: {
|
|
access_token_encrypted: string | null
|
|
created_at: string
|
|
dataset_id: string | null
|
|
enabled: boolean
|
|
google_api: string
|
|
google_conversion_action_id: string | null
|
|
google_customer_id: string | null
|
|
google_login_customer_id: string | null
|
|
google_qualification_action_id: string | null
|
|
google_qualification_configured_at: string | null
|
|
google_qualification_stage_id: string | null
|
|
google_refresh_token_encrypted: string | null
|
|
id: string
|
|
organization_id: string
|
|
platform: string
|
|
test_event_code: string | null
|
|
updated_at: string
|
|
updated_by: string | null
|
|
|
|
google_send_hashed_phone: boolean
|
|
|
|
google_purchase_value_mode: string
|
|
|
|
google_purchase_category: string
|
|
}
|
|
Insert: {
|
|
access_token_encrypted?: string | null
|
|
created_at?: string
|
|
dataset_id?: string | null
|
|
enabled?: boolean
|
|
google_api?: string
|
|
google_conversion_action_id?: string | null
|
|
google_customer_id?: string | null
|
|
google_login_customer_id?: string | null
|
|
google_qualification_action_id?: string | null
|
|
google_qualification_configured_at?: string | null
|
|
google_qualification_stage_id?: string | null
|
|
google_refresh_token_encrypted?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
platform: string
|
|
test_event_code?: string | null
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
|
|
google_send_hashed_phone?: boolean
|
|
|
|
google_purchase_value_mode?: string
|
|
|
|
google_purchase_category?: string
|
|
}
|
|
Update: {
|
|
access_token_encrypted?: string | null
|
|
created_at?: string
|
|
dataset_id?: string | null
|
|
enabled?: boolean
|
|
google_api?: string
|
|
google_conversion_action_id?: string | null
|
|
google_customer_id?: string | null
|
|
google_login_customer_id?: string | null
|
|
google_qualification_action_id?: string | null
|
|
google_qualification_configured_at?: string | null
|
|
google_qualification_stage_id?: string | null
|
|
google_refresh_token_encrypted?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
platform?: string
|
|
test_event_code?: string | null
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
|
|
google_send_hashed_phone?: boolean
|
|
|
|
google_purchase_value_mode?: string
|
|
|
|
google_purchase_category?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ad_platform_connections_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ad_qualification_stage_org_fk"
|
|
columns: ["organization_id", "google_qualification_stage_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_stages"
|
|
referencedColumns: ["organization_id", "id"]
|
|
},
|
|
]
|
|
}
|
|
agent_case_chat_messages: {
|
|
Row: {
|
|
agent_id: string | null
|
|
author_kind: string
|
|
author_user_id: string | null
|
|
body: string | null
|
|
case_id: string
|
|
contact_id: string
|
|
conversation_id: string
|
|
created_at: string
|
|
error_code: string | null
|
|
id: string
|
|
llm_call_id: string | null
|
|
organization_id: string
|
|
redacted_at: string | null
|
|
service_stale: boolean
|
|
turn_id: string
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
author_kind: string
|
|
author_user_id?: string | null
|
|
body?: string | null
|
|
case_id: string
|
|
contact_id: string
|
|
conversation_id: string
|
|
created_at?: string
|
|
error_code?: string | null
|
|
id?: string
|
|
llm_call_id?: string | null
|
|
organization_id: string
|
|
redacted_at?: string | null
|
|
service_stale?: boolean
|
|
turn_id: string
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
author_kind?: string
|
|
author_user_id?: string | null
|
|
body?: string | null
|
|
case_id?: string
|
|
contact_id?: string
|
|
conversation_id?: string
|
|
created_at?: string
|
|
error_code?: string | null
|
|
id?: string
|
|
llm_call_id?: string | null
|
|
organization_id?: string
|
|
redacted_at?: string | null
|
|
service_stale?: boolean
|
|
turn_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "agent_case_chat_messages_case_id_fkey"
|
|
columns: ["case_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "agent_cases"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_case_chat_messages_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_case_chat_messages_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_case_chat_messages_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
agent_case_events: {
|
|
Row: {
|
|
actor_kind: string
|
|
actor_user_id: string | null
|
|
body: string | null
|
|
case_id: string
|
|
created_at: string
|
|
human_action: string | null
|
|
id: string
|
|
kind: string
|
|
metadata: Json
|
|
organization_id: string
|
|
}
|
|
Insert: {
|
|
actor_kind: string
|
|
actor_user_id?: string | null
|
|
body?: string | null
|
|
case_id: string
|
|
created_at?: string
|
|
human_action?: string | null
|
|
id?: string
|
|
kind: string
|
|
metadata?: Json
|
|
organization_id: string
|
|
}
|
|
Update: {
|
|
actor_kind?: string
|
|
actor_user_id?: string | null
|
|
body?: string | null
|
|
case_id?: string
|
|
created_at?: string
|
|
human_action?: string | null
|
|
id?: string
|
|
kind?: string
|
|
metadata?: Json
|
|
organization_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "agent_case_events_case_id_fkey"
|
|
columns: ["case_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "agent_cases"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_case_events_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
agent_cases: {
|
|
Row: {
|
|
agent_id: string | null
|
|
blocker: string
|
|
closed_at: string | null
|
|
context_snapshot: Json
|
|
conversation_id: string
|
|
created_at: string
|
|
followup_attempts: number
|
|
id: string
|
|
lead_id: string | null
|
|
opened_at: string
|
|
organization_id: string
|
|
source: string
|
|
status: string
|
|
summary: string
|
|
title: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
blocker: string
|
|
closed_at?: string | null
|
|
context_snapshot?: Json
|
|
conversation_id: string
|
|
created_at?: string
|
|
followup_attempts?: number
|
|
id?: string
|
|
lead_id?: string | null
|
|
opened_at?: string
|
|
organization_id: string
|
|
source?: string
|
|
status?: string
|
|
summary: string
|
|
title: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
blocker?: string
|
|
closed_at?: string | null
|
|
context_snapshot?: Json
|
|
conversation_id?: string
|
|
created_at?: string
|
|
followup_attempts?: number
|
|
id?: string
|
|
lead_id?: string | null
|
|
opened_at?: string
|
|
organization_id?: string
|
|
source?: string
|
|
status?: string
|
|
summary?: string
|
|
title?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "agent_cases_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_cases_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_cases_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "agent_cases_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
agent_inbox_items: {
|
|
Row: {
|
|
appointment_revision: number | null
|
|
body: string | null
|
|
created_at: string
|
|
id: string
|
|
legacy_recovery_code: string | null
|
|
kind: string
|
|
organization_id: string | null
|
|
ref_id: string | null
|
|
ref_kind: string | null
|
|
resolved_at: string | null
|
|
severity: string
|
|
status: string
|
|
title: string
|
|
}
|
|
Insert: {
|
|
appointment_revision?: number | null
|
|
body?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
legacy_recovery_code?: string | null
|
|
kind: string
|
|
organization_id?: string | null
|
|
ref_id?: string | null
|
|
ref_kind?: string | null
|
|
resolved_at?: string | null
|
|
severity?: string
|
|
status?: string
|
|
title: string
|
|
}
|
|
Update: {
|
|
appointment_revision?: number | null
|
|
body?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
legacy_recovery_code?: string | null
|
|
kind?: string
|
|
organization_id?: string | null
|
|
ref_id?: string | null
|
|
ref_kind?: string | null
|
|
resolved_at?: string | null
|
|
severity?: string
|
|
status?: string
|
|
title?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "agent_inbox_items_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_agent_runs: {
|
|
Row: {
|
|
abort_reason: string | null
|
|
agent_id: string
|
|
agent_version_id: string
|
|
channel_session_id: string | null
|
|
completed_at: string | null
|
|
contact_id: string | null
|
|
conversation_id: string | null
|
|
cost_cents: number
|
|
created_at: string
|
|
error_code: string | null
|
|
error_message: string | null
|
|
id: string
|
|
inbound_message_id: string | null
|
|
is_dry_run: boolean
|
|
latency_ms: number | null
|
|
organization_id: string
|
|
outbound_message_id: string | null
|
|
started_at: string
|
|
status: string
|
|
steps_count: number
|
|
tokens_in: number
|
|
tokens_out: number
|
|
tool_calls: Json
|
|
}
|
|
Insert: {
|
|
abort_reason?: string | null
|
|
agent_id: string
|
|
agent_version_id: string
|
|
channel_session_id?: string | null
|
|
completed_at?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
cost_cents?: number
|
|
created_at?: string
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
id?: string
|
|
inbound_message_id?: string | null
|
|
is_dry_run?: boolean
|
|
latency_ms?: number | null
|
|
organization_id: string
|
|
outbound_message_id?: string | null
|
|
started_at?: string
|
|
status?: string
|
|
steps_count?: number
|
|
tokens_in?: number
|
|
tokens_out?: number
|
|
tool_calls?: Json
|
|
}
|
|
Update: {
|
|
abort_reason?: string | null
|
|
agent_id?: string
|
|
agent_version_id?: string
|
|
channel_session_id?: string | null
|
|
completed_at?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
cost_cents?: number
|
|
created_at?: string
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
id?: string
|
|
inbound_message_id?: string | null
|
|
is_dry_run?: boolean
|
|
latency_ms?: number | null
|
|
organization_id?: string
|
|
outbound_message_id?: string | null
|
|
started_at?: string
|
|
status?: string
|
|
steps_count?: number
|
|
tokens_in?: number
|
|
tokens_out?: number
|
|
tool_calls?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_agent_runs_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_agent_version_id_fkey"
|
|
columns: ["agent_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agent_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_inbound_message_id_fkey"
|
|
columns: ["inbound_message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_runs_outbound_message_id_fkey"
|
|
columns: ["outbound_message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_agent_versions: {
|
|
Row: {
|
|
provisioning_origin: string | null
|
|
agent_id: string
|
|
cases_enabled: boolean
|
|
channel_session_id: string | null
|
|
cost_budget_cents: number
|
|
created_at: string
|
|
created_by: string | null
|
|
credential_id: string | null
|
|
followup: Json
|
|
handoff_keywords: string[]
|
|
handoff_tool_enabled: boolean
|
|
proposal_ai_draft_enabled: boolean
|
|
history_message_window: number
|
|
history_token_window: number
|
|
id: string
|
|
inbound_debounce_ms: number | null
|
|
knowledge_source_ids: string[]
|
|
max_steps: number
|
|
model: string
|
|
multimodal_input: boolean
|
|
operator_enabled: boolean
|
|
operator_model: string | null
|
|
operator_tool_ids: string[]
|
|
organization_id: string
|
|
pipeline_ids: string[]
|
|
provider: string
|
|
published_at: string | null
|
|
split_max_chars: number
|
|
split_messages: boolean
|
|
status: string
|
|
superseded_at: string | null
|
|
system_prompt: string
|
|
token_budget: number
|
|
tool_ids: string[]
|
|
trigger_config: Json
|
|
version_number: number
|
|
video_frames_enabled: boolean
|
|
}
|
|
Insert: {
|
|
provisioning_origin?: string | null
|
|
agent_id: string
|
|
cases_enabled?: boolean
|
|
channel_session_id: string | null
|
|
cost_budget_cents?: number
|
|
created_at?: string
|
|
created_by?: string | null
|
|
credential_id?: string | null
|
|
followup?: Json
|
|
handoff_keywords?: string[]
|
|
handoff_tool_enabled?: boolean
|
|
proposal_ai_draft_enabled?: boolean
|
|
history_message_window?: number
|
|
history_token_window?: number
|
|
id?: string
|
|
inbound_debounce_ms?: number | null
|
|
knowledge_source_ids?: string[]
|
|
max_steps?: number
|
|
model: string
|
|
multimodal_input?: boolean
|
|
operator_enabled?: boolean
|
|
operator_model?: string | null
|
|
operator_tool_ids?: string[]
|
|
organization_id: string
|
|
pipeline_ids?: string[]
|
|
provider: string
|
|
published_at?: string | null
|
|
split_max_chars?: number
|
|
split_messages?: boolean
|
|
status?: string
|
|
superseded_at?: string | null
|
|
system_prompt: string
|
|
token_budget?: number
|
|
tool_ids?: string[]
|
|
trigger_config?: Json
|
|
version_number: number
|
|
video_frames_enabled?: boolean
|
|
}
|
|
Update: {
|
|
provisioning_origin?: string | null
|
|
agent_id?: string
|
|
cases_enabled?: boolean
|
|
channel_session_id?: string | null
|
|
cost_budget_cents?: number
|
|
created_at?: string
|
|
created_by?: string | null
|
|
credential_id?: string | null
|
|
followup?: Json
|
|
handoff_keywords?: string[]
|
|
handoff_tool_enabled?: boolean
|
|
proposal_ai_draft_enabled?: boolean
|
|
history_message_window?: number
|
|
history_token_window?: number
|
|
id?: string
|
|
inbound_debounce_ms?: number | null
|
|
knowledge_source_ids?: string[]
|
|
max_steps?: number
|
|
model?: string
|
|
multimodal_input?: boolean
|
|
operator_enabled?: boolean
|
|
operator_model?: string | null
|
|
operator_tool_ids?: string[]
|
|
organization_id?: string
|
|
pipeline_ids?: string[]
|
|
provider?: string
|
|
published_at?: string | null
|
|
split_max_chars?: number
|
|
split_messages?: boolean
|
|
status?: string
|
|
superseded_at?: string | null
|
|
system_prompt?: string
|
|
token_budget?: number
|
|
tool_ids?: string[]
|
|
trigger_config?: Json
|
|
version_number?: number
|
|
video_frames_enabled?: boolean
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_agent_versions_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_versions_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_versions_credential_id_fkey"
|
|
columns: ["credential_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_provider_credentials"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_versions_credential_id_fkey"
|
|
columns: ["credential_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_provider_credentials_safe"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agent_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_agents: {
|
|
Row: {
|
|
operation_mode: string
|
|
paused_at: string | null
|
|
operation_revision: number
|
|
active_kb_version_id: string | null
|
|
archived_at: string | null
|
|
config: Json
|
|
created_at: string
|
|
created_by: string | null
|
|
description: string | null
|
|
guardrails: Json
|
|
id: string
|
|
is_active: boolean
|
|
is_default: boolean
|
|
kind: string
|
|
model: string
|
|
name: string
|
|
organization_id: string
|
|
priority: number
|
|
published_version_id: string | null
|
|
system_prompt: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
operation_mode?: string
|
|
paused_at?: string | null
|
|
operation_revision?: number
|
|
active_kb_version_id?: string | null
|
|
archived_at?: string | null
|
|
config?: Json
|
|
created_at?: string
|
|
created_by?: string | null
|
|
description?: string | null
|
|
guardrails?: Json
|
|
id?: string
|
|
is_active?: boolean
|
|
is_default?: boolean
|
|
kind?: string
|
|
model?: string
|
|
name: string
|
|
organization_id: string
|
|
priority?: number
|
|
published_version_id?: string | null
|
|
system_prompt: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
operation_mode?: string
|
|
paused_at?: string | null
|
|
operation_revision?: number
|
|
active_kb_version_id?: string | null
|
|
archived_at?: string | null
|
|
config?: Json
|
|
created_at?: string
|
|
created_by?: string | null
|
|
description?: string | null
|
|
guardrails?: Json
|
|
id?: string
|
|
is_active?: boolean
|
|
is_default?: boolean
|
|
kind?: string
|
|
model?: string
|
|
name?: string
|
|
organization_id?: string
|
|
priority?: number
|
|
published_version_id?: string | null
|
|
system_prompt?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_agents_active_kb_version_id_fkey"
|
|
columns: ["active_kb_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agents_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_agents_published_version_id_fkey"
|
|
columns: ["published_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agent_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_budgets: {
|
|
Row: {
|
|
action_at_100pct: string
|
|
alarm_threshold_pct: number
|
|
current_month_consumed_cents: number
|
|
current_period_start: string
|
|
enforcement_effective_at: string | null
|
|
enforcement_mode: string
|
|
is_disabled: boolean
|
|
is_throttled: boolean
|
|
last_alarm_sent_at: string | null
|
|
monthly_limit_cents: number
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
action_at_100pct?: string
|
|
alarm_threshold_pct?: number
|
|
current_month_consumed_cents?: number
|
|
current_period_start?: string
|
|
enforcement_effective_at?: string | null
|
|
enforcement_mode?: string
|
|
is_disabled?: boolean
|
|
is_throttled?: boolean
|
|
last_alarm_sent_at?: string | null
|
|
monthly_limit_cents?: number
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
action_at_100pct?: string
|
|
alarm_threshold_pct?: number
|
|
current_month_consumed_cents?: number
|
|
current_period_start?: string
|
|
enforcement_effective_at?: string | null
|
|
enforcement_mode?: string
|
|
is_disabled?: boolean
|
|
is_throttled?: boolean
|
|
last_alarm_sent_at?: string | null
|
|
monthly_limit_cents?: number
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_budgets_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_chunks: {
|
|
Row: {
|
|
content: string
|
|
content_hash: string
|
|
created_at: string
|
|
embedding: string
|
|
id: string
|
|
kb_version_id: string
|
|
knowledge_source_id: string
|
|
metadata: Json
|
|
organization_id: string
|
|
position: number
|
|
token_count: number
|
|
}
|
|
Insert: {
|
|
content: string
|
|
content_hash: string
|
|
created_at?: string
|
|
embedding: string
|
|
id?: string
|
|
kb_version_id: string
|
|
knowledge_source_id: string
|
|
metadata?: Json
|
|
organization_id: string
|
|
position: number
|
|
token_count: number
|
|
}
|
|
Update: {
|
|
content?: string
|
|
content_hash?: string
|
|
created_at?: string
|
|
embedding?: string
|
|
id?: string
|
|
kb_version_id?: string
|
|
knowledge_source_id?: string
|
|
metadata?: Json
|
|
organization_id?: string
|
|
position?: number
|
|
token_count?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_chunks_kb_version_id_fkey"
|
|
columns: ["kb_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_chunks_knowledge_source_id_fkey"
|
|
columns: ["knowledge_source_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_sources"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_chunks_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_faq_items: {
|
|
Row: {
|
|
answer: string
|
|
created_at: string
|
|
id: string
|
|
knowledge_source_id: string
|
|
locale: string
|
|
organization_id: string
|
|
position: number
|
|
question: string
|
|
tags: string[]
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
answer: string
|
|
created_at?: string
|
|
id?: string
|
|
knowledge_source_id: string
|
|
locale?: string
|
|
organization_id: string
|
|
position?: number
|
|
question: string
|
|
tags?: string[]
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
answer?: string
|
|
created_at?: string
|
|
id?: string
|
|
knowledge_source_id?: string
|
|
locale?: string
|
|
organization_id?: string
|
|
position?: number
|
|
question?: string
|
|
tags?: string[]
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_faq_items_knowledge_source_id_fkey"
|
|
columns: ["knowledge_source_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_sources"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_faq_items_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_invocations: {
|
|
Row: {
|
|
agent_id: string | null
|
|
citations: Json
|
|
completion_tokens: number
|
|
conversation_id: string | null
|
|
cost_cents: number
|
|
created_at: string
|
|
error_payload: Json | null
|
|
finish_reason: string | null
|
|
id: string
|
|
invocation_kind: string
|
|
latency_ms: number
|
|
message_id: string | null
|
|
model: string
|
|
organization_id: string
|
|
prompt_blob_path: string | null
|
|
prompt_tokens: number
|
|
response_blob_path: string | null
|
|
total_tokens: number | null
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
citations?: Json
|
|
completion_tokens?: number
|
|
conversation_id?: string | null
|
|
cost_cents?: number
|
|
created_at?: string
|
|
error_payload?: Json | null
|
|
finish_reason?: string | null
|
|
id?: string
|
|
invocation_kind: string
|
|
latency_ms: number
|
|
message_id?: string | null
|
|
model: string
|
|
organization_id: string
|
|
prompt_blob_path?: string | null
|
|
prompt_tokens?: number
|
|
response_blob_path?: string | null
|
|
total_tokens?: number | null
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
citations?: Json
|
|
completion_tokens?: number
|
|
conversation_id?: string | null
|
|
cost_cents?: number
|
|
created_at?: string
|
|
error_payload?: Json | null
|
|
finish_reason?: string | null
|
|
id?: string
|
|
invocation_kind?: string
|
|
latency_ms?: number
|
|
message_id?: string | null
|
|
model?: string
|
|
organization_id?: string
|
|
prompt_blob_path?: string | null
|
|
prompt_tokens?: number
|
|
response_blob_path?: string | null
|
|
total_tokens?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_invocations_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_invocations_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_invocations_message_id_fkey"
|
|
columns: ["message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_invocations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_knowledge_sources: {
|
|
Row: {
|
|
active_kb_version_id: string | null
|
|
agent_id: string | null
|
|
chunks_count: number
|
|
content_hash: string | null
|
|
created_at: string
|
|
id: string
|
|
ingested_at: string | null
|
|
is_active: boolean
|
|
last_index_error: string | null
|
|
last_index_status: string | null
|
|
last_indexed_at: string | null
|
|
name: string
|
|
organization_id: string
|
|
source_metadata: Json
|
|
source_type: string
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
active_kb_version_id?: string | null
|
|
agent_id?: string | null
|
|
chunks_count?: number
|
|
content_hash?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
ingested_at?: string | null
|
|
is_active?: boolean
|
|
last_index_error?: string | null
|
|
last_index_status?: string | null
|
|
last_indexed_at?: string | null
|
|
name?: string
|
|
organization_id: string
|
|
source_metadata?: Json
|
|
source_type: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
active_kb_version_id?: string | null
|
|
agent_id?: string | null
|
|
chunks_count?: number
|
|
content_hash?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
ingested_at?: string | null
|
|
is_active?: boolean
|
|
last_index_error?: string | null
|
|
last_index_status?: string | null
|
|
last_indexed_at?: string | null
|
|
name?: string
|
|
organization_id?: string
|
|
source_metadata?: Json
|
|
source_type?: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_knowledge_sources_active_kb_version_id_fkey"
|
|
columns: ["active_kb_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_knowledge_sources_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_knowledge_sources_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_knowledge_versions: {
|
|
Row: {
|
|
activated_at: string | null
|
|
activated_by: string | null
|
|
agent_id: string | null
|
|
created_at: string
|
|
description: string | null
|
|
embedding_dims: number | null
|
|
embedding_model: string | null
|
|
error_message: string | null
|
|
id: string
|
|
indexed_at: string | null
|
|
is_active: boolean
|
|
knowledge_source_id: string | null
|
|
organization_id: string
|
|
sources_snapshot: Json
|
|
status: string | null
|
|
total_chunks: number
|
|
version_number: number
|
|
}
|
|
Insert: {
|
|
activated_at?: string | null
|
|
activated_by?: string | null
|
|
agent_id?: string | null
|
|
created_at?: string
|
|
description?: string | null
|
|
embedding_dims?: number | null
|
|
embedding_model?: string | null
|
|
error_message?: string | null
|
|
id?: string
|
|
indexed_at?: string | null
|
|
is_active?: boolean
|
|
knowledge_source_id?: string | null
|
|
organization_id: string
|
|
sources_snapshot?: Json
|
|
status?: string | null
|
|
total_chunks?: number
|
|
version_number: number
|
|
}
|
|
Update: {
|
|
activated_at?: string | null
|
|
activated_by?: string | null
|
|
agent_id?: string | null
|
|
created_at?: string
|
|
description?: string | null
|
|
embedding_dims?: number | null
|
|
embedding_model?: string | null
|
|
error_message?: string | null
|
|
id?: string
|
|
indexed_at?: string | null
|
|
is_active?: boolean
|
|
knowledge_source_id?: string | null
|
|
organization_id?: string
|
|
sources_snapshot?: Json
|
|
status?: string | null
|
|
total_chunks?: number
|
|
version_number?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_knowledge_versions_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_knowledge_versions_knowledge_source_id_fkey"
|
|
columns: ["knowledge_source_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_knowledge_sources"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_knowledge_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_models: {
|
|
Row: {
|
|
context_window: number | null
|
|
deprecated_at: string | null
|
|
description: string | null
|
|
display_name: string
|
|
embedding_dims: number | null
|
|
id: string
|
|
input_price_per_million_cents: number | null
|
|
is_default_for_provider: boolean
|
|
metadata: Json
|
|
model_id: string
|
|
output_price_per_million_cents: number | null
|
|
provider: string
|
|
released_at: string | null
|
|
source: string
|
|
supports_embedding: boolean
|
|
supports_tools: boolean
|
|
supports_vision: boolean
|
|
synced_at: string | null
|
|
}
|
|
Insert: {
|
|
context_window?: number | null
|
|
deprecated_at?: string | null
|
|
description?: string | null
|
|
display_name: string
|
|
embedding_dims?: number | null
|
|
id?: string
|
|
input_price_per_million_cents?: number | null
|
|
is_default_for_provider?: boolean
|
|
metadata?: Json
|
|
model_id: string
|
|
output_price_per_million_cents?: number | null
|
|
provider: string
|
|
released_at?: string | null
|
|
source?: string
|
|
supports_embedding?: boolean
|
|
supports_tools?: boolean
|
|
supports_vision?: boolean
|
|
synced_at?: string | null
|
|
}
|
|
Update: {
|
|
context_window?: number | null
|
|
deprecated_at?: string | null
|
|
description?: string | null
|
|
display_name?: string
|
|
embedding_dims?: number | null
|
|
id?: string
|
|
input_price_per_million_cents?: number | null
|
|
is_default_for_provider?: boolean
|
|
metadata?: Json
|
|
model_id?: string
|
|
output_price_per_million_cents?: number | null
|
|
provider?: string
|
|
released_at?: string | null
|
|
source?: string
|
|
supports_embedding?: boolean
|
|
supports_tools?: boolean
|
|
supports_vision?: boolean
|
|
synced_at?: string | null
|
|
}
|
|
Relationships: []
|
|
}
|
|
ai_pricing: {
|
|
Row: {
|
|
completion_cents_per_million_tokens: number | null
|
|
effective_from: string
|
|
embedding_cents_per_million_tokens: number | null
|
|
model: string
|
|
notes: string | null
|
|
prompt_cents_per_million_tokens: number | null
|
|
superseded_at: string | null
|
|
}
|
|
Insert: {
|
|
completion_cents_per_million_tokens?: number | null
|
|
effective_from?: string
|
|
embedding_cents_per_million_tokens?: number | null
|
|
model: string
|
|
notes?: string | null
|
|
prompt_cents_per_million_tokens?: number | null
|
|
superseded_at?: string | null
|
|
}
|
|
Update: {
|
|
completion_cents_per_million_tokens?: number | null
|
|
effective_from?: string
|
|
embedding_cents_per_million_tokens?: number | null
|
|
model?: string
|
|
notes?: string | null
|
|
prompt_cents_per_million_tokens?: number | null
|
|
superseded_at?: string | null
|
|
}
|
|
Relationships: []
|
|
}
|
|
ai_provider_credentials: {
|
|
Row: {
|
|
api_key_encrypted: string
|
|
api_key_iv: string
|
|
api_key_last4: string
|
|
api_key_tag: string
|
|
created_at: string
|
|
created_by: string | null
|
|
id: string
|
|
is_active: boolean
|
|
label: string
|
|
models_available: string[] | null
|
|
organization_id: string
|
|
provider: string
|
|
updated_at: string
|
|
validated_at: string | null
|
|
validation_error: string | null
|
|
}
|
|
Insert: {
|
|
api_key_encrypted: string
|
|
api_key_iv: string
|
|
api_key_last4: string
|
|
api_key_tag: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
label: string
|
|
models_available?: string[] | null
|
|
organization_id: string
|
|
provider: string
|
|
updated_at?: string
|
|
validated_at?: string | null
|
|
validation_error?: string | null
|
|
}
|
|
Update: {
|
|
api_key_encrypted?: string
|
|
api_key_iv?: string
|
|
api_key_last4?: string
|
|
api_key_tag?: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
label?: string
|
|
models_available?: string[] | null
|
|
organization_id?: string
|
|
provider?: string
|
|
updated_at?: string
|
|
validated_at?: string | null
|
|
validation_error?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_provider_credentials_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_purpose_bindings: {
|
|
Row: {
|
|
base_url: string | null
|
|
created_at: string
|
|
credential_id: string | null
|
|
id: string
|
|
is_enabled: boolean
|
|
model_id: string
|
|
organization_id: string
|
|
provider: string
|
|
purpose: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
base_url?: string | null
|
|
created_at?: string
|
|
credential_id?: string | null
|
|
id?: string
|
|
is_enabled?: boolean
|
|
model_id: string
|
|
organization_id: string
|
|
provider: string
|
|
purpose: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
base_url?: string | null
|
|
created_at?: string
|
|
credential_id?: string | null
|
|
id?: string
|
|
is_enabled?: boolean
|
|
model_id?: string
|
|
organization_id?: string
|
|
provider?: string
|
|
purpose?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_purpose_bindings_credential_id_fkey"
|
|
columns: ["credential_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_provider_credentials"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_purpose_bindings_credential_id_fkey"
|
|
columns: ["credential_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_provider_credentials_safe"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_purpose_bindings_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_router_decisions: {
|
|
Row: {
|
|
agent_id: string | null
|
|
confidence: number | null
|
|
conversation_id: string | null
|
|
created_at: string
|
|
id: string
|
|
intent_name: string | null
|
|
job_id: string | null
|
|
organization_id: string
|
|
outcome: string
|
|
router_id: string | null
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
confidence?: number | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
intent_name?: string | null
|
|
job_id?: string | null
|
|
organization_id: string
|
|
outcome: string
|
|
router_id?: string | null
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
confidence?: number | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
intent_name?: string | null
|
|
job_id?: string | null
|
|
organization_id?: string
|
|
outcome?: string
|
|
router_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_router_decisions_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_router_decisions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_router_decisions_router_id_fkey"
|
|
columns: ["router_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_routers"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_router_members: {
|
|
Row: {
|
|
agent_id: string
|
|
created_at: string
|
|
examples: string[]
|
|
flow_pointer_id: string | null
|
|
id: string
|
|
intent_description: string
|
|
intent_name: string
|
|
organization_id: string
|
|
position: number
|
|
router_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
agent_id: string
|
|
created_at?: string
|
|
examples?: string[]
|
|
flow_pointer_id?: string | null
|
|
id?: string
|
|
intent_description: string
|
|
intent_name: string
|
|
organization_id: string
|
|
position?: number
|
|
router_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
agent_id?: string
|
|
created_at?: string
|
|
examples?: string[]
|
|
flow_pointer_id?: string | null
|
|
id?: string
|
|
intent_description?: string
|
|
intent_name?: string
|
|
organization_id?: string
|
|
position?: number
|
|
router_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_router_members_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_router_members_flow_pointer_mesma_org"
|
|
columns: ["organization_id", "flow_pointer_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_flow_pointers"
|
|
referencedColumns: ["organization_id", "id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_router_members_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_router_members_router_id_fkey"
|
|
columns: ["router_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_routers"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
ai_routers: {
|
|
Row: {
|
|
channel_session_id: string
|
|
config: Json
|
|
created_at: string
|
|
created_by: string | null
|
|
fallback_agent_id: string | null
|
|
id: string
|
|
is_active: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
config?: Json
|
|
created_at?: string
|
|
created_by?: string | null
|
|
fallback_agent_id?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
name: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
config?: Json
|
|
created_at?: string
|
|
created_by?: string | null
|
|
fallback_agent_id?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_routers_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_routers_fallback_agent_id_fkey"
|
|
columns: ["fallback_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "ai_routers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
api_audit_log: {
|
|
Row: {
|
|
acting_as_platform_admin: boolean
|
|
action: string
|
|
actor_api_token_id: string | null
|
|
actor_ip: unknown
|
|
actor_user_agent: string | null
|
|
actor_user_id: string | null
|
|
bypassed_rls: boolean
|
|
created_at: string
|
|
id: string
|
|
metadata: Json
|
|
organization_id: string | null
|
|
request_id: string | null
|
|
resource_id: string | null
|
|
resource_type: string | null
|
|
}
|
|
Insert: {
|
|
acting_as_platform_admin?: boolean
|
|
action: string
|
|
actor_api_token_id?: string | null
|
|
actor_ip?: unknown
|
|
actor_user_agent?: string | null
|
|
actor_user_id?: string | null
|
|
bypassed_rls?: boolean
|
|
created_at?: string
|
|
id?: string
|
|
metadata?: Json
|
|
organization_id?: string | null
|
|
request_id?: string | null
|
|
resource_id?: string | null
|
|
resource_type?: string | null
|
|
}
|
|
Update: {
|
|
acting_as_platform_admin?: boolean
|
|
action?: string
|
|
actor_api_token_id?: string | null
|
|
actor_ip?: unknown
|
|
actor_user_agent?: string | null
|
|
actor_user_id?: string | null
|
|
bypassed_rls?: boolean
|
|
created_at?: string
|
|
id?: string
|
|
metadata?: Json
|
|
organization_id?: string | null
|
|
request_id?: string | null
|
|
resource_id?: string | null
|
|
resource_type?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "api_audit_log_actor_api_token_id_fkey"
|
|
columns: ["actor_api_token_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "api_tokens"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "api_audit_log_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
api_tokens: {
|
|
Row: {
|
|
created_at: string
|
|
created_by: string
|
|
expires_at: string | null
|
|
id: string
|
|
last_used_at: string | null
|
|
last_used_ip: unknown
|
|
name: string
|
|
organization_id: string
|
|
prefix: string
|
|
revoked_at: string | null
|
|
revoked_by: string | null
|
|
scopes: Json
|
|
token_hash: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
created_by: string
|
|
expires_at?: string | null
|
|
id?: string
|
|
last_used_at?: string | null
|
|
last_used_ip?: unknown
|
|
name: string
|
|
organization_id: string
|
|
prefix: string
|
|
revoked_at?: string | null
|
|
revoked_by?: string | null
|
|
scopes?: Json
|
|
token_hash: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
created_by?: string
|
|
expires_at?: string | null
|
|
id?: string
|
|
last_used_at?: string | null
|
|
last_used_ip?: unknown
|
|
name?: string
|
|
organization_id?: string
|
|
prefix?: string
|
|
revoked_at?: string | null
|
|
revoked_by?: string | null
|
|
scopes?: Json
|
|
token_hash?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "api_tokens_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
attendant_availability: {
|
|
Row: {
|
|
capacity: number
|
|
id: string
|
|
is_available: boolean
|
|
last_heartbeat_at: string | null
|
|
organization_id: string
|
|
schedule: Json
|
|
updated_at: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
capacity?: number
|
|
id?: string
|
|
is_available?: boolean
|
|
last_heartbeat_at?: string | null
|
|
organization_id: string
|
|
schedule?: Json
|
|
updated_at?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
capacity?: number
|
|
id?: string
|
|
is_available?: boolean
|
|
last_heartbeat_at?: string | null
|
|
organization_id?: string
|
|
schedule?: Json
|
|
updated_at?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "attendant_availability_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
automation_rule_runs: {
|
|
Row: {
|
|
actions_result: Json
|
|
created_at: string
|
|
error: string | null
|
|
event_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
rule_id: string
|
|
status: string
|
|
}
|
|
Insert: {
|
|
actions_result?: Json
|
|
created_at?: string
|
|
error?: string | null
|
|
event_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
rule_id: string
|
|
status: string
|
|
}
|
|
Update: {
|
|
actions_result?: Json
|
|
created_at?: string
|
|
error?: string | null
|
|
event_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
rule_id?: string
|
|
status?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "automation_rule_runs_event_id_fkey"
|
|
columns: ["event_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "event_log"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "automation_rule_runs_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "automation_rule_runs_rule_id_fkey"
|
|
columns: ["rule_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "automation_rules"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
automation_rules: {
|
|
Row: {
|
|
actions: Json
|
|
conditions: Json
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
id: string
|
|
is_active: boolean
|
|
last_change_actor_kind: string | null
|
|
last_change_at: string | null
|
|
last_run_at: string | null
|
|
name: string
|
|
organization_id: string
|
|
run_count: number
|
|
trigger_config: Json
|
|
trigger_event: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
actions?: Json
|
|
conditions?: Json
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
last_run_at?: string | null
|
|
name: string
|
|
organization_id: string
|
|
run_count?: number
|
|
trigger_config?: Json
|
|
trigger_event: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
actions?: Json
|
|
conditions?: Json
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
last_run_at?: string | null
|
|
name?: string
|
|
organization_id?: string
|
|
run_count?: number
|
|
trigger_config?: Json
|
|
trigger_event?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "automation_rules_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
before_send_traces: {
|
|
Row: {
|
|
channel_session_id: string
|
|
contact_id: string | null
|
|
created_at: string
|
|
id: string
|
|
job_id: string
|
|
organization_id: string
|
|
trace: Json
|
|
vetoed_code: string | null
|
|
vetoed_gate: string | null
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
job_id: string
|
|
organization_id: string
|
|
trace: Json
|
|
vetoed_code?: string | null
|
|
vetoed_gate?: string | null
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
job_id?: string
|
|
organization_id?: string
|
|
trace?: Json
|
|
vetoed_code?: string | null
|
|
vetoed_gate?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "before_send_traces_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "before_send_traces_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "before_send_traces_job_id_fkey"
|
|
columns: ["job_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "job_queue"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "before_send_traces_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_appointments: {
|
|
Row: {
|
|
meeting_state: string
|
|
meeting_request_id: string | null
|
|
meeting_requested_at: string | null
|
|
meeting_received_at: string | null
|
|
meeting_ready_at: string | null
|
|
meeting_attempts: number
|
|
meeting_last_error: string | null
|
|
meeting_next_attempt_at: string | null
|
|
meeting_delivery: Json
|
|
meeting_delivery_job_id: string | null
|
|
|
|
google_local_revision: number
|
|
google_synced_local_revision: number
|
|
google_etag: string | null
|
|
google_base_projection: Json | null
|
|
google_conflict: Json | null
|
|
google_pending_write: Json | null
|
|
google_claim_token: string | null
|
|
google_claim_epoch: number
|
|
google_claim_until: string | null
|
|
google_next_attempt_at: string
|
|
revision: number
|
|
revision_started_at: string
|
|
outcome_source_kind: string | null
|
|
outcome_user_id: string | null
|
|
outcome_message_id: string | null
|
|
outcome_recorded_at: string | null
|
|
confirmation_next_at: string | null
|
|
cancellation_reason: string | null
|
|
cancelled_at: string | null
|
|
contact_id: string | null
|
|
conversation_id: string | null
|
|
created_at: string
|
|
created_by_agent_id: string | null
|
|
created_by_kind: string
|
|
created_by_user_id: string | null
|
|
description: string | null
|
|
ends_at: string
|
|
event_type_id: string | null
|
|
google_calendar_id: string | null
|
|
google_connection_id: string | null
|
|
google_event_id: string | null
|
|
google_ical_uid: string | null
|
|
google_sequence: number
|
|
google_sync_error: string | null
|
|
google_synced_at: string | null
|
|
guest_email: string | null
|
|
id: string
|
|
location_details: string | null
|
|
location_kind: string
|
|
meeting_url: string | null
|
|
needs_google_push: boolean | null
|
|
notes: string | null
|
|
organization_id: string
|
|
owner_user_id: string | null
|
|
reminder_sent_at: string | null
|
|
reminder_sent_offsets_minutes: number[]
|
|
rescheduled_from_id: string | null
|
|
source: string
|
|
starts_at: string
|
|
status: string
|
|
time_zone: string
|
|
title: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
meeting_state?: string
|
|
meeting_request_id?: string | null
|
|
meeting_requested_at?: string | null
|
|
meeting_received_at?: string | null
|
|
meeting_ready_at?: string | null
|
|
meeting_attempts?: number
|
|
meeting_last_error?: string | null
|
|
meeting_next_attempt_at?: string | null
|
|
meeting_delivery?: Json
|
|
meeting_delivery_job_id?: string | null
|
|
|
|
google_local_revision?: number
|
|
google_synced_local_revision?: number
|
|
google_etag?: string | null
|
|
google_base_projection?: Json | null
|
|
google_conflict?: Json | null
|
|
google_pending_write?: Json | null
|
|
google_claim_token?: string | null
|
|
google_claim_epoch?: number
|
|
google_claim_until?: string | null
|
|
google_next_attempt_at?: string
|
|
revision?: number
|
|
revision_started_at?: string
|
|
outcome_source_kind?: string | null
|
|
outcome_user_id?: string | null
|
|
outcome_message_id?: string | null
|
|
outcome_recorded_at?: string | null
|
|
confirmation_next_at?: string | null
|
|
cancellation_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
created_by_agent_id?: string | null
|
|
created_by_kind?: string
|
|
created_by_user_id?: string | null
|
|
description?: string | null
|
|
ends_at: string
|
|
event_type_id?: string | null
|
|
google_calendar_id?: string | null
|
|
google_connection_id?: string | null
|
|
google_event_id?: string | null
|
|
google_ical_uid?: string | null
|
|
google_sequence?: number
|
|
google_sync_error?: string | null
|
|
google_synced_at?: string | null
|
|
guest_email?: string | null
|
|
id?: string
|
|
location_details?: string | null
|
|
location_kind?: string
|
|
meeting_url?: string | null
|
|
needs_google_push?: boolean | null
|
|
notes?: string | null
|
|
organization_id: string
|
|
owner_user_id?: string | null
|
|
reminder_sent_at?: string | null
|
|
reminder_sent_offsets_minutes?: number[]
|
|
rescheduled_from_id?: string | null
|
|
source?: string
|
|
starts_at: string
|
|
status?: string
|
|
time_zone?: string
|
|
title: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
meeting_state?: string
|
|
meeting_request_id?: string | null
|
|
meeting_requested_at?: string | null
|
|
meeting_received_at?: string | null
|
|
meeting_ready_at?: string | null
|
|
meeting_attempts?: number
|
|
meeting_last_error?: string | null
|
|
meeting_next_attempt_at?: string | null
|
|
meeting_delivery?: Json
|
|
meeting_delivery_job_id?: string | null
|
|
|
|
google_local_revision?: number
|
|
google_synced_local_revision?: number
|
|
google_etag?: string | null
|
|
google_base_projection?: Json | null
|
|
google_conflict?: Json | null
|
|
google_pending_write?: Json | null
|
|
google_claim_token?: string | null
|
|
google_claim_epoch?: number
|
|
google_claim_until?: string | null
|
|
google_next_attempt_at?: string
|
|
revision?: number
|
|
revision_started_at?: string
|
|
outcome_source_kind?: string | null
|
|
outcome_user_id?: string | null
|
|
outcome_message_id?: string | null
|
|
outcome_recorded_at?: string | null
|
|
confirmation_next_at?: string | null
|
|
cancellation_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
created_by_agent_id?: string | null
|
|
created_by_kind?: string
|
|
created_by_user_id?: string | null
|
|
description?: string | null
|
|
ends_at?: string
|
|
event_type_id?: string | null
|
|
google_calendar_id?: string | null
|
|
google_connection_id?: string | null
|
|
google_event_id?: string | null
|
|
google_ical_uid?: string | null
|
|
google_sequence?: number
|
|
google_sync_error?: string | null
|
|
google_synced_at?: string | null
|
|
guest_email?: string | null
|
|
id?: string
|
|
location_details?: string | null
|
|
location_kind?: string
|
|
meeting_url?: string | null
|
|
needs_google_push?: boolean | null
|
|
notes?: string | null
|
|
organization_id?: string
|
|
owner_user_id?: string | null
|
|
reminder_sent_at?: string | null
|
|
reminder_sent_offsets_minutes?: number[]
|
|
rescheduled_from_id?: string | null
|
|
source?: string
|
|
starts_at?: string
|
|
status?: string
|
|
time_zone?: string
|
|
title?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{ foreignKeyName: "calendar_appointments_meeting_delivery_job_id_fkey"; columns: ["meeting_delivery_job_id"]; isOneToOne: false; referencedRelation: "job_queue"; referencedColumns: ["id"] },
|
|
{ foreignKeyName: "calendar_appointments_outcome_message_id_fkey"; columns: ["outcome_message_id"]; isOneToOne: false; referencedRelation: "messages"; referencedColumns: ["id"] },
|
|
{
|
|
foreignKeyName: "calendar_appointments_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_created_by_agent_id_fkey"
|
|
columns: ["created_by_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_event_type_id_fkey"
|
|
columns: ["event_type_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "calendar_event_types"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_google_connection_id_fkey"
|
|
columns: ["google_connection_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "calendar_connections"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_appointments_rescheduled_from_id_fkey"
|
|
columns: ["rescheduled_from_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "calendar_appointments"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_availability_exceptions: {
|
|
Row: {
|
|
created_at: string
|
|
end_minute: number
|
|
exception_date: string
|
|
id: string
|
|
is_unavailable: boolean
|
|
organization_id: string
|
|
reason: string | null
|
|
start_minute: number
|
|
updated_at: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
end_minute?: number
|
|
exception_date: string
|
|
id?: string
|
|
is_unavailable?: boolean
|
|
organization_id: string
|
|
reason?: string | null
|
|
start_minute?: number
|
|
updated_at?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
end_minute?: number
|
|
exception_date?: string
|
|
id?: string
|
|
is_unavailable?: boolean
|
|
organization_id?: string
|
|
reason?: string | null
|
|
start_minute?: number
|
|
updated_at?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_availability_exceptions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_connection_calendars: {
|
|
Row: {
|
|
allowed_conference_types: string[] | null
|
|
access_role: string | null
|
|
available: boolean
|
|
catalog_checked_at: string | null
|
|
sync_claim_token: string | null
|
|
sync_claim_epoch: number
|
|
sync_claim_until: string | null
|
|
sync_next_attempt_at: string
|
|
last_sync_at: string | null
|
|
sync_error: string | null
|
|
sync_cursor: Json | null
|
|
sync_coverage: Json | null
|
|
connection_id: string
|
|
counts_for_conflicts: boolean
|
|
created_at: string
|
|
external_calendar_id: string
|
|
id: string
|
|
is_destination: boolean
|
|
is_primary: boolean
|
|
name: string
|
|
organization_id: string
|
|
sync_token: string | null
|
|
time_zone: string | null
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
allowed_conference_types?: string[] | null
|
|
access_role?: string | null
|
|
available?: boolean
|
|
catalog_checked_at?: string | null
|
|
sync_claim_token?: string | null
|
|
sync_claim_epoch?: number
|
|
sync_claim_until?: string | null
|
|
sync_next_attempt_at?: string
|
|
last_sync_at?: string | null
|
|
sync_error?: string | null
|
|
sync_cursor?: Json | null
|
|
sync_coverage?: Json | null
|
|
connection_id: string
|
|
counts_for_conflicts?: boolean
|
|
created_at?: string
|
|
external_calendar_id: string
|
|
id?: string
|
|
is_destination?: boolean
|
|
is_primary?: boolean
|
|
name: string
|
|
organization_id: string
|
|
sync_token?: string | null
|
|
time_zone?: string | null
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
allowed_conference_types?: string[] | null
|
|
access_role?: string | null
|
|
available?: boolean
|
|
catalog_checked_at?: string | null
|
|
sync_claim_token?: string | null
|
|
sync_claim_epoch?: number
|
|
sync_claim_until?: string | null
|
|
sync_next_attempt_at?: string
|
|
last_sync_at?: string | null
|
|
sync_error?: string | null
|
|
sync_cursor?: Json | null
|
|
sync_coverage?: Json | null
|
|
connection_id?: string
|
|
counts_for_conflicts?: boolean
|
|
created_at?: string
|
|
external_calendar_id?: string
|
|
id?: string
|
|
is_destination?: boolean
|
|
is_primary?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
sync_token?: string | null
|
|
time_zone?: string | null
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_connection_calendars_connection_id_fkey"
|
|
columns: ["connection_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "calendar_connections"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_connection_calendars_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_connections: {
|
|
Row: {
|
|
calendar_selection_revision: number
|
|
account_email: string
|
|
created_at: string
|
|
id: string
|
|
last_sync_at: string | null
|
|
last_sync_error: string | null
|
|
oauth_access_token_encrypted: string | null
|
|
oauth_refresh_token_encrypted: string | null
|
|
organization_id: string
|
|
provider: string
|
|
scopes: string[]
|
|
status: string
|
|
sync_token: string | null
|
|
token_expires_at: string | null
|
|
updated_at: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
calendar_selection_revision?: number
|
|
account_email: string
|
|
created_at?: string
|
|
id?: string
|
|
last_sync_at?: string | null
|
|
last_sync_error?: string | null
|
|
oauth_access_token_encrypted?: string | null
|
|
oauth_refresh_token_encrypted?: string | null
|
|
organization_id: string
|
|
provider?: string
|
|
scopes?: string[]
|
|
status?: string
|
|
sync_token?: string | null
|
|
token_expires_at?: string | null
|
|
updated_at?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
calendar_selection_revision?: number
|
|
account_email?: string
|
|
created_at?: string
|
|
id?: string
|
|
last_sync_at?: string | null
|
|
last_sync_error?: string | null
|
|
oauth_access_token_encrypted?: string | null
|
|
oauth_refresh_token_encrypted?: string | null
|
|
organization_id?: string
|
|
provider?: string
|
|
scopes?: string[]
|
|
status?: string
|
|
sync_token?: string | null
|
|
token_expires_at?: string | null
|
|
updated_at?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_connections_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_event_types: {
|
|
Row: {
|
|
booking_window_days: number
|
|
buffer_after_minutes: number
|
|
buffer_before_minutes: number
|
|
category: string
|
|
created_at: string
|
|
default_owner_user_id: string | null
|
|
description: string | null
|
|
duration_minutes: number
|
|
id: string
|
|
is_active: boolean
|
|
location_details: string | null
|
|
location_kind: string
|
|
minimum_notice_minutes: number
|
|
name: string
|
|
organization_id: string
|
|
position: number
|
|
reminder_body: string | null
|
|
reminder_bodies: Json
|
|
reminder_enabled: boolean
|
|
reminder_minutes_before: number
|
|
reminder_extra_offsets_minutes: number[]
|
|
default_price_cents: number | null
|
|
reminder_template_name: string | null
|
|
requires_confirmation: boolean
|
|
slot_interval_minutes: number | null
|
|
slug: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
booking_window_days?: number
|
|
buffer_after_minutes?: number
|
|
buffer_before_minutes?: number
|
|
category?: string
|
|
created_at?: string
|
|
default_owner_user_id?: string | null
|
|
description?: string | null
|
|
duration_minutes?: number
|
|
id?: string
|
|
is_active?: boolean
|
|
location_details?: string | null
|
|
location_kind?: string
|
|
minimum_notice_minutes?: number
|
|
name: string
|
|
organization_id: string
|
|
position?: number
|
|
reminder_body?: string | null
|
|
reminder_bodies?: Json
|
|
reminder_enabled?: boolean
|
|
reminder_minutes_before?: number
|
|
reminder_extra_offsets_minutes?: number[]
|
|
default_price_cents?: number | null
|
|
reminder_template_name?: string | null
|
|
requires_confirmation?: boolean
|
|
slot_interval_minutes?: number | null
|
|
slug: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
booking_window_days?: number
|
|
buffer_after_minutes?: number
|
|
buffer_before_minutes?: number
|
|
category?: string
|
|
created_at?: string
|
|
default_owner_user_id?: string | null
|
|
description?: string | null
|
|
duration_minutes?: number
|
|
id?: string
|
|
is_active?: boolean
|
|
location_details?: string | null
|
|
location_kind?: string
|
|
minimum_notice_minutes?: number
|
|
name?: string
|
|
organization_id?: string
|
|
position?: number
|
|
reminder_body?: string | null
|
|
reminder_bodies?: Json
|
|
reminder_enabled?: boolean
|
|
reminder_minutes_before?: number
|
|
reminder_extra_offsets_minutes?: number[]
|
|
default_price_cents?: number | null
|
|
reminder_template_name?: string | null
|
|
requires_confirmation?: boolean
|
|
slot_interval_minutes?: number | null
|
|
slug?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_event_types_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_external_events: {
|
|
Row: {
|
|
seen_generation: string | null
|
|
recurring_event_id: string | null
|
|
original_start_time: Json | null
|
|
connection_id: string
|
|
created_at: string
|
|
ends_at: string | null
|
|
external_calendar_id: string
|
|
external_event_id: string
|
|
external_updated_at: string | null
|
|
ical_uid: string | null
|
|
id: string
|
|
is_all_day: boolean
|
|
organization_id: string
|
|
starts_at: string | null
|
|
status: string
|
|
title: string | null
|
|
transparency: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
seen_generation?: string | null
|
|
recurring_event_id?: string | null
|
|
original_start_time?: Json | null
|
|
connection_id: string
|
|
created_at?: string
|
|
ends_at: string | null
|
|
external_calendar_id: string
|
|
external_event_id: string
|
|
external_updated_at?: string | null
|
|
ical_uid?: string | null
|
|
id?: string
|
|
is_all_day?: boolean
|
|
organization_id: string
|
|
starts_at: string | null
|
|
status?: string
|
|
title?: string | null
|
|
transparency?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
seen_generation?: string | null
|
|
recurring_event_id?: string | null
|
|
original_start_time?: Json | null
|
|
connection_id?: string
|
|
created_at?: string
|
|
ends_at?: string | null
|
|
external_calendar_id?: string
|
|
external_event_id?: string
|
|
external_updated_at?: string | null
|
|
ical_uid?: string | null
|
|
id?: string
|
|
is_all_day?: boolean
|
|
organization_id?: string
|
|
starts_at?: string | null
|
|
status?: string
|
|
title?: string | null
|
|
transparency?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_external_events_connection_id_fkey"
|
|
columns: ["connection_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "calendar_connections"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "calendar_external_events_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_locations: {
|
|
Row: {
|
|
address: string
|
|
created_at: string
|
|
created_by: string | null
|
|
id: string
|
|
organization_id: string
|
|
}
|
|
Insert: {
|
|
address: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
}
|
|
Update: {
|
|
address?: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_locations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
calendar_oauth_nonces: {
|
|
Row: {
|
|
expira_em: string
|
|
nonce: string
|
|
organization_id: string
|
|
usado_em: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
expira_em: string
|
|
nonce: string
|
|
organization_id: string
|
|
usado_em?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
expira_em?: string
|
|
nonce?: string
|
|
organization_id?: string
|
|
usado_em?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "calendar_oauth_nonces_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_knobs: {
|
|
Row: {
|
|
allow_sunday: boolean | null
|
|
channel_session_id: string
|
|
created_at: string
|
|
health_knobs: Json | null
|
|
jitter_max_ms: number | null
|
|
number_activated_at: string
|
|
organization_id: string
|
|
spinning_knobs: Json | null
|
|
throttle_ms: number | null
|
|
timezone: string | null
|
|
updated_at: string
|
|
warmup_daily_caps: Json | null
|
|
window_end_hour: number | null
|
|
window_start_hour: number | null
|
|
atraso_notar_ms: number | null
|
|
ms_por_caractere: number | null
|
|
atraso_minimo_ms: number | null
|
|
atraso_maximo_ms: number | null
|
|
}
|
|
Insert: {
|
|
allow_sunday?: boolean | null
|
|
channel_session_id: string
|
|
created_at?: string
|
|
health_knobs?: Json | null
|
|
jitter_max_ms?: number | null
|
|
number_activated_at?: string
|
|
organization_id: string
|
|
spinning_knobs?: Json | null
|
|
throttle_ms?: number | null
|
|
timezone?: string | null
|
|
updated_at?: string
|
|
warmup_daily_caps?: Json | null
|
|
window_end_hour?: number | null
|
|
window_start_hour?: number | null
|
|
atraso_notar_ms?: number | null
|
|
ms_por_caractere?: number | null
|
|
atraso_minimo_ms?: number | null
|
|
atraso_maximo_ms?: number | null
|
|
}
|
|
Update: {
|
|
allow_sunday?: boolean | null
|
|
channel_session_id?: string
|
|
created_at?: string
|
|
health_knobs?: Json | null
|
|
jitter_max_ms?: number | null
|
|
number_activated_at?: string
|
|
organization_id?: string
|
|
spinning_knobs?: Json | null
|
|
throttle_ms?: number | null
|
|
timezone?: string | null
|
|
updated_at?: string
|
|
warmup_daily_caps?: Json | null
|
|
window_end_hour?: number | null
|
|
window_start_hour?: number | null
|
|
atraso_notar_ms?: number | null
|
|
ms_por_caractere?: number | null
|
|
atraso_minimo_ms?: number | null
|
|
atraso_maximo_ms?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_knobs_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_knobs_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_session_groups: {
|
|
Row: {
|
|
channel_session_id: string
|
|
contact_id: string | null
|
|
conversation_id: string | null
|
|
created_at: string
|
|
enabled: boolean
|
|
enabled_at: string | null
|
|
enabled_by_user_id: string | null
|
|
group_chat_id: string
|
|
id: string
|
|
organization_id: string
|
|
subject: string | null
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
enabled?: boolean
|
|
enabled_at?: string | null
|
|
enabled_by_user_id?: string | null
|
|
group_chat_id: string
|
|
id?: string
|
|
organization_id: string
|
|
subject?: string | null
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
enabled?: boolean
|
|
enabled_at?: string | null
|
|
enabled_by_user_id?: string | null
|
|
group_chat_id?: string
|
|
id?: string
|
|
organization_id?: string
|
|
subject?: string | null
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_session_groups_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_session_groups_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_session_groups_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_session_groups_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_session_health: {
|
|
Row: {
|
|
channel_session_id: string
|
|
escalated_status: string | null
|
|
health_held_at: string | null
|
|
health_hold_active: boolean
|
|
health_hold_reason: string | null
|
|
health_released_at: string | null
|
|
id: string
|
|
organization_id: string
|
|
status: string
|
|
status_changed_at: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
escalated_status?: string | null
|
|
health_held_at?: string | null
|
|
health_hold_active?: boolean
|
|
health_hold_reason?: string | null
|
|
health_released_at?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
status: string
|
|
status_changed_at?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
escalated_status?: string | null
|
|
health_held_at?: string | null
|
|
health_hold_active?: boolean
|
|
health_hold_reason?: string | null
|
|
health_released_at?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
status?: string
|
|
status_changed_at?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_session_health_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_session_health_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_session_warmup: {
|
|
Row: {
|
|
channel_session_id: string
|
|
day: string
|
|
id: string
|
|
messages_received: number
|
|
messages_sent: number
|
|
organization_id: string
|
|
unique_contacts: number
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
day: string
|
|
id?: string
|
|
messages_received?: number
|
|
messages_sent?: number
|
|
organization_id: string
|
|
unique_contacts?: number
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
day?: string
|
|
id?: string
|
|
messages_received?: number
|
|
messages_sent?: number
|
|
organization_id?: string
|
|
unique_contacts?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_session_warmup_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "channel_session_warmup_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
channel_sessions: {
|
|
Row: {
|
|
archived_at: string | null
|
|
consecutive_health_fails: number
|
|
created_at: string
|
|
created_by: string | null
|
|
daily_message_limit: number
|
|
display_name: string | null
|
|
engine: string
|
|
id: string
|
|
is_warmup_complete: boolean | null
|
|
last_health_check_at: string | null
|
|
last_status_change_at: string
|
|
meta_phone_number_id: string | null
|
|
meta_token_encrypted: string | null
|
|
meta_waba_id: string | null
|
|
meta_webhook_override_em: string | null
|
|
meta_webhook_override_erro: string | null
|
|
meta_webhook_override_uri: string | null
|
|
metadata: Json
|
|
organization_id: string
|
|
phone_number: string | null
|
|
provider: string
|
|
status: string
|
|
status_reason: string | null
|
|
updated_at: string
|
|
wacalls_jid: string | null
|
|
wacalls_paired_at: string | null
|
|
wacalls_session_id: string | null
|
|
waha_session_name: string | null
|
|
warmup_completed_at: string | null
|
|
warmup_started_at: string | null
|
|
webhook_path_token: string
|
|
webhook_secret_encrypted: string
|
|
zernio_account_id: string | null
|
|
zernio_token_encrypted: string | null
|
|
}
|
|
Insert: {
|
|
archived_at?: string | null
|
|
consecutive_health_fails?: number
|
|
created_at?: string
|
|
created_by?: string | null
|
|
daily_message_limit?: number
|
|
display_name?: string | null
|
|
engine?: string
|
|
id?: string
|
|
is_warmup_complete?: boolean | null
|
|
last_health_check_at?: string | null
|
|
last_status_change_at?: string
|
|
meta_phone_number_id?: string | null
|
|
meta_token_encrypted?: string | null
|
|
meta_waba_id?: string | null
|
|
meta_webhook_override_em?: string | null
|
|
meta_webhook_override_erro?: string | null
|
|
meta_webhook_override_uri?: string | null
|
|
metadata?: Json
|
|
organization_id: string
|
|
phone_number?: string | null
|
|
provider?: string
|
|
status?: string
|
|
status_reason?: string | null
|
|
updated_at?: string
|
|
wacalls_jid?: string | null
|
|
wacalls_paired_at?: string | null
|
|
wacalls_session_id?: string | null
|
|
waha_session_name?: string | null
|
|
warmup_completed_at?: string | null
|
|
warmup_started_at?: string | null
|
|
webhook_path_token?: string
|
|
webhook_secret_encrypted: string
|
|
zernio_account_id?: string | null
|
|
zernio_token_encrypted?: string | null
|
|
}
|
|
Update: {
|
|
archived_at?: string | null
|
|
consecutive_health_fails?: number
|
|
created_at?: string
|
|
created_by?: string | null
|
|
daily_message_limit?: number
|
|
display_name?: string | null
|
|
engine?: string
|
|
id?: string
|
|
is_warmup_complete?: boolean | null
|
|
last_health_check_at?: string | null
|
|
last_status_change_at?: string
|
|
meta_phone_number_id?: string | null
|
|
meta_token_encrypted?: string | null
|
|
meta_waba_id?: string | null
|
|
meta_webhook_override_em?: string | null
|
|
meta_webhook_override_erro?: string | null
|
|
meta_webhook_override_uri?: string | null
|
|
metadata?: Json
|
|
organization_id?: string
|
|
phone_number?: string | null
|
|
provider?: string
|
|
status?: string
|
|
status_reason?: string | null
|
|
updated_at?: string
|
|
wacalls_jid?: string | null
|
|
wacalls_paired_at?: string | null
|
|
wacalls_session_id?: string | null
|
|
waha_session_name?: string | null
|
|
warmup_completed_at?: string | null
|
|
warmup_started_at?: string | null
|
|
webhook_path_token?: string
|
|
webhook_secret_encrypted?: string
|
|
zernio_account_id?: string | null
|
|
zernio_token_encrypted?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "channel_sessions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
contact_field_proposals: {
|
|
Row: {
|
|
campo: string
|
|
contact_id: string
|
|
conversation_id: string | null
|
|
decided_at: string | null
|
|
decided_by_user_id: string | null
|
|
expires_at: string
|
|
id: string
|
|
message_id: string | null
|
|
motivo_recusa: string | null
|
|
organization_id: string
|
|
proposed_at: string
|
|
proposed_by_agent_id: string | null
|
|
status: string
|
|
trecho: string | null
|
|
updated_at: string
|
|
valor_anterior: string | null
|
|
valor_proposto: string
|
|
}
|
|
Insert: {
|
|
campo: string
|
|
contact_id: string
|
|
conversation_id?: string | null
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
expires_at: string
|
|
id?: string
|
|
message_id?: string | null
|
|
motivo_recusa?: string | null
|
|
organization_id: string
|
|
proposed_at?: string
|
|
proposed_by_agent_id?: string | null
|
|
status?: string
|
|
trecho?: string | null
|
|
updated_at?: string
|
|
valor_anterior?: string | null
|
|
valor_proposto: string
|
|
}
|
|
Update: {
|
|
campo?: string
|
|
contact_id?: string
|
|
conversation_id?: string | null
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
expires_at?: string
|
|
id?: string
|
|
message_id?: string | null
|
|
motivo_recusa?: string | null
|
|
organization_id?: string
|
|
proposed_at?: string
|
|
proposed_by_agent_id?: string | null
|
|
status?: string
|
|
trecho?: string | null
|
|
updated_at?: string
|
|
valor_anterior?: string | null
|
|
valor_proposto?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "contact_field_proposals_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contact_field_proposals_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contact_field_proposals_message_id_fkey"
|
|
columns: ["message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contact_field_proposals_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contact_field_proposals_proposed_by_agent_id_fkey"
|
|
columns: ["proposed_by_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
contacts: {
|
|
Row: {
|
|
ai_authorized_at: string | null
|
|
ai_authorized_reason: string | null
|
|
anonymized_at: string | null
|
|
avatar_storage_path: string | null
|
|
avatar_updated_at: string | null
|
|
birthdate: string | null
|
|
birthday_md: number | null
|
|
blocked_at: string | null
|
|
blocked_reason: string | null
|
|
client_recognized_at: string | null
|
|
client_tag_by_system: string | null
|
|
consent: Json
|
|
cpf_encrypted: string | null
|
|
custom_fields: Json
|
|
cpf_hash: string | null
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
display_name: string | null
|
|
email: string | null
|
|
email_normalized: string | null
|
|
force_human: boolean
|
|
first_service_at: string | null
|
|
id: string
|
|
is_anonymized: boolean
|
|
is_blocked: boolean
|
|
is_merged_into: string | null
|
|
kind: string
|
|
last_activity_at: string | null
|
|
locale: string | null
|
|
merged_at: string | null
|
|
name: string | null
|
|
organization_id: string
|
|
person_id: string | null
|
|
phone_lookup_at: string | null
|
|
phone_number: string | null
|
|
social_identity: string | null
|
|
source: string
|
|
source_metadata: Json
|
|
tags: string[]
|
|
updated_at: string
|
|
wa_identity: string | null
|
|
wa_lid: string | null
|
|
}
|
|
Insert: {
|
|
ai_authorized_at?: string | null
|
|
ai_authorized_reason?: string | null
|
|
anonymized_at?: string | null
|
|
avatar_storage_path?: string | null
|
|
avatar_updated_at?: string | null
|
|
birthdate?: string | null
|
|
blocked_at?: string | null
|
|
blocked_reason?: string | null
|
|
client_recognized_at?: string | null
|
|
client_tag_by_system?: string | null
|
|
consent?: Json
|
|
cpf_encrypted?: string | null
|
|
custom_fields?: Json
|
|
cpf_hash?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
display_name?: string | null
|
|
email?: string | null
|
|
email_normalized?: string | null
|
|
force_human?: boolean
|
|
first_service_at?: string | null
|
|
id?: string
|
|
is_anonymized?: boolean
|
|
is_blocked?: boolean
|
|
is_merged_into?: string | null
|
|
kind?: string
|
|
last_activity_at?: string | null
|
|
locale?: string | null
|
|
merged_at?: string | null
|
|
name?: string | null
|
|
organization_id: string
|
|
person_id?: string | null
|
|
phone_lookup_at?: string | null
|
|
phone_number?: string | null
|
|
social_identity?: string | null
|
|
source?: string
|
|
source_metadata?: Json
|
|
tags?: string[]
|
|
updated_at?: string
|
|
wa_identity?: string | null
|
|
wa_lid?: string | null
|
|
}
|
|
Update: {
|
|
ai_authorized_at?: string | null
|
|
ai_authorized_reason?: string | null
|
|
anonymized_at?: string | null
|
|
avatar_storage_path?: string | null
|
|
avatar_updated_at?: string | null
|
|
birthdate?: string | null
|
|
blocked_at?: string | null
|
|
blocked_reason?: string | null
|
|
client_recognized_at?: string | null
|
|
client_tag_by_system?: string | null
|
|
consent?: Json
|
|
cpf_encrypted?: string | null
|
|
custom_fields?: Json
|
|
cpf_hash?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
display_name?: string | null
|
|
email?: string | null
|
|
email_normalized?: string | null
|
|
force_human?: boolean
|
|
first_service_at?: string | null
|
|
id?: string
|
|
is_anonymized?: boolean
|
|
is_blocked?: boolean
|
|
is_merged_into?: string | null
|
|
kind?: string
|
|
last_activity_at?: string | null
|
|
locale?: string | null
|
|
merged_at?: string | null
|
|
name?: string | null
|
|
organization_id?: string
|
|
person_id?: string | null
|
|
phone_lookup_at?: string | null
|
|
phone_number?: string | null
|
|
social_identity?: string | null
|
|
source?: string
|
|
source_metadata?: Json
|
|
tags?: string[]
|
|
updated_at?: string
|
|
wa_identity?: string | null
|
|
wa_lid?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "contacts_is_merged_into_fkey"
|
|
columns: ["is_merged_into"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contacts_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "contacts_person_id_fkey"
|
|
columns: ["person_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "people"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
conversation_assignment_events: {
|
|
Row: {
|
|
changed_by: string | null
|
|
conversation_id: string
|
|
created_at: string
|
|
from_user_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
reason: string
|
|
to_user_id: string | null
|
|
}
|
|
Insert: {
|
|
changed_by?: string | null
|
|
conversation_id: string
|
|
created_at?: string
|
|
from_user_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
reason: string
|
|
to_user_id?: string | null
|
|
}
|
|
Update: {
|
|
changed_by?: string | null
|
|
conversation_id?: string
|
|
created_at?: string
|
|
from_user_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
reason?: string
|
|
to_user_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "conversation_assignment_events_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversation_assignment_events_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
conversation_notes: {
|
|
Row: {
|
|
body: string
|
|
conversation_id: string
|
|
created_at: string
|
|
created_by_name: string | null
|
|
created_by_user_id: string | null
|
|
id: string
|
|
media_mime: string | null
|
|
media_size_bytes: number | null
|
|
media_storage_path: string | null
|
|
organization_id: string
|
|
}
|
|
Insert: {
|
|
body: string
|
|
conversation_id: string
|
|
created_at?: string
|
|
created_by_name?: string | null
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
media_mime?: string | null
|
|
media_size_bytes?: number | null
|
|
media_storage_path?: string | null
|
|
organization_id: string
|
|
}
|
|
Update: {
|
|
body?: string
|
|
conversation_id?: string
|
|
created_at?: string
|
|
created_by_name?: string | null
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
media_mime?: string | null
|
|
media_size_bytes?: number | null
|
|
media_storage_path?: string | null
|
|
organization_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "conversation_notes_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversation_notes_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
conversations: {
|
|
Row: {
|
|
reply_context_revision: number
|
|
active_agent_set_at: string | null
|
|
active_ai_agent_id: string | null
|
|
active_intent: string | null
|
|
assigned_at: string | null
|
|
assigned_to_user_id: string | null
|
|
assigned_to_user_name: string | null
|
|
assignee_kind: string | null
|
|
awaiting_since: string | null
|
|
bot_silenced_until: string | null
|
|
channel: string
|
|
channel_session_id: string
|
|
contact_id: string
|
|
created_at: string
|
|
current_demanda_id: string | null
|
|
group_chat_id: string | null
|
|
id: string
|
|
is_group: boolean
|
|
last_handoff_at: string | null
|
|
last_handoff_reason: string | null
|
|
last_inbound_at: string | null
|
|
last_message_at: string | null
|
|
last_message_preview: string | null
|
|
last_outbound_at: string | null
|
|
metadata: Json
|
|
organization_id: string
|
|
provider_conversation_id: string | null
|
|
rag_review_status: string | null
|
|
service_closed_at: string | null
|
|
service_revision: number
|
|
service_started_at: string | null
|
|
snooze_until: string | null
|
|
snoozed_at: string | null
|
|
snoozed_by_user_id: string | null
|
|
status: string
|
|
status_changed_at: string
|
|
tags: string[]
|
|
unread_count_for_assignee: number
|
|
updated_at: string
|
|
usable_for_rag: boolean
|
|
usable_for_rag_marked_at: string | null
|
|
usable_for_rag_marked_by: string | null
|
|
}
|
|
Insert: {
|
|
reply_context_revision?: number
|
|
active_agent_set_at?: string | null
|
|
active_ai_agent_id?: string | null
|
|
active_intent?: string | null
|
|
assigned_at?: string | null
|
|
assigned_to_user_id?: string | null
|
|
assigned_to_user_name?: string | null
|
|
assignee_kind?: string | null
|
|
awaiting_since?: string | null
|
|
bot_silenced_until?: string | null
|
|
channel?: string
|
|
channel_session_id: string
|
|
contact_id: string
|
|
created_at?: string
|
|
current_demanda_id?: string | null
|
|
group_chat_id?: string | null
|
|
id?: string
|
|
is_group?: boolean
|
|
last_handoff_at?: string | null
|
|
last_handoff_reason?: string | null
|
|
last_inbound_at?: string | null
|
|
last_message_at?: string | null
|
|
last_message_preview?: string | null
|
|
last_outbound_at?: string | null
|
|
metadata?: Json
|
|
organization_id: string
|
|
provider_conversation_id?: string | null
|
|
rag_review_status?: string | null
|
|
service_closed_at?: string | null
|
|
service_revision?: number
|
|
service_started_at?: string | null
|
|
snooze_until?: string | null
|
|
snoozed_at?: string | null
|
|
snoozed_by_user_id?: string | null
|
|
status?: string
|
|
status_changed_at?: string
|
|
tags?: string[]
|
|
unread_count_for_assignee?: number
|
|
updated_at?: string
|
|
usable_for_rag?: boolean
|
|
usable_for_rag_marked_at?: string | null
|
|
usable_for_rag_marked_by?: string | null
|
|
}
|
|
Update: {
|
|
reply_context_revision?: number
|
|
active_agent_set_at?: string | null
|
|
active_ai_agent_id?: string | null
|
|
active_intent?: string | null
|
|
assigned_at?: string | null
|
|
assigned_to_user_id?: string | null
|
|
assigned_to_user_name?: string | null
|
|
assignee_kind?: string | null
|
|
awaiting_since?: string | null
|
|
bot_silenced_until?: string | null
|
|
channel?: string
|
|
channel_session_id?: string
|
|
contact_id?: string
|
|
created_at?: string
|
|
current_demanda_id?: string | null
|
|
group_chat_id?: string | null
|
|
id?: string
|
|
is_group?: boolean
|
|
last_handoff_at?: string | null
|
|
last_handoff_reason?: string | null
|
|
last_inbound_at?: string | null
|
|
last_message_at?: string | null
|
|
last_message_preview?: string | null
|
|
last_outbound_at?: string | null
|
|
metadata?: Json
|
|
organization_id?: string
|
|
provider_conversation_id?: string | null
|
|
rag_review_status?: string | null
|
|
service_closed_at?: string | null
|
|
service_revision?: number
|
|
service_started_at?: string | null
|
|
snooze_until?: string | null
|
|
snoozed_at?: string | null
|
|
snoozed_by_user_id?: string | null
|
|
status?: string
|
|
status_changed_at?: string
|
|
tags?: string[]
|
|
unread_count_for_assignee?: number
|
|
updated_at?: string
|
|
usable_for_rag?: boolean
|
|
usable_for_rag_marked_at?: string | null
|
|
usable_for_rag_marked_by?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "conversations_active_ai_agent_id_fkey"
|
|
columns: ["active_ai_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversations_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversations_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversations_current_demanda_id_fkey"
|
|
columns: ["current_demanda_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "demandas"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "conversations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_lead_activities: {
|
|
Row: {
|
|
actor_agent_id: string | null
|
|
actor_kind: string | null
|
|
contact_id: string | null
|
|
created_at: string
|
|
evidence: Json | null
|
|
id: string
|
|
lead_id: string
|
|
metadata: Json
|
|
organization_id: string
|
|
payload: Json
|
|
performed_at: string
|
|
performed_by_user_id: string | null
|
|
reason: string | null
|
|
source_id: string | null
|
|
source_module: string
|
|
type: string
|
|
}
|
|
Insert: {
|
|
actor_agent_id?: string | null
|
|
actor_kind?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
evidence?: Json | null
|
|
id?: string
|
|
lead_id: string
|
|
metadata?: Json
|
|
organization_id: string
|
|
payload?: Json
|
|
performed_at?: string
|
|
performed_by_user_id?: string | null
|
|
reason?: string | null
|
|
source_id?: string | null
|
|
source_module: string
|
|
type: string
|
|
}
|
|
Update: {
|
|
actor_agent_id?: string | null
|
|
actor_kind?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
evidence?: Json | null
|
|
id?: string
|
|
lead_id?: string
|
|
metadata?: Json
|
|
organization_id?: string
|
|
payload?: Json
|
|
performed_at?: string
|
|
performed_by_user_id?: string | null
|
|
reason?: string | null
|
|
source_id?: string | null
|
|
source_module?: string
|
|
type?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_lead_activities_actor_agent_id_fkey"
|
|
columns: ["actor_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_activities_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_activities_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_activities_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_lead_links: {
|
|
Row: {
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
id: string
|
|
lead_id: string
|
|
link_kind: string
|
|
metadata: Json
|
|
organization_id: string
|
|
target_id: string
|
|
target_kind: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
lead_id: string
|
|
link_kind: string
|
|
metadata?: Json
|
|
organization_id: string
|
|
target_id: string
|
|
target_kind: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
lead_id?: string
|
|
link_kind?: string
|
|
metadata?: Json
|
|
organization_id?: string
|
|
target_id?: string
|
|
target_kind?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_lead_links_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_links_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_lead_reactivations: {
|
|
Row: {
|
|
decided_at: string | null
|
|
decided_by_user_id: string | null
|
|
draft: string | null
|
|
expires_at: string
|
|
id: string
|
|
lead_id: string
|
|
organization_id: string
|
|
proposed_at: string
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
draft?: string | null
|
|
expires_at: string
|
|
id?: string
|
|
lead_id: string
|
|
organization_id: string
|
|
proposed_at?: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
draft?: string | null
|
|
expires_at?: string
|
|
id?: string
|
|
lead_id?: string
|
|
organization_id?: string
|
|
proposed_at?: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_lead_reactivations_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_reactivations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_lead_risk_states: {
|
|
Row: {
|
|
bucket: string
|
|
cold_hours: number
|
|
detected_at: string
|
|
lead_id: string
|
|
organization_id: string
|
|
since: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
bucket: string
|
|
cold_hours: number
|
|
detected_at?: string
|
|
lead_id: string
|
|
organization_id: string
|
|
since: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
bucket?: string
|
|
cold_hours?: number
|
|
detected_at?: string
|
|
lead_id?: string
|
|
organization_id?: string
|
|
since?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_lead_risk_states_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_risk_states_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_lead_scores: {
|
|
Row: {
|
|
ai_probability: number | null
|
|
ai_probability_at: string | null
|
|
ai_probability_band: string | null
|
|
ai_probability_band_since: string | null
|
|
ai_probability_evidence: Json
|
|
ai_probability_reason: string | null
|
|
lead_id: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
ai_probability?: number | null
|
|
ai_probability_at?: string | null
|
|
ai_probability_band?: string | null
|
|
ai_probability_band_since?: string | null
|
|
ai_probability_evidence?: Json
|
|
ai_probability_reason?: string | null
|
|
lead_id: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
ai_probability?: number | null
|
|
ai_probability_at?: string | null
|
|
ai_probability_band?: string | null
|
|
ai_probability_band_since?: string | null
|
|
ai_probability_evidence?: Json
|
|
ai_probability_reason?: string | null
|
|
lead_id?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_lead_scores_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_lead_scores_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_leads: {
|
|
Row: {
|
|
assigned_at: string | null
|
|
closed_at: string | null
|
|
contact_id: string | null
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
currency: string | null
|
|
custom_fields: Json
|
|
description: string | null
|
|
expected_close_date: string | null
|
|
external_id: string | null
|
|
id: string
|
|
last_activity_at: string | null
|
|
lost_from_stage_id: string | null
|
|
lost_reason: string | null
|
|
won_reason: string | null
|
|
organization_id: string
|
|
owner_agent_id: string | null
|
|
owner_kind: string | null
|
|
owner_user_id: string | null
|
|
pipeline_id: string
|
|
position_in_stage: number
|
|
retomado_de_lead_id: string | null
|
|
source: string
|
|
source_metadata: Json
|
|
stage_changed_at: string | null
|
|
stage_id: string
|
|
status: string
|
|
tags: string[]
|
|
title: string
|
|
updated_at: string
|
|
value_cents: number | null
|
|
}
|
|
Insert: {
|
|
assigned_at?: string | null
|
|
closed_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string | null
|
|
custom_fields?: Json
|
|
description?: string | null
|
|
expected_close_date?: string | null
|
|
external_id?: string | null
|
|
id?: string
|
|
last_activity_at?: string | null
|
|
lost_reason?: string | null
|
|
won_reason?: string | null
|
|
organization_id: string
|
|
owner_agent_id?: string | null
|
|
owner_kind?: string | null
|
|
owner_user_id?: string | null
|
|
pipeline_id: string
|
|
position_in_stage?: number
|
|
retomado_de_lead_id?: string | null
|
|
lost_from_stage_id?: string | null
|
|
source?: string
|
|
source_metadata?: Json
|
|
stage_changed_at?: string | null
|
|
stage_id: string
|
|
status?: string
|
|
tags?: string[]
|
|
title: string
|
|
updated_at?: string
|
|
value_cents?: number | null
|
|
}
|
|
Update: {
|
|
assigned_at?: string | null
|
|
closed_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
currency?: string | null
|
|
custom_fields?: Json
|
|
description?: string | null
|
|
expected_close_date?: string | null
|
|
external_id?: string | null
|
|
id?: string
|
|
last_activity_at?: string | null
|
|
lost_reason?: string | null
|
|
won_reason?: string | null
|
|
organization_id?: string
|
|
owner_agent_id?: string | null
|
|
owner_kind?: string | null
|
|
owner_user_id?: string | null
|
|
pipeline_id?: string
|
|
position_in_stage?: number
|
|
retomado_de_lead_id?: string | null
|
|
lost_from_stage_id?: string | null
|
|
source?: string
|
|
source_metadata?: Json
|
|
stage_changed_at?: string | null
|
|
stage_id?: string
|
|
status?: string
|
|
tags?: string[]
|
|
title?: string
|
|
updated_at?: string
|
|
value_cents?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_leads_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_leads_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_leads_owner_agent_id_fkey"
|
|
columns: ["owner_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_leads_pipeline_id_fkey"
|
|
columns: ["pipeline_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_pipelines"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_leads_stage_id_fkey"
|
|
columns: ["stage_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_stages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "fk_crm_leads_lost_from_stage"
|
|
columns: ["lost_from_stage_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_stages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_pipelines: {
|
|
Row: {
|
|
created_at: string
|
|
description: string | null
|
|
id: string
|
|
is_archived: boolean
|
|
is_default: boolean
|
|
is_client_pipeline: boolean
|
|
name: string
|
|
organization_id: string
|
|
position: number
|
|
settings: Json
|
|
slug: string
|
|
updated_at: string
|
|
vocabulary: Json
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
description?: string | null
|
|
id?: string
|
|
is_archived?: boolean
|
|
is_default?: boolean
|
|
is_client_pipeline?: boolean
|
|
name: string
|
|
organization_id: string
|
|
position?: number
|
|
settings?: Json
|
|
slug: string
|
|
updated_at?: string
|
|
vocabulary?: Json
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
description?: string | null
|
|
id?: string
|
|
is_archived?: boolean
|
|
is_default?: boolean
|
|
is_client_pipeline?: boolean
|
|
name?: string
|
|
organization_id?: string
|
|
position?: number
|
|
settings?: Json
|
|
slug?: string
|
|
updated_at?: string
|
|
vocabulary?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_pipelines_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_proposal_counters: {
|
|
Row: {
|
|
ano: number
|
|
organization_id: string
|
|
ultimo_numero: number
|
|
}
|
|
Insert: {
|
|
ano: number
|
|
organization_id: string
|
|
ultimo_numero?: number
|
|
}
|
|
Update: {
|
|
ano?: number
|
|
organization_id?: string
|
|
ultimo_numero?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_proposal_counters_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_proposal_items: {
|
|
Row: {
|
|
created_at: string
|
|
desconto_cents: number
|
|
descricao: string
|
|
id: string
|
|
organization_id: string
|
|
position: number
|
|
preco_unitario_cents: number | null
|
|
product_id: string | null
|
|
proposal_id: string
|
|
quantidade: number
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
desconto_cents?: number
|
|
descricao: string
|
|
id?: string
|
|
organization_id: string
|
|
position: number
|
|
preco_unitario_cents?: number | null
|
|
product_id?: string | null
|
|
proposal_id: string
|
|
quantidade?: number
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
desconto_cents?: number
|
|
descricao?: string
|
|
id?: string
|
|
organization_id?: string
|
|
position?: number
|
|
preco_unitario_cents?: number | null
|
|
product_id?: string | null
|
|
proposal_id?: string
|
|
quantidade?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_proposal_items_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposal_items_product_id_fkey"
|
|
columns: ["product_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "catalog_products"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposal_items_proposal_id_fkey"
|
|
columns: ["proposal_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_proposals"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_proposals: {
|
|
Row: {
|
|
ano: number | null
|
|
briefing_json: Json | null
|
|
condicoes: string | null
|
|
contact_id: string | null
|
|
conversation_id: string | null
|
|
created_at: string
|
|
decided_at: string | null
|
|
decided_by_user_id: string | null
|
|
decision_reason: string | null
|
|
destinatario_nome: string | null
|
|
drafted_by_agent_id: string | null
|
|
id: string
|
|
lead_id: string | null
|
|
message_id: string | null
|
|
moeda: string
|
|
numero: number | null
|
|
organization_id: string
|
|
pagamento: string | null
|
|
pdf_path: string | null
|
|
prazo_dias_uteis: number | null
|
|
pricing_status: string
|
|
rendered_snapshot: Json | null
|
|
resumo_comercial: string | null
|
|
retorno_id: string | null
|
|
revision: number
|
|
secoes_editadas: Json | null
|
|
sent_at: string | null
|
|
sent_by_user_id: string | null
|
|
status: string
|
|
substitui_id: string | null
|
|
template_slug: string | null
|
|
template_slug_sugerido: string | null
|
|
template_snapshot: Json | null
|
|
template_version: number | null
|
|
titulo: string
|
|
total_cents: number
|
|
ultima_falha_envio: string | null
|
|
updated_at: string
|
|
valid_until: string | null
|
|
versao: number
|
|
version_reason: string | null
|
|
}
|
|
Insert: {
|
|
ano?: number | null
|
|
briefing_json?: Json | null
|
|
condicoes?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
decision_reason?: string | null
|
|
destinatario_nome?: string | null
|
|
drafted_by_agent_id?: string | null
|
|
id?: string
|
|
lead_id?: string | null
|
|
message_id?: string | null
|
|
moeda?: string
|
|
numero?: number | null
|
|
organization_id: string
|
|
pagamento?: string | null
|
|
pdf_path?: string | null
|
|
prazo_dias_uteis?: number | null
|
|
pricing_status?: string
|
|
rendered_snapshot?: Json | null
|
|
resumo_comercial?: string | null
|
|
retorno_id?: string | null
|
|
revision?: number
|
|
secoes_editadas?: Json | null
|
|
sent_at?: string | null
|
|
sent_by_user_id?: string | null
|
|
status?: string
|
|
substitui_id?: string | null
|
|
template_slug?: string | null
|
|
template_slug_sugerido?: string | null
|
|
template_snapshot?: Json | null
|
|
template_version?: number | null
|
|
titulo: string
|
|
total_cents?: number
|
|
ultima_falha_envio?: string | null
|
|
updated_at?: string
|
|
valid_until?: string | null
|
|
versao?: number
|
|
version_reason?: string | null
|
|
}
|
|
Update: {
|
|
ano?: number | null
|
|
briefing_json?: Json | null
|
|
condicoes?: string | null
|
|
contact_id?: string | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
decided_at?: string | null
|
|
decided_by_user_id?: string | null
|
|
decision_reason?: string | null
|
|
destinatario_nome?: string | null
|
|
drafted_by_agent_id?: string | null
|
|
id?: string
|
|
lead_id?: string | null
|
|
message_id?: string | null
|
|
moeda?: string
|
|
numero?: number | null
|
|
organization_id?: string
|
|
pagamento?: string | null
|
|
pdf_path?: string | null
|
|
prazo_dias_uteis?: number | null
|
|
pricing_status?: string
|
|
rendered_snapshot?: Json | null
|
|
resumo_comercial?: string | null
|
|
retorno_id?: string | null
|
|
revision?: number
|
|
secoes_editadas?: Json | null
|
|
sent_at?: string | null
|
|
sent_by_user_id?: string | null
|
|
status?: string
|
|
substitui_id?: string | null
|
|
template_slug?: string | null
|
|
template_slug_sugerido?: string | null
|
|
template_snapshot?: Json | null
|
|
template_version?: number | null
|
|
titulo?: string
|
|
total_cents?: number
|
|
ultima_falha_envio?: string | null
|
|
updated_at?: string
|
|
valid_until?: string | null
|
|
versao?: number
|
|
version_reason?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_proposals_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_drafted_by_agent_id_fkey"
|
|
columns: ["drafted_by_agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_message_id_fkey"
|
|
columns: ["message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_retorno_id_fkey"
|
|
columns: ["retorno_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "cron_jobs"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_proposals_substitui_id_fkey"
|
|
columns: ["substitui_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_proposals"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
crm_stages: {
|
|
Row: {
|
|
agent_stage_hint: string | null
|
|
color: string | null
|
|
created_at: string
|
|
description: string | null
|
|
expected_duration_hours: number | null
|
|
id: string
|
|
is_archived: boolean
|
|
is_lost: boolean
|
|
is_won: boolean
|
|
last_change_actor_kind: string | null
|
|
last_change_at: string | null
|
|
name: string
|
|
organization_id: string
|
|
pipeline_id: string
|
|
position: number
|
|
requires_human: boolean
|
|
slug: string
|
|
updated_at: string
|
|
win_probability: number | null
|
|
}
|
|
Insert: {
|
|
agent_stage_hint?: string | null
|
|
color?: string | null
|
|
created_at?: string
|
|
description?: string | null
|
|
expected_duration_hours?: number | null
|
|
id?: string
|
|
is_archived?: boolean
|
|
is_lost?: boolean
|
|
is_won?: boolean
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
name: string
|
|
organization_id: string
|
|
pipeline_id: string
|
|
position: number
|
|
requires_human?: boolean
|
|
slug: string
|
|
updated_at?: string
|
|
win_probability?: number | null
|
|
}
|
|
Update: {
|
|
agent_stage_hint?: string | null
|
|
color?: string | null
|
|
created_at?: string
|
|
description?: string | null
|
|
expected_duration_hours?: number | null
|
|
id?: string
|
|
is_archived?: boolean
|
|
is_lost?: boolean
|
|
is_won?: boolean
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
name?: string
|
|
organization_id?: string
|
|
pipeline_id?: string
|
|
position?: number
|
|
requires_human?: boolean
|
|
slug?: string
|
|
updated_at?: string
|
|
win_probability?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "crm_stages_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "crm_stages_pipeline_id_fkey"
|
|
columns: ["pipeline_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_pipelines"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
cron_jobs: {
|
|
Row: {
|
|
attempts: number
|
|
cancel_reason: string | null
|
|
cancelled_at: string | null
|
|
contact_id: string
|
|
created_at: string
|
|
cron_expr: string | null
|
|
enabled: boolean
|
|
id: string
|
|
interval_ms: number | null
|
|
job_kind: string
|
|
kind: string
|
|
last_error: string | null
|
|
max_attempts: number
|
|
next_run_at: string
|
|
organization_id: string
|
|
payload: Json
|
|
tz: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
attempts?: number
|
|
cancel_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id: string
|
|
created_at?: string
|
|
cron_expr?: string | null
|
|
enabled?: boolean
|
|
id?: string
|
|
interval_ms?: number | null
|
|
job_kind?: string
|
|
kind: string
|
|
last_error?: string | null
|
|
max_attempts?: number
|
|
next_run_at: string
|
|
organization_id: string
|
|
payload?: Json
|
|
tz?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
attempts?: number
|
|
cancel_reason?: string | null
|
|
cancelled_at?: string | null
|
|
contact_id?: string
|
|
created_at?: string
|
|
cron_expr?: string | null
|
|
enabled?: boolean
|
|
id?: string
|
|
interval_ms?: number | null
|
|
job_kind?: string
|
|
kind?: string
|
|
last_error?: string | null
|
|
max_attempts?: number
|
|
next_run_at?: string
|
|
organization_id?: string
|
|
payload?: Json
|
|
tz?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "cron_jobs_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "cron_jobs_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
demanda_conversas: {
|
|
Row: {
|
|
conversation_id: string
|
|
demanda_id: string
|
|
organization_id: string
|
|
service_revision: number | null
|
|
vinculada_em: string
|
|
}
|
|
Insert: {
|
|
conversation_id: string
|
|
demanda_id: string
|
|
organization_id: string
|
|
service_revision?: number | null
|
|
vinculada_em?: string
|
|
}
|
|
Update: {
|
|
conversation_id?: string
|
|
demanda_id?: string
|
|
organization_id?: string
|
|
service_revision?: number | null
|
|
vinculada_em?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "demanda_conversas_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "demanda_conversas_demanda_id_fkey"
|
|
columns: ["demanda_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "demandas"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "demanda_conversas_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
demandas: {
|
|
Row: {
|
|
aberta_em: string
|
|
agent_case_id: string | null
|
|
assunto: string | null
|
|
contact_id: string
|
|
created_at: string
|
|
desfecho: string | null
|
|
dono_kind: string
|
|
dono_user_id: string | null
|
|
encerrada_por: string | null
|
|
estado: string
|
|
fechada_em: string | null
|
|
id: string
|
|
lead_id: string | null
|
|
organization_id: string
|
|
origem: string
|
|
prazo_em: string | null
|
|
proximo_passo: string | null
|
|
proximo_passo_em: string | null
|
|
revision: number
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
aberta_em?: string
|
|
agent_case_id?: string | null
|
|
assunto?: string | null
|
|
contact_id: string
|
|
created_at?: string
|
|
desfecho?: string | null
|
|
dono_kind?: string
|
|
dono_user_id?: string | null
|
|
encerrada_por?: string | null
|
|
estado?: string
|
|
fechada_em?: string | null
|
|
id?: string
|
|
lead_id?: string | null
|
|
organization_id: string
|
|
origem?: string
|
|
prazo_em?: string | null
|
|
proximo_passo?: string | null
|
|
proximo_passo_em?: string | null
|
|
revision?: number
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
aberta_em?: string
|
|
agent_case_id?: string | null
|
|
assunto?: string | null
|
|
contact_id?: string
|
|
created_at?: string
|
|
desfecho?: string | null
|
|
dono_kind?: string
|
|
dono_user_id?: string | null
|
|
encerrada_por?: string | null
|
|
estado?: string
|
|
fechada_em?: string | null
|
|
id?: string
|
|
lead_id?: string | null
|
|
organization_id?: string
|
|
origem?: string
|
|
prazo_em?: string | null
|
|
proximo_passo?: string | null
|
|
proximo_passo_em?: string | null
|
|
revision?: number
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "demandas_agent_case_id_fkey"
|
|
columns: ["agent_case_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "agent_cases"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "demandas_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "demandas_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "demandas_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
disclosure_template_pointers: {
|
|
Row: {
|
|
organization_id: string
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
organization_id: string
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
organization_id?: string
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "disclosure_template_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "disclosure_template_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "disclosure_template_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
disclosure_template_versions: {
|
|
Row: {
|
|
body: string
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
}
|
|
Insert: {
|
|
body: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
}
|
|
Update: {
|
|
body?: string
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "disclosure_template_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
event_log: {
|
|
Row: {
|
|
attempts: number
|
|
consumed_by: string[]
|
|
created_at: string
|
|
entity_id: string | null
|
|
entity_kind: string
|
|
event_type: string
|
|
id: string
|
|
last_error: string | null
|
|
metadata: Json
|
|
next_attempt_at: string | null
|
|
organization_id: string
|
|
payload: Json
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
attempts?: number
|
|
consumed_by?: string[]
|
|
created_at?: string
|
|
entity_id?: string | null
|
|
entity_kind: string
|
|
event_type: string
|
|
id?: string
|
|
last_error?: string | null
|
|
metadata?: Json
|
|
next_attempt_at?: string | null
|
|
organization_id: string
|
|
payload?: Json
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
attempts?: number
|
|
consumed_by?: string[]
|
|
created_at?: string
|
|
entity_id?: string | null
|
|
entity_kind?: string
|
|
event_type?: string
|
|
id?: string
|
|
last_error?: string | null
|
|
metadata?: Json
|
|
next_attempt_at?: string | null
|
|
organization_id?: string
|
|
payload?: Json
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "event_log_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
extension_artifacts: {
|
|
Row: {
|
|
byte_length: number
|
|
created_at: string
|
|
document: string
|
|
id: string
|
|
manifest: Json
|
|
sha256: string
|
|
}
|
|
Insert: {
|
|
byte_length: number
|
|
created_at?: string
|
|
document: string
|
|
id?: string
|
|
manifest: Json
|
|
sha256: string
|
|
}
|
|
Update: {
|
|
byte_length?: number
|
|
created_at?: string
|
|
document?: string
|
|
id?: string
|
|
manifest?: Json
|
|
sha256?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
extension_catalogs: {
|
|
Row: {
|
|
admitted_at: string
|
|
admitted_by: string | null
|
|
digest: string
|
|
id: string
|
|
origin: string
|
|
revision: number
|
|
snapshot: Json
|
|
}
|
|
Insert: {
|
|
admitted_at?: string
|
|
admitted_by?: string | null
|
|
digest: string
|
|
id?: string
|
|
origin: string
|
|
revision: number
|
|
snapshot: Json
|
|
}
|
|
Update: {
|
|
admitted_at?: string
|
|
admitted_by?: string | null
|
|
digest?: string
|
|
id?: string
|
|
origin?: string
|
|
revision?: number
|
|
snapshot?: Json
|
|
}
|
|
Relationships: []
|
|
}
|
|
extension_installations: {
|
|
Row: {
|
|
artifact_id: string
|
|
catalog_id: string
|
|
id: string
|
|
installed_at: string
|
|
installed_by: string | null
|
|
name: string
|
|
previous_artifact_id: string | null
|
|
publisher: string
|
|
removed_at: string | null
|
|
removed_by: string | null
|
|
revision: number
|
|
version: string
|
|
}
|
|
Insert: {
|
|
artifact_id: string
|
|
catalog_id: string
|
|
id?: string
|
|
installed_at?: string
|
|
installed_by?: string | null
|
|
name: string
|
|
previous_artifact_id?: string | null
|
|
publisher: string
|
|
removed_at?: string | null
|
|
removed_by?: string | null
|
|
revision?: number
|
|
version: string
|
|
}
|
|
Update: {
|
|
artifact_id?: string
|
|
catalog_id?: string
|
|
id?: string
|
|
installed_at?: string
|
|
installed_by?: string | null
|
|
name?: string
|
|
previous_artifact_id?: string | null
|
|
publisher?: string
|
|
removed_at?: string | null
|
|
removed_by?: string | null
|
|
revision?: number
|
|
version?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "extension_installations_artifact_id_fkey"
|
|
columns: ["artifact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_artifacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "extension_installations_catalog_id_fkey"
|
|
columns: ["catalog_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_catalogs"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "extension_installations_previous_artifact_id_fkey"
|
|
columns: ["previous_artifact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_artifacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
extension_operations: {
|
|
Row: {
|
|
actor_id: string | null
|
|
admission_digest: string | null
|
|
admission_revision: number | null
|
|
catalog_id: string | null
|
|
created_at: string
|
|
entry: Json | null
|
|
error_code: string | null
|
|
id: string
|
|
installation_id: string | null
|
|
kind: string
|
|
name: string | null
|
|
organization_id: string | null
|
|
publisher: string | null
|
|
request: Json
|
|
request_fingerprint: string
|
|
result: Json | null
|
|
status: string
|
|
updated_at: string
|
|
version: string | null
|
|
}
|
|
Insert: {
|
|
actor_id?: string | null
|
|
admission_digest?: string | null
|
|
admission_revision?: number | null
|
|
catalog_id?: string | null
|
|
created_at?: string
|
|
entry?: Json | null
|
|
error_code?: string | null
|
|
id: string
|
|
installation_id?: string | null
|
|
kind: string
|
|
name?: string | null
|
|
organization_id?: string | null
|
|
publisher?: string | null
|
|
request: Json
|
|
request_fingerprint: string
|
|
result?: Json | null
|
|
status: string
|
|
updated_at?: string
|
|
version?: string | null
|
|
}
|
|
Update: {
|
|
actor_id?: string | null
|
|
admission_digest?: string | null
|
|
admission_revision?: number | null
|
|
catalog_id?: string | null
|
|
created_at?: string
|
|
entry?: Json | null
|
|
error_code?: string | null
|
|
id?: string
|
|
installation_id?: string | null
|
|
kind?: string
|
|
name?: string | null
|
|
organization_id?: string | null
|
|
publisher?: string | null
|
|
request?: Json
|
|
request_fingerprint?: string
|
|
result?: Json | null
|
|
status?: string
|
|
updated_at?: string
|
|
version?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "extension_operations_catalog_id_fkey"
|
|
columns: ["catalog_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_catalogs"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "extension_operations_installation_id_fkey"
|
|
columns: ["installation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_installations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "extension_operations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
flywheel_distiller_proposals: {
|
|
Row: {
|
|
applied_at: string | null
|
|
applied_by: string | null
|
|
applied_version_id: string | null
|
|
content: string
|
|
dataset: string
|
|
evidence: Json
|
|
id: string
|
|
organization_id: string
|
|
proposed_at: string
|
|
run_id: string
|
|
target: string
|
|
type: string
|
|
}
|
|
Insert: {
|
|
applied_at?: string | null
|
|
applied_by?: string | null
|
|
applied_version_id?: string | null
|
|
content: string
|
|
dataset: string
|
|
evidence: Json
|
|
id?: string
|
|
organization_id: string
|
|
proposed_at?: string
|
|
run_id: string
|
|
target: string
|
|
type: string
|
|
}
|
|
Update: {
|
|
applied_at?: string | null
|
|
applied_by?: string | null
|
|
applied_version_id?: string | null
|
|
content?: string
|
|
dataset?: string
|
|
evidence?: Json
|
|
id?: string
|
|
organization_id?: string
|
|
proposed_at?: string
|
|
run_id?: string
|
|
target?: string
|
|
type?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "flywheel_distiller_proposals_applied_version_id_fkey"
|
|
columns: ["applied_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agent_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "flywheel_distiller_proposals_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
flywheel_judge_verdicts: {
|
|
Row: {
|
|
dataset: string
|
|
dimension: string
|
|
id: string
|
|
judge_family: string
|
|
judged_at: string
|
|
model: string
|
|
option_order: string
|
|
organization_id: string
|
|
provenance: Json
|
|
run_id: string
|
|
trace_id: string
|
|
verdict: string
|
|
}
|
|
Insert: {
|
|
dataset: string
|
|
dimension: string
|
|
id?: string
|
|
judge_family: string
|
|
judged_at?: string
|
|
model: string
|
|
option_order: string
|
|
organization_id: string
|
|
provenance?: Json
|
|
run_id: string
|
|
trace_id: string
|
|
verdict: string
|
|
}
|
|
Update: {
|
|
dataset?: string
|
|
dimension?: string
|
|
id?: string
|
|
judge_family?: string
|
|
judged_at?: string
|
|
model?: string
|
|
option_order?: string
|
|
organization_id?: string
|
|
provenance?: Json
|
|
run_id?: string
|
|
trace_id?: string
|
|
verdict?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "flywheel_judge_verdicts_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
followup_enrollment_events: {
|
|
Row: {
|
|
created_at: string
|
|
enrollment_id: string
|
|
event_type: string
|
|
id: string
|
|
idempotency_key: string | null
|
|
node_id: string | null
|
|
organization_id: string
|
|
payload: Json
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
enrollment_id: string
|
|
event_type: string
|
|
id?: string
|
|
idempotency_key?: string | null
|
|
node_id?: string | null
|
|
organization_id: string
|
|
payload?: Json
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
enrollment_id?: string
|
|
event_type?: string
|
|
id?: string
|
|
idempotency_key?: string | null
|
|
node_id?: string | null
|
|
organization_id?: string
|
|
payload?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "followup_enrollment_events_enrollment_id_fkey"
|
|
columns: ["enrollment_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_enrollments"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollment_events_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
followup_enrollments: {
|
|
Row: {
|
|
revision: number
|
|
appointment_id: string | null
|
|
appointment_revision: number | null
|
|
agent_id: string | null
|
|
attempts: number
|
|
cancel_reason: string | null
|
|
claimed_until: string | null
|
|
completed_at: string | null
|
|
contact_id: string
|
|
conversation_id: string | null
|
|
current_node_id: string
|
|
id: string
|
|
last_error: string | null
|
|
max_attempts: number
|
|
next_eval_at: string | null
|
|
organization_id: string
|
|
outcome: string | null
|
|
pointer_id: string
|
|
service_boundary: Json | null
|
|
started_at: string
|
|
status: string
|
|
steps_taken: number
|
|
timing_plan: Json | null
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
revision?: number
|
|
appointment_id?: string | null
|
|
appointment_revision?: number | null
|
|
agent_id?: string | null
|
|
attempts?: number
|
|
cancel_reason?: string | null
|
|
claimed_until?: string | null
|
|
completed_at?: string | null
|
|
contact_id: string
|
|
conversation_id?: string | null
|
|
current_node_id: string
|
|
id?: string
|
|
last_error?: string | null
|
|
max_attempts?: number
|
|
next_eval_at?: string | null
|
|
organization_id: string
|
|
outcome?: string | null
|
|
pointer_id: string
|
|
service_boundary?: Json | null
|
|
started_at?: string
|
|
status?: string
|
|
steps_taken?: number
|
|
timing_plan?: Json | null
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
revision?: number
|
|
appointment_id?: string | null
|
|
appointment_revision?: number | null
|
|
agent_id?: string | null
|
|
attempts?: number
|
|
cancel_reason?: string | null
|
|
claimed_until?: string | null
|
|
completed_at?: string | null
|
|
contact_id?: string
|
|
conversation_id?: string | null
|
|
current_node_id?: string
|
|
id?: string
|
|
last_error?: string | null
|
|
max_attempts?: number
|
|
next_eval_at?: string | null
|
|
organization_id?: string
|
|
outcome?: string | null
|
|
pointer_id?: string
|
|
service_boundary?: Json | null
|
|
started_at?: string
|
|
status?: string
|
|
steps_taken?: number
|
|
timing_plan?: Json | null
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{ foreignKeyName: "followup_enrollments_appointment_id_fkey"; columns: ["appointment_id"]; isOneToOne: false; referencedRelation: "calendar_appointments"; referencedColumns: ["id"] },
|
|
{
|
|
foreignKeyName: "followup_enrollments_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollments_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollments_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollments_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollments_pointer_id_fkey"
|
|
columns: ["pointer_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_flow_pointers"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_enrollments_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_flow_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
followup_flow_pointers: {
|
|
Row: {
|
|
active_version_id: string | null
|
|
created_at: string
|
|
draft_graph: Json | null
|
|
handoff_policy: string
|
|
id: string
|
|
name: string
|
|
organization_id: string
|
|
status: string
|
|
surface: string
|
|
trigger_config: Json
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
active_version_id?: string | null
|
|
created_at?: string
|
|
draft_graph?: Json | null
|
|
handoff_policy?: string
|
|
id?: string
|
|
name: string
|
|
organization_id: string
|
|
status?: string
|
|
surface?: string
|
|
trigger_config?: Json
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
active_version_id?: string | null
|
|
created_at?: string
|
|
draft_graph?: Json | null
|
|
handoff_policy?: string
|
|
id?: string
|
|
name?: string
|
|
organization_id?: string
|
|
status?: string
|
|
surface?: string
|
|
trigger_config?: Json
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "followup_flow_pointers_active_version_id_fkey"
|
|
columns: ["active_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_flow_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_flow_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
followup_flow_versions: {
|
|
Row: {
|
|
created_at: string
|
|
created_by: string | null
|
|
graph: Json
|
|
id: string
|
|
organization_id: string
|
|
pointer_id: string | null
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
created_by?: string | null
|
|
graph: Json
|
|
id?: string
|
|
organization_id: string
|
|
pointer_id?: string | null
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
created_by?: string | null
|
|
graph?: Json
|
|
id?: string
|
|
organization_id?: string
|
|
pointer_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "followup_flow_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "followup_flow_versions_pointer_id_fkey"
|
|
columns: ["pointer_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "followup_flow_pointers"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
idempotency_keys: {
|
|
Row: {
|
|
tenant_creation_trusted: boolean
|
|
created_at: string
|
|
endpoint: string
|
|
expires_at: string
|
|
id: string
|
|
key: string
|
|
organization_id: string
|
|
request_hash: string
|
|
response_body: Json | null
|
|
status_code: number | null
|
|
}
|
|
Insert: {
|
|
tenant_creation_trusted?: boolean
|
|
created_at?: string
|
|
endpoint: string
|
|
expires_at?: string
|
|
id?: string
|
|
key: string
|
|
organization_id: string
|
|
request_hash: string
|
|
response_body?: Json | null
|
|
status_code?: number | null
|
|
}
|
|
Update: {
|
|
tenant_creation_trusted?: boolean
|
|
created_at?: string
|
|
endpoint?: string
|
|
expires_at?: string
|
|
id?: string
|
|
key?: string
|
|
organization_id?: string
|
|
request_hash?: string
|
|
response_body?: Json | null
|
|
status_code?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "idempotency_keys_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
incidents: {
|
|
Row: {
|
|
acknowledged_at: string | null
|
|
acknowledged_by: string | null
|
|
created_at: string
|
|
id: string
|
|
organization_id: string | null
|
|
payload: Json
|
|
resolution_note: string | null
|
|
resolved_at: string | null
|
|
resolved_by: string | null
|
|
severity: string
|
|
status: string
|
|
type: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
acknowledged_at?: string | null
|
|
acknowledged_by?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string | null
|
|
payload?: Json
|
|
resolution_note?: string | null
|
|
resolved_at?: string | null
|
|
resolved_by?: string | null
|
|
severity: string
|
|
status?: string
|
|
type: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
acknowledged_at?: string | null
|
|
acknowledged_by?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string | null
|
|
payload?: Json
|
|
resolution_note?: string | null
|
|
resolved_at?: string | null
|
|
resolved_by?: string | null
|
|
severity?: string
|
|
status?: string
|
|
type?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "incidents_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
jev_observacoes: {
|
|
Row: {
|
|
concordou: boolean | null
|
|
confianca_jev: number | null
|
|
conversation_id: string | null
|
|
created_at: string
|
|
estado: string
|
|
id: string
|
|
job_id: string | null
|
|
latencia_ms: number | null
|
|
message_id: string | null
|
|
modelo: string | null
|
|
organization_id: string
|
|
probabilidade_jev: number | null
|
|
rotulo_atual: string | null
|
|
rotulo_jev: string | null
|
|
tarefa: string
|
|
}
|
|
Insert: {
|
|
concordou?: never
|
|
confianca_jev?: number | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
estado: string
|
|
id?: string
|
|
job_id?: string | null
|
|
latencia_ms?: number | null
|
|
message_id?: string | null
|
|
modelo?: string | null
|
|
organization_id: string
|
|
probabilidade_jev?: number | null
|
|
rotulo_atual?: string | null
|
|
rotulo_jev?: string | null
|
|
tarefa: string
|
|
}
|
|
Update: {
|
|
concordou?: never
|
|
confianca_jev?: number | null
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
estado?: string
|
|
id?: string
|
|
job_id?: string | null
|
|
latencia_ms?: number | null
|
|
message_id?: string | null
|
|
modelo?: string | null
|
|
organization_id?: string
|
|
probabilidade_jev?: number | null
|
|
rotulo_atual?: string | null
|
|
rotulo_jev?: string | null
|
|
tarefa?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "jev_observacoes_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
job_queue: {
|
|
Row: {
|
|
attempts: number
|
|
contact_id: string | null
|
|
created_at: string
|
|
id: string
|
|
kind: string
|
|
last_error: string | null
|
|
locked_at: string | null
|
|
locked_by: string | null
|
|
max_attempts: number
|
|
organization_id: string
|
|
payload: Json
|
|
priority: number
|
|
run_after: string
|
|
source_event_id: string | null
|
|
status: string
|
|
}
|
|
Insert: {
|
|
attempts?: number
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
kind: string
|
|
last_error?: string | null
|
|
locked_at?: string | null
|
|
locked_by?: string | null
|
|
max_attempts?: number
|
|
organization_id: string
|
|
payload?: Json
|
|
priority?: number
|
|
run_after?: string
|
|
source_event_id?: string | null
|
|
status?: string
|
|
}
|
|
Update: {
|
|
attempts?: number
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
id?: string
|
|
kind?: string
|
|
last_error?: string | null
|
|
locked_at?: string | null
|
|
locked_by?: string | null
|
|
max_attempts?: number
|
|
organization_id?: string
|
|
payload?: Json
|
|
priority?: number
|
|
run_after?: string
|
|
source_event_id?: string | null
|
|
status?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "job_queue_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "job_queue_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
judge_alignment_pool: {
|
|
Row: {
|
|
added_at: string
|
|
dataset: string
|
|
dimension: string
|
|
id: string
|
|
organization_id: string
|
|
trace_id: string
|
|
}
|
|
Insert: {
|
|
added_at?: string
|
|
dataset: string
|
|
dimension: string
|
|
id?: string
|
|
organization_id: string
|
|
trace_id: string
|
|
}
|
|
Update: {
|
|
added_at?: string
|
|
dataset?: string
|
|
dimension?: string
|
|
id?: string
|
|
organization_id?: string
|
|
trace_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "judge_alignment_pool_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
knowledge_searches: {
|
|
Row: {
|
|
agent_id: string | null
|
|
created_at: string
|
|
hits: number
|
|
id: string
|
|
job_id: string | null
|
|
kb_version_id: string | null
|
|
knowledge_source_ids: string[]
|
|
organization_id: string
|
|
threshold: number
|
|
top_score: number | null
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
created_at?: string
|
|
hits?: number
|
|
id?: string
|
|
job_id?: string | null
|
|
kb_version_id?: string | null
|
|
knowledge_source_ids?: string[]
|
|
organization_id: string
|
|
threshold: number
|
|
top_score?: number | null
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
created_at?: string
|
|
hits?: number
|
|
id?: string
|
|
job_id?: string | null
|
|
kb_version_id?: string | null
|
|
knowledge_source_ids?: string[]
|
|
organization_id?: string
|
|
threshold?: number
|
|
top_score?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "knowledge_searches_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "knowledge_searches_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
lead_checkpoints: {
|
|
Row: {
|
|
commitments: Json
|
|
contact_id: string
|
|
conversation_id: string | null
|
|
created_at: string
|
|
declaracao: Json | null
|
|
demanda_id: string | null
|
|
demanda_revision: number | null
|
|
id: string
|
|
job_id: string | null
|
|
next_action: string | null
|
|
objections: Json
|
|
organization_id: string
|
|
rolling_summary: string
|
|
seq: number
|
|
service_revision: number | null
|
|
}
|
|
Insert: {
|
|
commitments?: Json
|
|
contact_id: string
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
declaracao?: Json | null
|
|
demanda_id?: string | null
|
|
demanda_revision?: number | null
|
|
id?: string
|
|
job_id?: string | null
|
|
next_action?: string | null
|
|
objections?: Json
|
|
organization_id: string
|
|
rolling_summary?: string
|
|
seq?: never
|
|
service_revision?: number | null
|
|
}
|
|
Update: {
|
|
commitments?: Json
|
|
contact_id?: string
|
|
conversation_id?: string | null
|
|
created_at?: string
|
|
declaracao?: Json | null
|
|
demanda_id?: string | null
|
|
demanda_revision?: number | null
|
|
id?: string
|
|
job_id?: string | null
|
|
next_action?: string | null
|
|
objections?: Json
|
|
organization_id?: string
|
|
rolling_summary?: string
|
|
seq?: never
|
|
service_revision?: number | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "lead_checkpoints_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_checkpoints_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_checkpoints_demanda_id_fkey"
|
|
columns: ["demanda_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "demandas"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_checkpoints_job_id_fkey"
|
|
columns: ["job_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "job_queue"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_checkpoints_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
lead_notes: {
|
|
Row: {
|
|
body: string
|
|
contact_id: string
|
|
created_at: string
|
|
embedding: Json | null
|
|
headline: string
|
|
id: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
body: string
|
|
contact_id: string
|
|
created_at?: string
|
|
embedding?: Json | null
|
|
headline: string
|
|
id?: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
body?: string
|
|
contact_id?: string
|
|
created_at?: string
|
|
embedding?: Json | null
|
|
headline?: string
|
|
id?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "lead_notes_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_notes_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
lead_state: {
|
|
Row: {
|
|
contact_id: string
|
|
id: string
|
|
next_action: string | null
|
|
next_action_seq: number
|
|
organization_id: string
|
|
qualification: Json
|
|
stage: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
contact_id: string
|
|
id?: string
|
|
next_action?: string | null
|
|
next_action_seq?: number
|
|
organization_id: string
|
|
qualification?: Json
|
|
stage?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
contact_id?: string
|
|
id?: string
|
|
next_action?: string | null
|
|
next_action_seq?: number
|
|
organization_id?: string
|
|
qualification?: Json
|
|
stage?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "lead_state_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_state_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
lead_state_transitions: {
|
|
Row: {
|
|
contact_id: string
|
|
created_at: string
|
|
from_stage: string
|
|
id: string
|
|
job_id: string | null
|
|
organization_id: string
|
|
reason: string | null
|
|
seq: number
|
|
to_stage: string
|
|
}
|
|
Insert: {
|
|
contact_id: string
|
|
created_at?: string
|
|
from_stage: string
|
|
id?: string
|
|
job_id?: string | null
|
|
organization_id: string
|
|
reason?: string | null
|
|
seq?: never
|
|
to_stage: string
|
|
}
|
|
Update: {
|
|
contact_id?: string
|
|
created_at?: string
|
|
from_stage?: string
|
|
id?: string
|
|
job_id?: string | null
|
|
organization_id?: string
|
|
reason?: string | null
|
|
seq?: never
|
|
to_stage?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "lead_state_transitions_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_state_transitions_job_id_fkey"
|
|
columns: ["job_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "job_queue"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lead_state_transitions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
lgpd_requests: {
|
|
Row: {
|
|
attempts: number
|
|
cascaded_to: Json | null
|
|
completed_at: string | null
|
|
contact_id: string | null
|
|
created_at: string
|
|
due_at: string
|
|
emergency: boolean
|
|
error_message: string | null
|
|
external_customer_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
received_at: string
|
|
request_payload: Json
|
|
request_type: string
|
|
result: Json | null
|
|
scope: string
|
|
source: string
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
attempts?: number
|
|
cascaded_to?: Json | null
|
|
completed_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
due_at: string
|
|
emergency?: boolean
|
|
error_message?: string | null
|
|
external_customer_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
received_at?: string
|
|
request_payload?: Json
|
|
request_type: string
|
|
result?: Json | null
|
|
scope?: string
|
|
source: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
attempts?: number
|
|
cascaded_to?: Json | null
|
|
completed_at?: string | null
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
due_at?: string
|
|
emergency?: boolean
|
|
error_message?: string | null
|
|
external_customer_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
received_at?: string
|
|
request_payload?: Json
|
|
request_type?: string
|
|
result?: Json | null
|
|
scope?: string
|
|
source?: string
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "lgpd_requests_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "lgpd_requests_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
llm_calls: {
|
|
Row: {
|
|
agent_id: string | null
|
|
cache_read_tokens: number
|
|
cache_write_tokens: number
|
|
contact_id: string | null
|
|
cost_cents: number | null
|
|
created_at: string
|
|
error_code: string | null
|
|
error_message: string | null
|
|
http_status: number | null
|
|
id: string
|
|
input_tokens: number
|
|
job_id: string | null
|
|
latency_ms: number | null
|
|
legacy_invocation_id: string | null
|
|
model: string
|
|
organization_id: string
|
|
origem_da_escolha: string | null
|
|
output_tokens: number
|
|
provider: string
|
|
purpose: string
|
|
status: string
|
|
variant_id: string | null
|
|
}
|
|
Insert: {
|
|
agent_id?: string | null
|
|
cache_read_tokens?: number
|
|
cache_write_tokens?: number
|
|
contact_id?: string | null
|
|
cost_cents?: number | null
|
|
created_at?: string
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
http_status?: number | null
|
|
id?: string
|
|
input_tokens?: number
|
|
job_id?: string | null
|
|
latency_ms?: number | null
|
|
legacy_invocation_id?: string | null
|
|
model: string
|
|
organization_id: string
|
|
origem_da_escolha?: string | null
|
|
output_tokens?: number
|
|
provider: string
|
|
purpose?: string
|
|
status?: string
|
|
variant_id?: string | null
|
|
}
|
|
Update: {
|
|
agent_id?: string | null
|
|
cache_read_tokens?: number
|
|
cache_write_tokens?: number
|
|
contact_id?: string | null
|
|
cost_cents?: number | null
|
|
created_at?: string
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
http_status?: number | null
|
|
id?: string
|
|
input_tokens?: number
|
|
job_id?: string | null
|
|
latency_ms?: number | null
|
|
legacy_invocation_id?: string | null
|
|
model?: string
|
|
organization_id?: string
|
|
origem_da_escolha?: string | null
|
|
output_tokens?: number
|
|
provider?: string
|
|
purpose?: string
|
|
status?: string
|
|
variant_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "llm_calls_agent_id_fkey"
|
|
columns: ["agent_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "ai_agents"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "llm_calls_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "llm_calls_job_id_fkey"
|
|
columns: ["job_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "job_queue"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "llm_calls_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
merge_queue: {
|
|
Row: {
|
|
candidates: string[]
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
reason: string
|
|
resolution: Json | null
|
|
resolved_at: string | null
|
|
resolved_by_user_id: string | null
|
|
status: string
|
|
trigger_payload: Json
|
|
}
|
|
Insert: {
|
|
candidates: string[]
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
reason: string
|
|
resolution?: Json | null
|
|
resolved_at?: string | null
|
|
resolved_by_user_id?: string | null
|
|
status?: string
|
|
trigger_payload?: Json
|
|
}
|
|
Update: {
|
|
candidates?: string[]
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
reason?: string
|
|
resolution?: Json | null
|
|
resolved_at?: string | null
|
|
resolved_by_user_id?: string | null
|
|
status?: string
|
|
trigger_payload?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "merge_queue_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
message_templates: {
|
|
Row: {
|
|
body: string
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
id: string
|
|
organization_id: string
|
|
owner_user_id: string | null
|
|
shortcut: string | null
|
|
title: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
body: string
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
owner_user_id?: string | null
|
|
shortcut?: string | null
|
|
title: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
body?: string
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
owner_user_id?: string | null
|
|
shortcut?: string | null
|
|
title?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "message_templates_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
messages: {
|
|
Row: {
|
|
ack: number | null
|
|
activity_id: string | null
|
|
body: string | null
|
|
channel_session_id: string
|
|
contact_id: string
|
|
conversation_id: string
|
|
created_at: string
|
|
delivered_at: string | null
|
|
demanda_id: string | null
|
|
demanda_revision: number | null
|
|
direction: string
|
|
edited_at: string | null
|
|
error_code: string | null
|
|
error_message: string | null
|
|
external_id: string | null
|
|
id: string
|
|
media_derived_status: string | null
|
|
media_derived_text: string | null
|
|
media_mime: string | null
|
|
media_size_bytes: number | null
|
|
media_storage_path: string | null
|
|
media_url: string | null
|
|
metadata: Json
|
|
organization_id: string
|
|
read_at: string | null
|
|
reply_to_message_id: string | null
|
|
revoked_at: string | null
|
|
sent_at: string
|
|
sent_by_user_id: string | null
|
|
sent_on_behalf_of_user_id: string | null
|
|
sent_via: string
|
|
service_revision: number | null
|
|
status: string
|
|
template_language: string | null
|
|
template_name: string | null
|
|
type: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
ack?: number | null
|
|
activity_id?: string | null
|
|
body?: string | null
|
|
channel_session_id: string
|
|
contact_id: string
|
|
conversation_id: string
|
|
created_at?: string
|
|
delivered_at?: string | null
|
|
demanda_id?: string | null
|
|
demanda_revision?: number | null
|
|
direction: string
|
|
edited_at?: string | null
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
external_id?: string | null
|
|
id?: string
|
|
media_derived_status?: string | null
|
|
media_derived_text?: string | null
|
|
media_mime?: string | null
|
|
media_size_bytes?: number | null
|
|
media_storage_path?: string | null
|
|
media_url?: string | null
|
|
metadata?: Json
|
|
organization_id: string
|
|
read_at?: string | null
|
|
reply_to_message_id?: string | null
|
|
revoked_at?: string | null
|
|
sent_at?: string
|
|
sent_by_user_id?: string | null
|
|
sent_on_behalf_of_user_id?: string | null
|
|
sent_via?: string
|
|
service_revision?: number | null
|
|
status?: string
|
|
template_language?: string | null
|
|
template_name?: string | null
|
|
type: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
ack?: number | null
|
|
activity_id?: string | null
|
|
body?: string | null
|
|
channel_session_id?: string
|
|
contact_id?: string
|
|
conversation_id?: string
|
|
created_at?: string
|
|
delivered_at?: string | null
|
|
demanda_id?: string | null
|
|
demanda_revision?: number | null
|
|
direction?: string
|
|
edited_at?: string | null
|
|
error_code?: string | null
|
|
error_message?: string | null
|
|
external_id?: string | null
|
|
id?: string
|
|
media_derived_status?: string | null
|
|
media_derived_text?: string | null
|
|
media_mime?: string | null
|
|
media_size_bytes?: number | null
|
|
media_storage_path?: string | null
|
|
media_url?: string | null
|
|
metadata?: Json
|
|
organization_id?: string
|
|
read_at?: string | null
|
|
reply_to_message_id?: string | null
|
|
revoked_at?: string | null
|
|
sent_at?: string
|
|
sent_by_user_id?: string | null
|
|
sent_on_behalf_of_user_id?: string | null
|
|
sent_via?: string
|
|
service_revision?: number | null
|
|
status?: string
|
|
template_language?: string | null
|
|
template_name?: string | null
|
|
type?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "messages_activity_id_fkey"
|
|
columns: ["activity_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_lead_activities"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_demanda_id_fkey"
|
|
columns: ["demanda_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "demandas"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "messages_reply_to_message_id_fkey"
|
|
columns: ["reply_to_message_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "messages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
meta_templates: {
|
|
Row: {
|
|
category: string | null
|
|
channel_session_id: string | null
|
|
components: Json
|
|
contract_hash: string
|
|
created_at: string
|
|
id: string
|
|
language: string
|
|
name: string
|
|
organization_id: string
|
|
parameter_format: string
|
|
quality_score: string | null
|
|
rejected_reason: string | null
|
|
saved_values: Json
|
|
status: string
|
|
synced_at: string
|
|
updated_at: string
|
|
waba_id: string
|
|
}
|
|
Insert: {
|
|
category?: string | null
|
|
channel_session_id?: string | null
|
|
components: Json
|
|
contract_hash: string
|
|
created_at?: string
|
|
id?: string
|
|
language: string
|
|
name: string
|
|
organization_id: string
|
|
parameter_format?: string
|
|
quality_score?: string | null
|
|
rejected_reason?: string | null
|
|
saved_values?: Json
|
|
status: string
|
|
synced_at?: string
|
|
updated_at?: string
|
|
waba_id: string
|
|
}
|
|
Update: {
|
|
category?: string | null
|
|
channel_session_id?: string | null
|
|
components?: Json
|
|
contract_hash?: string
|
|
created_at?: string
|
|
id?: string
|
|
language?: string
|
|
name?: string
|
|
organization_id?: string
|
|
parameter_format?: string
|
|
quality_score?: string | null
|
|
rejected_reason?: string | null
|
|
saved_values?: Json
|
|
status?: string
|
|
synced_at?: string
|
|
updated_at?: string
|
|
waba_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "meta_templates_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "meta_templates_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
metrics: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
labels: Json
|
|
name: string
|
|
organization_id: string | null
|
|
value: number
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id?: string
|
|
labels?: Json
|
|
name: string
|
|
organization_id?: string | null
|
|
value: number
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
labels?: Json
|
|
name?: string
|
|
organization_id?: string | null
|
|
value?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "metrics_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
nuvemshop_products: {
|
|
Row: {
|
|
available_qty: number
|
|
created_at: string
|
|
description: string | null
|
|
external_id: string
|
|
id: string
|
|
image_url: string | null
|
|
last_updated_at: string
|
|
organization_id: string
|
|
payload: Json
|
|
price_cents: number
|
|
rag_chunk_count: number
|
|
rag_indexed_at: string | null
|
|
title: string
|
|
updated_at: string
|
|
url: string | null
|
|
}
|
|
Insert: {
|
|
available_qty?: number
|
|
created_at?: string
|
|
description?: string | null
|
|
external_id: string
|
|
id?: string
|
|
image_url?: string | null
|
|
last_updated_at: string
|
|
organization_id: string
|
|
payload?: Json
|
|
price_cents: number
|
|
rag_chunk_count?: number
|
|
rag_indexed_at?: string | null
|
|
title: string
|
|
updated_at?: string
|
|
url?: string | null
|
|
}
|
|
Update: {
|
|
available_qty?: number
|
|
created_at?: string
|
|
description?: string | null
|
|
external_id?: string
|
|
id?: string
|
|
image_url?: string | null
|
|
last_updated_at?: string
|
|
organization_id?: string
|
|
payload?: Json
|
|
price_cents?: number
|
|
rag_chunk_count?: number
|
|
rag_indexed_at?: string | null
|
|
title?: string
|
|
updated_at?: string
|
|
url?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "nuvemshop_products_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
orders: {
|
|
Row: {
|
|
contact_id: string | null
|
|
created_at: string
|
|
currency: string
|
|
customer_external_id: string | null
|
|
external_id: string
|
|
external_provider: string
|
|
fulfillment_status: string | null
|
|
id: string
|
|
is_anonymized: boolean
|
|
ordered_at: string
|
|
organization_id: string
|
|
payload: Json
|
|
payment_method: string | null
|
|
status: string
|
|
total_cents: number
|
|
tracking_code: string | null
|
|
updated_at: string
|
|
updated_at_remote: string | null
|
|
}
|
|
Insert: {
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
currency?: string
|
|
customer_external_id?: string | null
|
|
external_id: string
|
|
external_provider: string
|
|
fulfillment_status?: string | null
|
|
id?: string
|
|
is_anonymized?: boolean
|
|
ordered_at: string
|
|
organization_id: string
|
|
payload?: Json
|
|
payment_method?: string | null
|
|
status: string
|
|
total_cents: number
|
|
tracking_code?: string | null
|
|
updated_at?: string
|
|
updated_at_remote?: string | null
|
|
}
|
|
Update: {
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
currency?: string
|
|
customer_external_id?: string | null
|
|
external_id?: string
|
|
external_provider?: string
|
|
fulfillment_status?: string | null
|
|
id?: string
|
|
is_anonymized?: boolean
|
|
ordered_at?: string
|
|
organization_id?: string
|
|
payload?: Json
|
|
payment_method?: string | null
|
|
status?: string
|
|
total_cents?: number
|
|
tracking_code?: string | null
|
|
updated_at?: string
|
|
updated_at_remote?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "orders_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "orders_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
org_guardrail_layers: {
|
|
Row: {
|
|
enabled: boolean
|
|
layer: string
|
|
organization_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
enabled: boolean
|
|
layer: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
enabled?: boolean
|
|
layer?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "org_guardrail_layers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
org_memory_entries: {
|
|
Row: {
|
|
body: string
|
|
created_at: string
|
|
created_by: string | null
|
|
id: string
|
|
organization_id: string
|
|
proposal_id: string | null
|
|
source: string
|
|
status: string
|
|
title: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
body: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
proposal_id?: string | null
|
|
source: string
|
|
status?: string
|
|
title: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
body?: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
proposal_id?: string | null
|
|
source?: string
|
|
status?: string
|
|
title?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "org_memory_entries_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "org_memory_entries_proposal_id_fkey"
|
|
columns: ["proposal_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "flywheel_distiller_proposals"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
org_memory_pointers: {
|
|
Row: {
|
|
organization_id: string
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
organization_id: string
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
organization_id?: string
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "org_memory_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "org_memory_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "org_memory_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
org_memory_versions: {
|
|
Row: {
|
|
content: string
|
|
created_at: string
|
|
created_by: string | null
|
|
id: string
|
|
organization_id: string
|
|
version_number: number
|
|
}
|
|
Insert: {
|
|
content: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
version_number: number
|
|
}
|
|
Update: {
|
|
content?: string
|
|
created_at?: string
|
|
created_by?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
version_number?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "org_memory_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
organization_extensions: {
|
|
Row: {
|
|
configuration: Json
|
|
deactivated_by_removal_at: string | null
|
|
enabled: boolean
|
|
installation_id: string
|
|
organization_id: string
|
|
revision: number
|
|
updated_at: string
|
|
updated_by: string | null
|
|
}
|
|
Insert: {
|
|
configuration: Json
|
|
deactivated_by_removal_at?: string | null
|
|
enabled: boolean
|
|
installation_id: string
|
|
organization_id: string
|
|
revision: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Update: {
|
|
configuration?: Json
|
|
deactivated_by_removal_at?: string | null
|
|
enabled?: boolean
|
|
installation_id?: string
|
|
organization_id?: string
|
|
revision?: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "organization_extensions_installation_id_fkey"
|
|
columns: ["installation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "extension_installations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "organization_extensions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
organizations: {
|
|
Row: {
|
|
ai_budget_cents: number | null
|
|
cnpj: string | null
|
|
created_at: string
|
|
created_by: string | null
|
|
currency: string
|
|
display_name: string
|
|
dpo_email: string | null
|
|
id: string
|
|
legal_name: string
|
|
locale: string
|
|
media_retention_days: number
|
|
onboarded_at: string | null
|
|
onboarding_state: Json
|
|
privacy_policy_url: string | null
|
|
rate_limit_rps: number
|
|
redacted_at: string | null
|
|
settings: Json
|
|
slug: string
|
|
status: string
|
|
suspended_at: string | null
|
|
suspended_by: string | null
|
|
suspended_kind: string | null
|
|
suspended_reason: string | null
|
|
timezone: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
ai_budget_cents?: number | null
|
|
cnpj?: string | null
|
|
created_at?: string
|
|
created_by?: string | null
|
|
currency?: string
|
|
display_name: string
|
|
dpo_email?: string | null
|
|
id?: string
|
|
legal_name: string
|
|
locale?: string
|
|
media_retention_days?: number
|
|
onboarded_at?: string | null
|
|
onboarding_state?: Json
|
|
privacy_policy_url?: string | null
|
|
rate_limit_rps?: number
|
|
redacted_at?: string | null
|
|
settings?: Json
|
|
slug: string
|
|
status?: string
|
|
suspended_at?: string | null
|
|
suspended_by?: string | null
|
|
suspended_kind?: string | null
|
|
suspended_reason?: string | null
|
|
timezone?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
ai_budget_cents?: number | null
|
|
cnpj?: string | null
|
|
created_at?: string
|
|
created_by?: string | null
|
|
currency?: string
|
|
display_name?: string
|
|
dpo_email?: string | null
|
|
id?: string
|
|
legal_name?: string
|
|
locale?: string
|
|
media_retention_days?: number
|
|
onboarded_at?: string | null
|
|
onboarding_state?: Json
|
|
privacy_policy_url?: string | null
|
|
rate_limit_rps?: number
|
|
redacted_at?: string | null
|
|
settings?: Json
|
|
slug?: string
|
|
status?: string
|
|
suspended_at?: string | null
|
|
suspended_by?: string | null
|
|
suspended_kind?: string | null
|
|
suspended_reason?: string | null
|
|
timezone?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
outbound_copies: {
|
|
Row: {
|
|
channel_session_id: string
|
|
id: string
|
|
normalized_hash: string
|
|
normalized_text: string
|
|
organization_id: string
|
|
sent_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
id?: string
|
|
normalized_hash: string
|
|
normalized_text: string
|
|
organization_id: string
|
|
sent_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
id?: string
|
|
normalized_hash?: string
|
|
normalized_text?: string
|
|
organization_id?: string
|
|
sent_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "outbound_copies_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "outbound_copies_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
pacing_ledger: {
|
|
Row: {
|
|
channel_session_id: string
|
|
id: string
|
|
organization_id: string
|
|
sent_at: string
|
|
}
|
|
Insert: {
|
|
channel_session_id: string
|
|
id?: string
|
|
organization_id: string
|
|
sent_at?: string
|
|
}
|
|
Update: {
|
|
channel_session_id?: string
|
|
id?: string
|
|
organization_id?: string
|
|
sent_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "pacing_ledger_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "pacing_ledger_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
passagens_de_atendimento: {
|
|
Row: {
|
|
aviso_motivo_codigo: string | null
|
|
body: string
|
|
caso_id: string | null
|
|
cliente_avisado: boolean | null
|
|
cobrancas: number
|
|
contact_id: string
|
|
content: string | null
|
|
conversation_id: string
|
|
criado_em: string
|
|
id: string
|
|
motivo_codigo: string
|
|
motor: string
|
|
notes: string | null
|
|
organization_id: string
|
|
origem: string
|
|
reconhecido_em: string | null
|
|
reconhecido_por: string | null
|
|
tentativas: Json
|
|
title: string | null
|
|
}
|
|
Insert: {
|
|
aviso_motivo_codigo?: string | null
|
|
body: string
|
|
caso_id?: string | null
|
|
cliente_avisado?: boolean | null
|
|
cobrancas?: number
|
|
contact_id: string
|
|
content?: string | null
|
|
conversation_id: string
|
|
criado_em?: string
|
|
id?: string
|
|
motivo_codigo: string
|
|
motor: string
|
|
notes?: string | null
|
|
organization_id: string
|
|
origem: string
|
|
reconhecido_em?: string | null
|
|
reconhecido_por?: string | null
|
|
tentativas?: Json
|
|
title?: string | null
|
|
}
|
|
Update: {
|
|
aviso_motivo_codigo?: string | null
|
|
body?: string
|
|
caso_id?: string | null
|
|
cliente_avisado?: boolean | null
|
|
cobrancas?: number
|
|
contact_id?: string
|
|
content?: string | null
|
|
conversation_id?: string
|
|
criado_em?: string
|
|
id?: string
|
|
motivo_codigo?: string
|
|
motor?: string
|
|
notes?: string | null
|
|
organization_id?: string
|
|
origem?: string
|
|
reconhecido_em?: string | null
|
|
reconhecido_por?: string | null
|
|
tentativas?: Json
|
|
title?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "passagens_de_atendimento_caso_id_fkey"
|
|
columns: ["caso_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "agent_cases"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "passagens_de_atendimento_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "passagens_de_atendimento_conversation_id_fkey"
|
|
columns: ["conversation_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "conversations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "passagens_de_atendimento_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
platform_admins: {
|
|
Row: {
|
|
granted_at: string
|
|
granted_by: string
|
|
mfa_required: boolean
|
|
reason: string
|
|
revoke_reason: string | null
|
|
revoked_at: string | null
|
|
revoked_by: string | null
|
|
scope: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
granted_at?: string
|
|
granted_by: string
|
|
mfa_required?: boolean
|
|
reason: string
|
|
revoke_reason?: string | null
|
|
revoked_at?: string | null
|
|
revoked_by?: string | null
|
|
scope?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
granted_at?: string
|
|
granted_by?: string
|
|
mfa_required?: boolean
|
|
reason?: string
|
|
revoke_reason?: string | null
|
|
revoked_at?: string | null
|
|
revoked_by?: string | null
|
|
scope?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
platform_branding: {
|
|
Row: {
|
|
accent_hex: string | null
|
|
app_name: string | null
|
|
fallback_at: string | null
|
|
fallback_reason: string | null
|
|
id: number
|
|
logo_path: string | null
|
|
logo_url: string | null
|
|
seeded_from_env: boolean
|
|
show_powered_by: boolean
|
|
updated_at: string
|
|
updated_by: string | null
|
|
}
|
|
Insert: {
|
|
accent_hex?: string | null
|
|
app_name?: string | null
|
|
fallback_at?: string | null
|
|
fallback_reason?: string | null
|
|
id?: number
|
|
logo_path?: string | null
|
|
logo_url?: string | null
|
|
seeded_from_env?: boolean
|
|
show_powered_by?: boolean
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Update: {
|
|
accent_hex?: string | null
|
|
app_name?: string | null
|
|
fallback_at?: string | null
|
|
fallback_reason?: string | null
|
|
id?: number
|
|
logo_path?: string | null
|
|
logo_url?: string | null
|
|
seeded_from_env?: boolean
|
|
show_powered_by?: boolean
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Relationships: []
|
|
}
|
|
platform_google_oauth: {
|
|
Row: {
|
|
client_id: string | null
|
|
client_secret_encrypted: string | null
|
|
id: number
|
|
updated_at: string
|
|
updated_by: string | null
|
|
}
|
|
Insert: {
|
|
client_id?: string | null
|
|
client_secret_encrypted?: string | null
|
|
id?: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Update: {
|
|
client_id?: string | null
|
|
client_secret_encrypted?: string | null
|
|
id?: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Relationships: []
|
|
}
|
|
platform_meta_app: {
|
|
Row: {
|
|
app_secret_encrypted: string | null
|
|
id: number
|
|
updated_at: string
|
|
updated_by: string | null
|
|
verify_token_created_at: string | null
|
|
verify_token_encrypted: string | null
|
|
}
|
|
Insert: {
|
|
app_secret_encrypted?: string | null
|
|
id?: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
verify_token_created_at?: string | null
|
|
verify_token_encrypted?: string | null
|
|
}
|
|
Update: {
|
|
app_secret_encrypted?: string | null
|
|
id?: number
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
verify_token_created_at?: string | null
|
|
verify_token_encrypted?: string | null
|
|
}
|
|
Relationships: []
|
|
}
|
|
playbook_pointers: {
|
|
Row: {
|
|
layer: string
|
|
organization_id: string | null
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
layer: string
|
|
organization_id?: string | null
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
layer?: string
|
|
organization_id?: string | null
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "playbook_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "playbook_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "playbook_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
playbook_versions: {
|
|
Row: {
|
|
content: string
|
|
created_at: string
|
|
id: string
|
|
layer: string
|
|
organization_id: string | null
|
|
}
|
|
Insert: {
|
|
content: string
|
|
created_at?: string
|
|
id?: string
|
|
layer: string
|
|
organization_id?: string | null
|
|
}
|
|
Update: {
|
|
content?: string
|
|
created_at?: string
|
|
id?: string
|
|
layer?: string
|
|
organization_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "playbook_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
promise_table_pointers: {
|
|
Row: {
|
|
organization_id: string
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
organization_id: string
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
organization_id?: string
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "promise_table_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "promise_table_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "promise_table_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
promise_table_versions: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
values: Json
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
values: Json
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
values?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "promise_table_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
proposal_templates: {
|
|
Row: {
|
|
base_slug: string | null
|
|
base_version: number | null
|
|
created_at: string
|
|
descricao: string | null
|
|
id: string
|
|
is_active: boolean
|
|
nome: string | null
|
|
organization_id: string
|
|
section_order: string[]
|
|
sections: Json
|
|
slug: string
|
|
updated_at: string
|
|
version: number
|
|
}
|
|
Insert: {
|
|
base_slug?: string | null
|
|
base_version?: number | null
|
|
created_at?: string
|
|
descricao?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
nome?: string | null
|
|
organization_id: string
|
|
section_order?: string[]
|
|
sections?: Json
|
|
slug: string
|
|
updated_at?: string
|
|
version?: number
|
|
}
|
|
Update: {
|
|
base_slug?: string | null
|
|
base_version?: number | null
|
|
created_at?: string
|
|
descricao?: string | null
|
|
id?: string
|
|
is_active?: boolean
|
|
nome?: string | null
|
|
organization_id?: string
|
|
section_order?: string[]
|
|
sections?: Json
|
|
slug?: string
|
|
updated_at?: string
|
|
version?: number
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "proposal_templates_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
prospecting_campaigns: {
|
|
Row: {
|
|
agent_setup: Json
|
|
agent_setup_revision: number
|
|
config: Json | null
|
|
cost_usd: number | null
|
|
created_at: string
|
|
dataset_id: string | null
|
|
error: string | null
|
|
id: string
|
|
name: string
|
|
next_send_at: string
|
|
organization_id: string
|
|
request_id: string
|
|
result_count: number
|
|
run_id: string | null
|
|
search: Json
|
|
search_status: string
|
|
skipped_count: number
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
agent_setup?: Json
|
|
agent_setup_revision?: number
|
|
config?: Json | null
|
|
cost_usd?: number | null
|
|
created_at?: string
|
|
dataset_id?: string | null
|
|
error?: string | null
|
|
id?: string
|
|
name: string
|
|
next_send_at?: string
|
|
organization_id: string
|
|
request_id: string
|
|
result_count?: number
|
|
run_id?: string | null
|
|
search: Json
|
|
search_status?: string
|
|
skipped_count?: number
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
agent_setup?: Json
|
|
agent_setup_revision?: number
|
|
config?: Json | null
|
|
cost_usd?: number | null
|
|
created_at?: string
|
|
dataset_id?: string | null
|
|
error?: string | null
|
|
id?: string
|
|
name?: string
|
|
next_send_at?: string
|
|
organization_id?: string
|
|
request_id?: string
|
|
result_count?: number
|
|
run_id?: string | null
|
|
search?: Json
|
|
search_status?: string
|
|
skipped_count?: number
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "prospecting_campaigns_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
push_subscriptions: {
|
|
Row: {
|
|
auth: string
|
|
created_at: string
|
|
endpoint: string
|
|
id: string
|
|
organization_id: string
|
|
p256dh: string
|
|
updated_at: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
auth: string
|
|
created_at?: string
|
|
endpoint: string
|
|
id?: string
|
|
organization_id: string
|
|
p256dh: string
|
|
updated_at?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
auth?: string
|
|
created_at?: string
|
|
endpoint?: string
|
|
id?: string
|
|
organization_id?: string
|
|
p256dh?: string
|
|
updated_at?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "push_subscriptions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
reentry_knob_pointers: {
|
|
Row: {
|
|
organization_id: string
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
organization_id: string
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
organization_id?: string
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "reentry_knob_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "reentry_knob_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "reentry_knob_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
reentry_knob_versions: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
knobs: Json
|
|
organization_id: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id?: string
|
|
knobs: Json
|
|
organization_id: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
knobs?: Json
|
|
organization_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "reentry_knob_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
reentry_template_pointers: {
|
|
Row: {
|
|
organization_id: string
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
organization_id: string
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
organization_id?: string
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "reentry_template_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "reentry_template_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "reentry_template_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
reentry_template_versions: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
organization_id: string
|
|
variants: string[]
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id?: string
|
|
organization_id: string
|
|
variants: string[]
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
organization_id?: string
|
|
variants?: string[]
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "reentry_template_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
send_ledger: {
|
|
Row: {
|
|
body_hash: string
|
|
contact_id: string | null
|
|
created_at: string
|
|
crm_message_id: string | null
|
|
id: string
|
|
job_id: string
|
|
last_error: string | null
|
|
organization_id: string
|
|
seq: number
|
|
status: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
body_hash: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
crm_message_id?: string | null
|
|
id?: string
|
|
job_id: string
|
|
last_error?: string | null
|
|
organization_id: string
|
|
seq: number
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
body_hash?: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
crm_message_id?: string | null
|
|
id?: string
|
|
job_id?: string
|
|
last_error?: string | null
|
|
organization_id?: string
|
|
seq?: number
|
|
status?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "send_ledger_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "send_ledger_job_id_fkey"
|
|
columns: ["job_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "job_queue"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "send_ledger_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
skill_activations: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
job_id: string | null
|
|
organization_id: string
|
|
skill_name: string
|
|
skill_version_id: string | null
|
|
trigger: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id?: string
|
|
job_id?: string | null
|
|
organization_id: string
|
|
skill_name: string
|
|
skill_version_id?: string | null
|
|
trigger: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
job_id?: string | null
|
|
organization_id?: string
|
|
skill_name?: string
|
|
skill_version_id?: string | null
|
|
trigger?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "skill_activations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "skill_activations_skill_version_id_fkey"
|
|
columns: ["skill_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "skill_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
skill_pointers: {
|
|
Row: {
|
|
name: string
|
|
organization_id: string | null
|
|
updated_at: string
|
|
version_id: string
|
|
}
|
|
Insert: {
|
|
name: string
|
|
organization_id?: string | null
|
|
updated_at?: string
|
|
version_id: string
|
|
}
|
|
Update: {
|
|
name?: string
|
|
organization_id?: string | null
|
|
updated_at?: string
|
|
version_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "skill_pointers_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "skill_pointers_version_id_fkey"
|
|
columns: ["version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "skill_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
skill_versions: {
|
|
Row: {
|
|
body: string
|
|
created_at: string
|
|
description: string
|
|
forked_from_version_id: string | null
|
|
id: string
|
|
manifest: Json
|
|
matcher: Json
|
|
name: string
|
|
organization_id: string | null
|
|
}
|
|
Insert: {
|
|
body: string
|
|
created_at?: string
|
|
description: string
|
|
forked_from_version_id?: string | null
|
|
id?: string
|
|
manifest?: Json
|
|
matcher?: Json
|
|
name: string
|
|
organization_id?: string | null
|
|
}
|
|
Update: {
|
|
body?: string
|
|
created_at?: string
|
|
description?: string
|
|
forked_from_version_id?: string | null
|
|
id?: string
|
|
manifest?: Json
|
|
matcher?: Json
|
|
name?: string
|
|
organization_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "skill_versions_forked_from_version_id_fkey"
|
|
columns: ["forked_from_version_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "skill_versions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "skill_versions_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
storage_redaction_queue: {
|
|
Row: {
|
|
attempts: number
|
|
bucket: string
|
|
enqueued_at: string
|
|
error_message: string | null
|
|
id: string
|
|
object_path: string
|
|
organization_id: string
|
|
processed_at: string | null
|
|
request_id: string | null
|
|
status: string
|
|
}
|
|
Insert: {
|
|
attempts?: number
|
|
bucket: string
|
|
enqueued_at?: string
|
|
error_message?: string | null
|
|
id?: string
|
|
object_path: string
|
|
organization_id: string
|
|
processed_at?: string | null
|
|
request_id?: string | null
|
|
status?: string
|
|
}
|
|
Update: {
|
|
attempts?: number
|
|
bucket?: string
|
|
enqueued_at?: string
|
|
error_message?: string | null
|
|
id?: string
|
|
object_path?: string
|
|
organization_id?: string
|
|
processed_at?: string | null
|
|
request_id?: string | null
|
|
status?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "storage_redaction_queue_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "storage_redaction_queue_request_id_fkey"
|
|
columns: ["request_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "lgpd_requests"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
system_update_runs: {
|
|
Row: {
|
|
dispatched_at: string
|
|
disputa_de_banco: boolean | null
|
|
finished_at: string | null
|
|
from_version: string
|
|
id: string
|
|
last_step: string | null
|
|
log_tail: string
|
|
passada_do_banco: number | null
|
|
requested_by: string | null
|
|
retentativas_do_banco: number | null
|
|
status: string
|
|
to_version: string
|
|
}
|
|
Insert: {
|
|
dispatched_at?: string
|
|
disputa_de_banco?: boolean | null
|
|
finished_at?: string | null
|
|
from_version?: string
|
|
id?: string
|
|
last_step?: string | null
|
|
log_tail?: string
|
|
passada_do_banco?: number | null
|
|
requested_by?: string | null
|
|
retentativas_do_banco?: number | null
|
|
status?: string
|
|
to_version?: string
|
|
}
|
|
Update: {
|
|
dispatched_at?: string
|
|
disputa_de_banco?: boolean | null
|
|
finished_at?: string | null
|
|
from_version?: string
|
|
id?: string
|
|
last_step?: string | null
|
|
log_tail?: string
|
|
passada_do_banco?: number | null
|
|
requested_by?: string | null
|
|
retentativas_do_banco?: number | null
|
|
status?: string
|
|
to_version?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
system_version: {
|
|
Row: {
|
|
agent_last_seen_at: string | null
|
|
changelog_raw: string
|
|
compare_failed: boolean
|
|
current_sha: string
|
|
current_version: string
|
|
has_known_release: boolean
|
|
id: number
|
|
latest_version: string
|
|
off_release: boolean
|
|
update_requested_at: string | null
|
|
update_requested_by: string | null
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
agent_last_seen_at?: string | null
|
|
changelog_raw?: string
|
|
compare_failed?: boolean
|
|
current_sha?: string
|
|
current_version?: string
|
|
has_known_release?: boolean
|
|
id?: number
|
|
latest_version?: string
|
|
off_release?: boolean
|
|
update_requested_at?: string | null
|
|
update_requested_by?: string | null
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
agent_last_seen_at?: string | null
|
|
changelog_raw?: string
|
|
compare_failed?: boolean
|
|
current_sha?: string
|
|
current_version?: string
|
|
has_known_release?: boolean
|
|
id?: number
|
|
latest_version?: string
|
|
off_release?: boolean
|
|
update_requested_at?: string | null
|
|
update_requested_by?: string | null
|
|
updated_at?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
tenant_integrations: {
|
|
Row: {
|
|
created_at: string
|
|
expires_at: string | null
|
|
id: string
|
|
last_health_check_at: string | null
|
|
last_sync_at: string | null
|
|
oauth_access_token_encrypted: string
|
|
oauth_refresh_token_encrypted: string | null
|
|
organization_id: string
|
|
provider: string
|
|
scopes: string[]
|
|
status: string
|
|
status_reason: string | null
|
|
store_metadata: Json
|
|
updated_at: string
|
|
webhook_path_token: string
|
|
webhook_secret_encrypted: string
|
|
webhook_subscriptions: Json
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
expires_at?: string | null
|
|
id?: string
|
|
last_health_check_at?: string | null
|
|
last_sync_at?: string | null
|
|
oauth_access_token_encrypted: string
|
|
oauth_refresh_token_encrypted?: string | null
|
|
organization_id: string
|
|
provider: string
|
|
scopes?: string[]
|
|
status?: string
|
|
status_reason?: string | null
|
|
store_metadata?: Json
|
|
updated_at?: string
|
|
webhook_path_token?: string
|
|
webhook_secret_encrypted: string
|
|
webhook_subscriptions?: Json
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
expires_at?: string | null
|
|
id?: string
|
|
last_health_check_at?: string | null
|
|
last_sync_at?: string | null
|
|
oauth_access_token_encrypted?: string
|
|
oauth_refresh_token_encrypted?: string | null
|
|
organization_id?: string
|
|
provider?: string
|
|
scopes?: string[]
|
|
status?: string
|
|
status_reason?: string | null
|
|
store_metadata?: Json
|
|
updated_at?: string
|
|
webhook_path_token?: string
|
|
webhook_secret_encrypted?: string
|
|
webhook_subscriptions?: Json
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "tenant_integrations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
user_organizations: {
|
|
Row: {
|
|
interface_settings: Json
|
|
accepted_at: string | null
|
|
calendar_trilha: number | null
|
|
created_at: string
|
|
id: string
|
|
invited_at: string | null
|
|
invited_by: string | null
|
|
organization_id: string
|
|
revoked_at: string | null
|
|
role: string
|
|
updated_at: string
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
interface_settings?: Json
|
|
accepted_at?: string | null
|
|
calendar_trilha?: number | null
|
|
created_at?: string
|
|
id?: string
|
|
invited_at?: string | null
|
|
invited_by?: string | null
|
|
organization_id: string
|
|
revoked_at?: string | null
|
|
role: string
|
|
updated_at?: string
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
interface_settings?: Json
|
|
accepted_at?: string | null
|
|
calendar_trilha?: number | null
|
|
created_at?: string
|
|
id?: string
|
|
invited_at?: string | null
|
|
invited_by?: string | null
|
|
organization_id?: string
|
|
revoked_at?: string | null
|
|
role?: string
|
|
updated_at?: string
|
|
user_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "user_organizations_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
user_recovery_codes: {
|
|
Row: {
|
|
code_hash: string
|
|
created_at: string
|
|
id: string
|
|
used_at: string | null
|
|
used_ip: unknown
|
|
user_id: string
|
|
}
|
|
Insert: {
|
|
code_hash: string
|
|
created_at?: string
|
|
id?: string
|
|
used_at?: string | null
|
|
used_ip?: unknown
|
|
user_id: string
|
|
}
|
|
Update: {
|
|
code_hash?: string
|
|
created_at?: string
|
|
id?: string
|
|
used_at?: string | null
|
|
used_ip?: unknown
|
|
user_id?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
voice_calls: {
|
|
Row: {
|
|
answered_at: string | null
|
|
channel_session_id: string
|
|
contact_id: string | null
|
|
created_at: string
|
|
created_by: string | null
|
|
direction: string
|
|
duration_ms: number | null
|
|
end_reason: string | null
|
|
ended_at: string | null
|
|
id: string
|
|
organization_id: string
|
|
peer_phone: string
|
|
started_at: string
|
|
status: string
|
|
updated_at: string
|
|
wacalls_call_id: string
|
|
}
|
|
Insert: {
|
|
answered_at?: string | null
|
|
channel_session_id: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by?: string | null
|
|
direction: string
|
|
duration_ms?: number | null
|
|
end_reason?: string | null
|
|
ended_at?: string | null
|
|
id?: string
|
|
organization_id: string
|
|
peer_phone: string
|
|
started_at?: string
|
|
status: string
|
|
updated_at?: string
|
|
wacalls_call_id: string
|
|
}
|
|
Update: {
|
|
answered_at?: string | null
|
|
channel_session_id?: string
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
created_by?: string | null
|
|
direction?: string
|
|
duration_ms?: number | null
|
|
end_reason?: string | null
|
|
ended_at?: string | null
|
|
id?: string
|
|
organization_id?: string
|
|
peer_phone?: string
|
|
started_at?: string
|
|
status?: string
|
|
updated_at?: string
|
|
wacalls_call_id?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "voice_calls_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "voice_calls_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "voice_calls_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
watchdog_cursors: {
|
|
Row: {
|
|
consumer: string
|
|
last_created_at: string
|
|
last_event_id: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
consumer: string
|
|
last_created_at?: string
|
|
last_event_id?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
consumer?: string
|
|
last_created_at?: string
|
|
last_event_id?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
webhook_events_log: {
|
|
Row: {
|
|
archived_at: string | null
|
|
attempts: number
|
|
channel_session_id: string | null
|
|
error_message: string | null
|
|
event_type: string | null
|
|
external_id: string | null
|
|
headers: Json | null
|
|
http_method: string
|
|
id: string
|
|
organization_id: string | null
|
|
payload_parsed: Json | null
|
|
processed_at: string | null
|
|
provider: string
|
|
raw_body: string | null
|
|
received_at: string
|
|
signature_header: string | null
|
|
status: string
|
|
valid_signature: boolean | null
|
|
webhook_path_token: string | null
|
|
}
|
|
Insert: {
|
|
archived_at?: string | null
|
|
attempts?: number
|
|
channel_session_id?: string | null
|
|
error_message?: string | null
|
|
event_type?: string | null
|
|
external_id?: string | null
|
|
headers?: Json | null
|
|
http_method?: string
|
|
id?: string
|
|
organization_id?: string | null
|
|
payload_parsed?: Json | null
|
|
processed_at?: string | null
|
|
provider?: string
|
|
raw_body?: string | null
|
|
received_at?: string
|
|
signature_header?: string | null
|
|
status?: string
|
|
valid_signature?: boolean | null
|
|
webhook_path_token?: string | null
|
|
}
|
|
Update: {
|
|
archived_at?: string | null
|
|
attempts?: number
|
|
channel_session_id?: string | null
|
|
error_message?: string | null
|
|
event_type?: string | null
|
|
external_id?: string | null
|
|
headers?: Json | null
|
|
http_method?: string
|
|
id?: string
|
|
organization_id?: string | null
|
|
payload_parsed?: Json | null
|
|
processed_at?: string | null
|
|
provider?: string
|
|
raw_body?: string | null
|
|
received_at?: string
|
|
signature_header?: string | null
|
|
status?: string
|
|
valid_signature?: boolean | null
|
|
webhook_path_token?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "webhook_events_log_channel_session_id_fkey"
|
|
columns: ["channel_session_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "channel_sessions"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
webhook_lead_captures: {
|
|
Row: {
|
|
captured_email: string | null
|
|
captured_name: string | null
|
|
captured_phone: string | null
|
|
contact_id: string | null
|
|
fields: Json
|
|
id: string
|
|
lead_id: string | null
|
|
organization_id: string
|
|
origin: string | null
|
|
outcome: string
|
|
received_at: string
|
|
reject_reason: string | null
|
|
remote_ip: unknown
|
|
request_id: string | null
|
|
source_name: string
|
|
user_agent: string | null
|
|
utm: Json
|
|
webhook_source_id: string | null
|
|
}
|
|
Insert: {
|
|
captured_email?: string | null
|
|
captured_name?: string | null
|
|
captured_phone?: string | null
|
|
contact_id?: string | null
|
|
fields?: Json
|
|
id?: string
|
|
lead_id?: string | null
|
|
organization_id: string
|
|
origin?: string | null
|
|
outcome: string
|
|
received_at?: string
|
|
reject_reason?: string | null
|
|
remote_ip?: unknown
|
|
request_id?: string | null
|
|
source_name: string
|
|
user_agent?: string | null
|
|
utm?: Json
|
|
webhook_source_id?: string | null
|
|
}
|
|
Update: {
|
|
captured_email?: string | null
|
|
captured_name?: string | null
|
|
captured_phone?: string | null
|
|
contact_id?: string | null
|
|
fields?: Json
|
|
id?: string
|
|
lead_id?: string | null
|
|
organization_id?: string
|
|
origin?: string | null
|
|
outcome?: string
|
|
received_at?: string
|
|
reject_reason?: string | null
|
|
remote_ip?: unknown
|
|
request_id?: string | null
|
|
source_name?: string
|
|
user_agent?: string | null
|
|
utm?: Json
|
|
webhook_source_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "webhook_lead_captures_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "webhook_lead_captures_lead_id_fkey"
|
|
columns: ["lead_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_leads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "webhook_lead_captures_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "webhook_lead_captures_webhook_source_id_fkey"
|
|
columns: ["webhook_source_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "webhook_sources"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
webhook_sources: {
|
|
Row: {
|
|
created_at: string
|
|
created_by_user_id: string | null
|
|
default_pipeline_id: string
|
|
default_stage_id: string
|
|
field_map: Json
|
|
id: string
|
|
is_active: boolean
|
|
kind: string
|
|
last_change_actor_kind: string | null
|
|
last_change_at: string | null
|
|
last_received_at: string | null
|
|
name: string
|
|
organization_id: string
|
|
path_token: string
|
|
redirect_to: string | null
|
|
secret_encrypted: string | null
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
default_pipeline_id: string
|
|
default_stage_id: string
|
|
field_map?: Json
|
|
id?: string
|
|
is_active?: boolean
|
|
kind?: string
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
last_received_at?: string | null
|
|
name: string
|
|
organization_id: string
|
|
path_token: string
|
|
redirect_to?: string | null
|
|
secret_encrypted?: string | null
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
created_by_user_id?: string | null
|
|
default_pipeline_id?: string
|
|
default_stage_id?: string
|
|
field_map?: Json
|
|
id?: string
|
|
is_active?: boolean
|
|
kind?: string
|
|
last_change_actor_kind?: string | null
|
|
last_change_at?: string | null
|
|
last_received_at?: string | null
|
|
name?: string
|
|
organization_id?: string
|
|
path_token?: string
|
|
redirect_to?: string | null
|
|
secret_encrypted?: string | null
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "webhook_sources_default_pipeline_id_fkey"
|
|
columns: ["default_pipeline_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_pipelines"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "webhook_sources_default_stage_id_fkey"
|
|
columns: ["default_stage_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_stages"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "webhook_sources_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
google_ads_landing_pages: {
|
|
Row: {
|
|
created_at: string
|
|
enabled: boolean
|
|
message_template: string
|
|
organization_id: string
|
|
updated_at: string
|
|
updated_by: string | null
|
|
whatsapp_e164: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
enabled?: boolean
|
|
message_template?: string
|
|
organization_id: string
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
whatsapp_e164: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
enabled?: boolean
|
|
message_template?: string
|
|
organization_id?: string
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
whatsapp_e164?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "google_ads_landing_pages_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: true
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
google_ads_click_refs: {
|
|
Row: {
|
|
contact_id: string | null
|
|
created_at: string
|
|
gbraid: string | null
|
|
gclid: string | null
|
|
id: string
|
|
matched_at: string | null
|
|
organization_id: string
|
|
query_raw: Json
|
|
token: string
|
|
wbraid: string | null
|
|
|
|
tracking_link_id: string | null
|
|
}
|
|
Insert: {
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
gbraid?: string | null
|
|
gclid?: string | null
|
|
id?: string
|
|
matched_at?: string | null
|
|
organization_id: string
|
|
query_raw?: Json
|
|
token: string
|
|
wbraid?: string | null
|
|
|
|
tracking_link_id?: string | null
|
|
}
|
|
Update: {
|
|
contact_id?: string | null
|
|
created_at?: string
|
|
gbraid?: string | null
|
|
gclid?: string | null
|
|
id?: string
|
|
matched_at?: string | null
|
|
organization_id?: string
|
|
query_raw?: Json
|
|
token?: string
|
|
wbraid?: string | null
|
|
|
|
tracking_link_id?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "google_ads_click_refs_contact_id_fkey"
|
|
columns: ["contact_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "contacts"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "google_ads_click_refs_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
|
|
ad_tracking_links: {
|
|
Row: {
|
|
id: string
|
|
organization_id: string
|
|
name: string
|
|
whatsapp_e164: string
|
|
message_template: string
|
|
use_case: string
|
|
utm: Json
|
|
enabled: boolean
|
|
created_at: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
id?: string
|
|
organization_id: string
|
|
name: string
|
|
whatsapp_e164: string
|
|
message_template: string
|
|
use_case: string
|
|
utm?: Json
|
|
enabled?: boolean
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
id?: string
|
|
organization_id?: string
|
|
name?: string
|
|
whatsapp_e164?: string
|
|
message_template?: string
|
|
use_case?: string
|
|
utm?: Json
|
|
enabled?: boolean
|
|
created_at?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ad_tracking_links_organization_id_fkey"
|
|
columns: [
|
|
"organization_id"
|
|
]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: [
|
|
"id"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
|
|
google_ads_conversion_rules: {
|
|
Row: {
|
|
category: string
|
|
channel: string
|
|
configured_at: string
|
|
created_at: string
|
|
enabled: boolean
|
|
event_name: string
|
|
google_action_id: string
|
|
id: string
|
|
included_in_conversions: boolean
|
|
label: string
|
|
organization_id: string
|
|
stage_id: string
|
|
updated_at: string
|
|
updated_by: string | null
|
|
}
|
|
Insert: {
|
|
category?: string
|
|
channel?: string
|
|
configured_at?: string
|
|
created_at?: string
|
|
enabled?: boolean
|
|
event_name: string
|
|
google_action_id: string
|
|
id?: string
|
|
included_in_conversions?: boolean
|
|
label: string
|
|
organization_id: string
|
|
stage_id: string
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Update: {
|
|
category?: string
|
|
channel?: string
|
|
configured_at?: string
|
|
created_at?: string
|
|
enabled?: boolean
|
|
event_name?: string
|
|
google_action_id?: string
|
|
id?: string
|
|
included_in_conversions?: boolean
|
|
label?: string
|
|
organization_id?: string
|
|
stage_id?: string
|
|
updated_at?: string
|
|
updated_by?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "google_ads_conversion_rules_organization_id_fkey"
|
|
columns: [
|
|
"organization_id"
|
|
]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: [
|
|
"id"
|
|
]
|
|
},
|
|
{
|
|
foreignKeyName: "google_ads_conversion_rules_stage_org_fk"
|
|
columns: [
|
|
"organization_id",
|
|
"stage_id"
|
|
]
|
|
isOneToOne: false
|
|
referencedRelation: "crm_stages"
|
|
referencedColumns: [
|
|
"organization_id",
|
|
"id"
|
|
]
|
|
}
|
|
]
|
|
}
|
|
}
|
|
Views: {
|
|
calendar_google_reconcilable_appointments: {
|
|
Row: Database["public"]["Tables"]["calendar_appointments"]["Row"]
|
|
Relationships: Database["public"]["Tables"]["calendar_appointments"]["Relationships"]
|
|
}
|
|
calendar_selected_external_events: {
|
|
Row: Omit<Database["public"]["Tables"]["calendar_external_events"]["Row"], "starts_at" | "ends_at" | "title"> & { starts_at: string; ends_at: string }
|
|
Relationships: Database["public"]["Tables"]["calendar_external_events"]["Relationships"]
|
|
}
|
|
|
|
ai_provider_credentials_safe: {
|
|
Row: {
|
|
api_key_last4: string | null
|
|
created_at: string | null
|
|
created_by: string | null
|
|
id: string | null
|
|
is_active: boolean | null
|
|
label: string | null
|
|
models_available: string[] | null
|
|
organization_id: string | null
|
|
provider: string | null
|
|
updated_at: string | null
|
|
validated_at: string | null
|
|
validation_error: string | null
|
|
}
|
|
Insert: {
|
|
api_key_last4?: string | null
|
|
created_at?: string | null
|
|
created_by?: string | null
|
|
id?: string | null
|
|
is_active?: boolean | null
|
|
label?: string | null
|
|
models_available?: string[] | null
|
|
organization_id?: string | null
|
|
provider?: string | null
|
|
updated_at?: string | null
|
|
validated_at?: string | null
|
|
validation_error?: string | null
|
|
}
|
|
Update: {
|
|
api_key_last4?: string | null
|
|
created_at?: string | null
|
|
created_by?: string | null
|
|
id?: string | null
|
|
is_active?: boolean | null
|
|
label?: string | null
|
|
models_available?: string[] | null
|
|
organization_id?: string | null
|
|
provider?: string | null
|
|
updated_at?: string | null
|
|
validated_at?: string | null
|
|
validation_error?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "ai_provider_credentials_organization_id_fkey"
|
|
columns: ["organization_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "organizations"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
}
|
|
Functions: {
|
|
fn_channel_routing_claim: {
|
|
Args: {
|
|
p_channel: string
|
|
p_conversation: string
|
|
p_org: string
|
|
p_reason?: string
|
|
p_schedule?: Json
|
|
p_user: string
|
|
}
|
|
Returns: string
|
|
}
|
|
fn_set_channel_routing: {
|
|
Args: {
|
|
p_channel: string
|
|
p_org: string
|
|
p_reset?: boolean
|
|
p_users: string[]
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_request_channel_routing: {
|
|
Args: { p_conversation: string; p_org: string }
|
|
Returns: undefined
|
|
}
|
|
fn_wake_channel_routing: {
|
|
Args: { p_channel?: string; p_org: string }
|
|
Returns: undefined
|
|
}
|
|
fn_routing_unassigned_notice: {
|
|
Args: { p_conversation: string; p_org: string; p_reason: string }
|
|
Returns: undefined
|
|
}
|
|
fn_reserve_channel_connection: {
|
|
Args: {
|
|
p_display_name?: string
|
|
p_hash: string
|
|
p_key: string
|
|
p_onboarding?: boolean
|
|
p_org: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_admit_catalog: {
|
|
Args: {
|
|
p_actor: string
|
|
p_digest: string
|
|
p_operation: string
|
|
p_snapshot: Json
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_assert_actor: {
|
|
Args: { p_actor: string; p_organization?: string }
|
|
Returns: undefined
|
|
}
|
|
fn_extensions_cancel_install: {
|
|
Args: { p_actor: string; p_operation: string }
|
|
Returns: Json
|
|
}
|
|
fn_extensions_configure: {
|
|
Args: {
|
|
p_actor: string
|
|
p_configuration: Json
|
|
p_enabled: boolean
|
|
p_expected_revision: number
|
|
p_installation: string
|
|
p_operation: string
|
|
p_organization: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_core_update_in_progress: { Args: never; Returns: boolean }
|
|
fn_extensions_fail_install: {
|
|
Args: { p_actor: string; p_error_code: string; p_operation: string }
|
|
Returns: Json
|
|
}
|
|
fn_extensions_fingerprint: { Args: { p_request: Json }; Returns: string }
|
|
fn_extensions_finish_install: {
|
|
Args: {
|
|
p_actor: string
|
|
p_byte_length: number
|
|
p_document: string
|
|
p_manifest: Json
|
|
p_operation: string
|
|
p_sha256: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_installation_counts: {
|
|
Args: { p_actor: string }
|
|
Returns: {
|
|
active_organizations: number
|
|
awaiting_reactivation: number
|
|
installation_id: string
|
|
}[]
|
|
}
|
|
fn_extensions_prepare_install: {
|
|
Args: {
|
|
p_actor: string
|
|
p_catalog: string
|
|
p_expected_installation_revision: number
|
|
p_name: string
|
|
p_operation: string
|
|
p_publisher: string
|
|
p_version: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_remove_installation: {
|
|
Args: {
|
|
p_actor: string
|
|
p_expected_installation_revision: number
|
|
p_installation: string
|
|
p_operation: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_extensions_revert_install: {
|
|
Args: {
|
|
p_actor: string
|
|
p_expected_installation_revision: number
|
|
p_installation: string
|
|
p_operation: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_finish_channel_connection: {
|
|
Args: {
|
|
p_created?: boolean
|
|
p_lease: string
|
|
p_org: string
|
|
p_reason?: string
|
|
p_receipt: string
|
|
p_status: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
|
|
fn_google_appointment: { Args: { p_org: string; p_id: string; p_action: string; p_args?: Json }; Returns: Json }
|
|
fn_google_calendar: { Args: { p_org: string; p_id: string; p_action: string; p_args?: Json }; Returns: Json }
|
|
fn_google_calendar_fence: { Args: { p_org: string; p_id: string; p_claim: Json; p_cursor?: Json }; Returns: undefined }
|
|
fn_google_catalog: { Args: { p_org: string; p_connection: string; p_items: Json; p_revision: string }; Returns: undefined }
|
|
fn_google_selection: { Args: { p_org: string; p_revisions: Json; p_sources: string[]; p_destination: string }; Returns: undefined }
|
|
fn_meet_delivery_policy: { Args: { p_org:string; p_job:string; p_worker:string; p_acquired_at:string }; Returns:Json }
|
|
fn_meet_delivery_current: { Args: { p_org:string; p_job:string; p_worker:string; p_acquired_at:string }; Returns:boolean }
|
|
fn_meet_delivery_settle: { Args: { p_org:string; p_job:string; p_worker:string; p_acquired_at:string; p_state:string; p_retry_at?:string|null }; Returns:boolean }
|
|
fn_meet_action: { Args: { p_org:string; p_id:string; p_revision:string; p_request:string|null; p_action:string; p_conversation?:string|null }; Returns:boolean }
|
|
fn_google_resolve: { Args: { p_org: string; p_id: string; p_revision: string; p_local_revision: string; p_etag: string | null; p_choice: string }; Returns: undefined }
|
|
fn_google_counts_for_conflicts: { Args: { p_org: string; p_connection: string; p_calendar: string }; Returns: boolean }
|
|
fn_google_coverage: { Args: { p_org: string; p_owner: string; p_start: string; p_end: string }; Returns: boolean }
|
|
fn_agenda_ocupacao_google_do_dono: {
|
|
Args: { p_org: string; p_owner: string; p_de: string; p_ate: string }
|
|
Returns: { starts_at: string; ends_at: string; transparency: string; status: string; connection_status: string }[]
|
|
}
|
|
fn_agenda_conexoes_google_do_dono: {
|
|
Args: { p_org: string; p_owner: string }
|
|
Returns: { status: string; last_sync_at: string | null }[]
|
|
}
|
|
fn_appointment_change_core: { Args: { p_org: string; p_id: string; p_revision: number; p_patch: Json; p_remote: boolean; p_base: Json }; Returns: Json }
|
|
|
|
fn_followup_job_current: { Args: { p_org: string; p_job: string; p_enrollment: string; p_node: string }; Returns: boolean }
|
|
fn_agenda_minutes: { Args: { p_settings: Json; p_key: string; p_default: number }; Returns: number }
|
|
fn_followup_claim_current: { Args: { p_org: string; p_job: string; p_worker: string; p_acquired_at: string }; Returns: boolean }
|
|
fn_appointment_change: { Args: { p_org: string; p_id: string; p_revision: number; p_patch: Json }; Returns: Json }
|
|
fn_appointment_recover: { Args: { p_org: string; p_event: string }; Returns: Json }
|
|
fn_appointment_confirmation_sweep: { Args: { p_limit?: number; p_now?: string }; Returns: number }
|
|
fn_appointment_enrollment_current: { Args: { p_org: string; p_id: string; p_node?: string | null }; Returns: boolean }
|
|
fn_agenda_settings: { Args: { p_org: string; p_config: Json }; Returns: Json }
|
|
fn_colegas_podem_mexer_na_agenda: { Args: { p_org: string }; Returns: boolean }
|
|
fn_definir_colegas_podem_mexer_na_agenda: { Args: { p_org: string; p_ligado: boolean }; Returns: Json }
|
|
fn_definir_cliente_pela_agenda: { Args: { p_ligado: boolean; p_org: string }; Returns: Json }
|
|
fn_followup_patch: { Args: { p_org: string; p_id: string; p_revision: number; p_patch: Json }; Returns: number }
|
|
fn_followup_apply_step: { Args: { p_org: string; p_id: string; p_revision: number; p_patch: Json; p_event: Json }; Returns: number }
|
|
fn_followup_inline_settle: { Args: { p_org: string; p_id: string; p_worker: string; p_done: boolean; p_error?: string | null; p_retry_at?: string | null; p_hold?: boolean; p_acquired_at?: string }; Returns: boolean }
|
|
fn_service_observe_command: { Args: { p_org: string; p_contact: string }; Returns: Json }
|
|
fn_service_event_origin: {
|
|
Args: { p_org: string; p_event: string; p_contact: string; p_session?: string }
|
|
Returns: Json
|
|
}
|
|
|
|
fn_service_observe: {
|
|
Args: { p_contact: string; p_org: string }
|
|
Returns: Json
|
|
}
|
|
fn_service_boundary: {
|
|
Args: { p_conversation: string; p_org: string }
|
|
Returns: Json
|
|
}
|
|
fn_service_begin: {
|
|
Args: {
|
|
p_contact: string
|
|
p_observed?: Json
|
|
p_org: string
|
|
p_session?: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_demanda_encerrar: {
|
|
Args: {
|
|
p_actor: string
|
|
p_demanda: string
|
|
p_desfecho: string
|
|
p_expected: number
|
|
p_org: string
|
|
}
|
|
Returns: {
|
|
aberta_em: string
|
|
agent_case_id: string | null
|
|
assunto: string | null
|
|
contact_id: string
|
|
created_at: string
|
|
desfecho: string | null
|
|
dono_kind: string
|
|
dono_user_id: string | null
|
|
encerrada_por: string | null
|
|
estado: string
|
|
fechada_em: string | null
|
|
id: string
|
|
lead_id: string | null
|
|
organization_id: string
|
|
origem: string
|
|
prazo_em: string | null
|
|
proximo_passo: string | null
|
|
proximo_passo_em: string | null
|
|
revision: number
|
|
updated_at: string
|
|
}
|
|
SetofOptions: {
|
|
from: "*"
|
|
to: "demandas"
|
|
isOneToOne: true
|
|
isSetofReturn: false
|
|
}
|
|
}
|
|
fn_service_status: {
|
|
Args: {
|
|
p_conversation: string
|
|
p_expected?: number
|
|
p_org: string
|
|
p_status: string
|
|
}
|
|
Returns: {
|
|
active_agent_set_at: string | null
|
|
active_ai_agent_id: string | null
|
|
active_intent: string | null
|
|
assigned_at: string | null
|
|
assigned_to_user_id: string | null
|
|
assigned_to_user_name: string | null
|
|
assignee_kind: string | null
|
|
awaiting_since: string | null
|
|
bot_silenced_until: string | null
|
|
channel: string
|
|
channel_session_id: string
|
|
contact_id: string
|
|
created_at: string
|
|
current_demanda_id: string | null
|
|
group_chat_id: string | null
|
|
id: string
|
|
is_group: boolean
|
|
last_handoff_at: string | null
|
|
last_handoff_reason: string | null
|
|
last_inbound_at: string | null
|
|
last_message_at: string | null
|
|
last_message_preview: string | null
|
|
last_outbound_at: string | null
|
|
metadata: Json
|
|
organization_id: string
|
|
provider_conversation_id: string | null
|
|
rag_review_status: string | null
|
|
service_closed_at: string | null
|
|
service_revision: number
|
|
service_started_at: string | null
|
|
snooze_until: string | null
|
|
snoozed_at: string | null
|
|
snoozed_by_user_id: string | null
|
|
status: string
|
|
status_changed_at: string
|
|
tags: string[]
|
|
unread_count_for_assignee: number
|
|
updated_at: string
|
|
usable_for_rag: boolean
|
|
usable_for_rag_marked_at: string | null
|
|
usable_for_rag_marked_by: string | null
|
|
}
|
|
SetofOptions: {
|
|
from: "*"
|
|
to: "conversations"
|
|
isOneToOne: true
|
|
isSetofReturn: false
|
|
}
|
|
}
|
|
fn_service_inbound: { Args: { p_message: string }; Returns: undefined }
|
|
fn_service_lock: {
|
|
Args: { p_contact: string; p_org: string }
|
|
Returns: undefined
|
|
}
|
|
fn_create_tenant_with_owner: {
|
|
Args: { p_actor: string; p_key: string; p_request: Json; p_hash: string }
|
|
Returns: Json
|
|
}
|
|
fn_accept_team_invite: {
|
|
Args: { p_user: string; p_org: string; p_role: string; p_invited_by: string | null; p_issued_at: string | null; p_invited_at: string; p_interface_settings?: Json }
|
|
Returns: Json
|
|
}
|
|
|
|
fn_support_context: { Args: Record<PropertyKey, never>; Returns: Json }
|
|
fn_support_write_allowed: { Args: { p_org: string }; Returns: boolean }
|
|
fn_support_storage_write_allowed: { Args: { p_name: string }; Returns: boolean }
|
|
fn_support_callback_write_allowed: { Args: { p_org: string; p_actor?: string; p_session?: string }; Returns: boolean }
|
|
fn_start_support: { Args: { p_actor: string; p_session: string; p_org: string; p_previous: string | null; p_mode?: string; p_ttl?: number }; Returns: string }
|
|
fn_end_support: { Args: { p_actor: string; p_session: string }; Returns: Json }
|
|
|
|
activate_kb_version: {
|
|
Args: { p_agent_id: string; p_version_id: string }
|
|
Returns: undefined
|
|
}
|
|
fn_solicitar_reenvio_conversao:
|
|
| { Args: { p_lead: string; p_org: string }; Returns: boolean }
|
|
| {
|
|
Args: { p_event: string; p_lead: string; p_org: string }
|
|
Returns: boolean
|
|
}
|
|
emit_event: {
|
|
Args: {
|
|
p_entity_id: string
|
|
p_entity_kind: string
|
|
p_event_type: string
|
|
p_metadata?: Json
|
|
p_organization_id?: string
|
|
p_payload?: Json
|
|
}
|
|
Returns: string
|
|
}
|
|
fn_agent_tool_usage: {
|
|
Args: { p_agent_id: string; p_organization_id: string; p_since: string }
|
|
Returns: {
|
|
em_teste: number
|
|
falhas: number
|
|
tool_name: string
|
|
total: number
|
|
ultima_vez: string
|
|
}[]
|
|
}
|
|
fn_agora: { Args: never; Returns: string }
|
|
fn_aplicar_quadro_do_onboarding: {
|
|
Args: {
|
|
p_etapas: Json
|
|
p_nome: string
|
|
p_organization_id: string
|
|
p_pipeline_id: string
|
|
p_slug: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_atrito_jaccard: { Args: { a: string; b: string }; Returns: number }
|
|
fn_atrito_metrics: {
|
|
Args: {
|
|
p_abandono_horas?: number
|
|
p_espera_horas?: number
|
|
p_from: string
|
|
p_org: string
|
|
p_repeticao_min?: number
|
|
p_to: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_attendant_metrics: {
|
|
Args: { p_from: string; p_org: string; p_owner?: string; p_to: string }
|
|
Returns: Json
|
|
}
|
|
fn_buscar_trechos_das_fontes: {
|
|
Args: {
|
|
p_embedding: string
|
|
p_embedding_model?: string
|
|
p_k?: number
|
|
p_organization_id: string
|
|
p_source_ids: string[]
|
|
p_threshold?: number
|
|
}
|
|
Returns: {
|
|
chunk_id: string
|
|
content: string
|
|
knowledge_source_id: string
|
|
metadata: Json
|
|
similarity: number
|
|
source_name: string
|
|
}[]
|
|
}
|
|
fn_can_view_conversation: {
|
|
Args: { p_assigned_to_user_id: string; p_org: string }
|
|
Returns: boolean
|
|
}
|
|
fn_can_view_lead: {
|
|
Args: { p_org: string; p_owner_user_id: string }
|
|
Returns: boolean
|
|
}
|
|
fn_claim_due_followup_enrollments: {
|
|
Args: { p_lease_seconds: number; p_limit: number }
|
|
Returns: {
|
|
agent_id: string | null
|
|
attempts: number
|
|
cancel_reason: string | null
|
|
claimed_until: string | null
|
|
completed_at: string | null
|
|
contact_id: string
|
|
conversation_id: string | null
|
|
current_node_id: string
|
|
id: string
|
|
last_error: string | null
|
|
max_attempts: number
|
|
next_eval_at: string | null
|
|
organization_id: string
|
|
outcome: string | null
|
|
pointer_id: string
|
|
started_at: string
|
|
status: string
|
|
steps_taken: number
|
|
timing_plan: Json | null
|
|
updated_at: string
|
|
version_id: string
|
|
}[]
|
|
SetofOptions: {
|
|
from: "*"
|
|
to: "followup_enrollments"
|
|
isOneToOne: false
|
|
isSetofReturn: true
|
|
}
|
|
}
|
|
fn_configurar_pre_go_live_canal: {
|
|
Args: {
|
|
p_canal: string
|
|
p_modo: string
|
|
p_numeros: string[]
|
|
p_org: string
|
|
}
|
|
Returns: number
|
|
}
|
|
fn_conversation_assign: {
|
|
Args: {
|
|
p_conversation_id: string
|
|
p_enforce_expected?: boolean
|
|
p_expected_assignee?: string
|
|
p_organization_id: string
|
|
p_reason: string
|
|
p_to_user_id: string
|
|
}
|
|
Returns: {
|
|
active_agent_set_at: string | null
|
|
active_ai_agent_id: string | null
|
|
active_intent: string | null
|
|
assigned_at: string | null
|
|
assigned_to_user_id: string | null
|
|
assigned_to_user_name: string | null
|
|
assignee_kind: string | null
|
|
awaiting_since: string | null
|
|
bot_silenced_until: string | null
|
|
channel: string
|
|
channel_session_id: string
|
|
contact_id: string
|
|
created_at: string
|
|
group_chat_id: string | null
|
|
id: string
|
|
is_group: boolean
|
|
last_handoff_at: string | null
|
|
last_handoff_reason: string | null
|
|
last_inbound_at: string | null
|
|
last_message_at: string | null
|
|
last_message_preview: string | null
|
|
last_outbound_at: string | null
|
|
metadata: Json
|
|
organization_id: string
|
|
provider_conversation_id: string | null
|
|
rag_review_status: string | null
|
|
snooze_until: string | null
|
|
snoozed_at: string | null
|
|
snoozed_by_user_id: string | null
|
|
status: string
|
|
status_changed_at: string
|
|
tags: string[]
|
|
unread_count_for_assignee: number
|
|
updated_at: string
|
|
usable_for_rag: boolean
|
|
usable_for_rag_marked_at: string | null
|
|
usable_for_rag_marked_by: string | null
|
|
}[]
|
|
SetofOptions: {
|
|
from: "*"
|
|
to: "conversations"
|
|
isOneToOne: false
|
|
isSetofReturn: true
|
|
}
|
|
}
|
|
fn_decrypt_oauth: { Args: { ciphertext: string }; Returns: string }
|
|
fn_definir_logo_da_organizacao: {
|
|
Args: { p_actor: string; p_org: string; p_path: string }
|
|
Returns: number
|
|
}
|
|
fn_definir_marca_da_organizacao: {
|
|
Args: { p_actor: string; p_marca: Json; p_org: string }
|
|
Returns: number
|
|
}
|
|
fn_encrypt_oauth: { Args: { plaintext: string }; Returns: string }
|
|
fn_estampar_atribuicao_de_anuncio: {
|
|
Args: {
|
|
p_contact: string
|
|
p_metadata: Json
|
|
p_org: string
|
|
p_platform: string
|
|
}
|
|
Returns: undefined
|
|
}
|
|
fn_expurgar_auditoria_vencida: {
|
|
Args: { p_limite?: number; p_retencao_dias?: number }
|
|
Returns: number
|
|
}
|
|
fn_expurgar_espelho_da_agenda: {
|
|
Args: { p_limite?: number; p_retencao_dias?: number }
|
|
Returns: number
|
|
}
|
|
fn_expurgar_nonces_de_oauth: {
|
|
Args: { p_dias: number; p_lote?: number }
|
|
Returns: number
|
|
}
|
|
fn_followup_turno_descartado: {
|
|
Args: { p_job: string; p_org: string }
|
|
Returns: boolean
|
|
}
|
|
fn_gasto_de_ia_do_mes: { Args: { p_org: string }; Returns: number }
|
|
fn_is_platform_admin: { Args: never; Returns: boolean }
|
|
fn_lgpd_anonymize_contact: {
|
|
Args: { p_contact_id: string; p_organization_id: string }
|
|
Returns: Json
|
|
}
|
|
fn_lgpd_cascade_redact_contact: {
|
|
Args: {
|
|
p_contact_id: string
|
|
p_organization_id: string
|
|
p_request_id: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_log_event: {
|
|
Args: {
|
|
p_event_type: string
|
|
p_organization_id: string
|
|
p_payload?: Json
|
|
}
|
|
Returns: string
|
|
}
|
|
fn_mark_conversation_message: {
|
|
Args: {
|
|
p_at: string
|
|
p_conv: string
|
|
p_direction: string
|
|
p_preview: string
|
|
}
|
|
Returns: undefined
|
|
}
|
|
fn_member_role_in_org: {
|
|
Args: { p_org: string; p_user: string }
|
|
Returns: string
|
|
}
|
|
fn_mesclar_contatos: {
|
|
Args: {
|
|
p_contato_principal: string
|
|
p_contatos_secundarios: string[]
|
|
p_organization_id: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_mover_leads_em_lote: {
|
|
Args: {
|
|
p_lead_ids: string[]
|
|
p_lost_reason?: string
|
|
p_organization_id: string
|
|
p_stage_id: string
|
|
}
|
|
Returns: {
|
|
from_stage_id: string
|
|
lead_id: string
|
|
pipeline_id: string
|
|
}[]
|
|
}
|
|
fn_org_operante: { Args: { p_org: string }; Returns: boolean }
|
|
fn_podar_fila_de_jobs: {
|
|
Args: { p_limite?: number; p_retencao_dias?: number }
|
|
Returns: number
|
|
}
|
|
fn_reativar_organizacao: {
|
|
Args: { p_ator: string; p_kind_exigido: string; p_org: string }
|
|
Returns: Json
|
|
}
|
|
fn_reply_action: {
|
|
Args: {
|
|
p_org: string;
|
|
p_id: string;
|
|
p_revision: string;
|
|
p_action: string;
|
|
p_body?: string | null;
|
|
p_feedback?: string | null;
|
|
};
|
|
Returns: string;
|
|
}
|
|
fn_agent_legacy_notice: {
|
|
Args: {p_org:string;p_agent:string;p_code:string;p_title:string;p_body:string};
|
|
Returns:boolean;
|
|
}
|
|
fn_reply_record_receipt: {
|
|
Args: {p_org:string;p_job:string;p_worker:string;p_acquired_at:string;p_message:string;p_external:string|null;p_echo_ids?:string[]};
|
|
Returns:Json;
|
|
}
|
|
fn_reply_receipt_policy: {
|
|
Args: { p_org: string; p_job: string; p_worker: string; p_acquired_at: string };
|
|
Returns: Json;
|
|
}
|
|
fn_reply_delivery_policy: {
|
|
Args: { p_org: string; p_job: string; p_worker: string; p_acquired_at: string };
|
|
Returns: Json;
|
|
}
|
|
fn_reply_prepare: {
|
|
Args: { p_org: string; p_job: string; p_worker: string; p_acquired_at: string };
|
|
Returns: boolean;
|
|
}
|
|
fn_publish_ai_agent_version: {
|
|
Args: { p_agent_id: string; p_org_id: string; p_version_id: string; p_platform_credential_verified?:boolean; p_expected_provenance?:string|null }
|
|
Returns: {
|
|
agent_id: string
|
|
previous_version_id: string
|
|
published_at: string
|
|
version_id: string
|
|
}[]
|
|
}
|
|
fn_publish_followup_flow_version: {
|
|
Args: {
|
|
p_created_by: string
|
|
p_graph: Json
|
|
p_org: string
|
|
p_pointer: string
|
|
}
|
|
Returns: string
|
|
}
|
|
fn_proposta_aloca_numero: {
|
|
Args: { p_org: string; p_ano: number }
|
|
Returns: number
|
|
}
|
|
fn_role_at_least: {
|
|
Args: { p_min: string; p_org: string }
|
|
Returns: boolean
|
|
}
|
|
fn_semear_tipos_de_agendamento: {
|
|
Args: { p_organization_id: string }
|
|
Returns: number
|
|
}
|
|
fn_suspender_organizacao: {
|
|
Args: {
|
|
p_ator: string
|
|
p_kind: string
|
|
p_motivo: string
|
|
p_org: string
|
|
}
|
|
Returns: Json
|
|
}
|
|
fn_upsert_wa_contact: {
|
|
Args: {
|
|
p_chat_id: string
|
|
p_kind: string
|
|
p_lid: string
|
|
p_notify: string
|
|
p_org: string
|
|
p_phone: string
|
|
}
|
|
Returns: string
|
|
}
|
|
fn_upsert_wa_conversation: {
|
|
Args: { p_contact: string; p_org: string; p_session: string }
|
|
Returns: string
|
|
}
|
|
fn_user_org_ids: { Args: never; Returns: string[] }
|
|
fn_user_role_in: { Args: { p_org: string }; Returns: number }
|
|
fn_user_role_in_org: { Args: { p_org: string }; Returns: string }
|
|
midpoint: { Args: { p_next: number; p_prev: number }; Returns: number }
|
|
retrieve_top_k_chunks: {
|
|
Args: {
|
|
p_embedding: string
|
|
p_k?: number
|
|
p_kb_version_id: string
|
|
p_organization_id: string
|
|
p_threshold?: number
|
|
}
|
|
Returns: {
|
|
chunk_id: string
|
|
content: string
|
|
knowledge_source_id: string
|
|
metadata: Json
|
|
similarity: number
|
|
}[]
|
|
}
|
|
show_limit: { Args: never; Returns: number }
|
|
show_trgm: { Args: { "": string }; Returns: string[] }
|
|
|
|
fn_metricas_links_rastreaveis: {
|
|
Args: {
|
|
p_org: string
|
|
}
|
|
Returns: {
|
|
link_id: string
|
|
clicks: number
|
|
contacts: number
|
|
leads: number
|
|
}[]
|
|
}
|
|
}
|
|
Enums: {
|
|
[_ in never]: never
|
|
}
|
|
CompositeTypes: {
|
|
[_ in never]: never
|
|
}
|
|
}
|
|
storage: {
|
|
Tables: {
|
|
buckets: {
|
|
Row: {
|
|
allowed_mime_types: string[] | null
|
|
avif_autodetection: boolean | null
|
|
created_at: string | null
|
|
file_size_limit: number | null
|
|
id: string
|
|
name: string
|
|
owner: string | null
|
|
owner_id: string | null
|
|
public: boolean | null
|
|
type: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at: string | null
|
|
versioning_status: string
|
|
}
|
|
Insert: {
|
|
allowed_mime_types?: string[] | null
|
|
avif_autodetection?: boolean | null
|
|
created_at?: string | null
|
|
file_size_limit?: number | null
|
|
id: string
|
|
name: string
|
|
owner?: string | null
|
|
owner_id?: string | null
|
|
public?: boolean | null
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string | null
|
|
versioning_status?: string
|
|
}
|
|
Update: {
|
|
allowed_mime_types?: string[] | null
|
|
avif_autodetection?: boolean | null
|
|
created_at?: string | null
|
|
file_size_limit?: number | null
|
|
id?: string
|
|
name?: string
|
|
owner?: string | null
|
|
owner_id?: string | null
|
|
public?: boolean | null
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string | null
|
|
versioning_status?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
buckets_analytics: {
|
|
Row: {
|
|
created_at: string
|
|
deleted_at: string | null
|
|
format: string
|
|
id: string
|
|
name: string
|
|
type: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
deleted_at?: string | null
|
|
format?: string
|
|
id?: string
|
|
name: string
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
deleted_at?: string | null
|
|
format?: string
|
|
id?: string
|
|
name?: string
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
buckets_vectors: {
|
|
Row: {
|
|
created_at: string
|
|
id: string
|
|
type: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
created_at?: string
|
|
id: string
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
created_at?: string
|
|
id?: string
|
|
type?: Database["storage"]["Enums"]["buckettype"]
|
|
updated_at?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
migrations: {
|
|
Row: {
|
|
executed_at: string | null
|
|
hash: string
|
|
id: number
|
|
name: string
|
|
}
|
|
Insert: {
|
|
executed_at?: string | null
|
|
hash: string
|
|
id: number
|
|
name: string
|
|
}
|
|
Update: {
|
|
executed_at?: string | null
|
|
hash?: string
|
|
id?: number
|
|
name?: string
|
|
}
|
|
Relationships: []
|
|
}
|
|
objects: {
|
|
Row: {
|
|
archived_at: string | null
|
|
bucket_id: string | null
|
|
created_at: string | null
|
|
id: string
|
|
is_delete_marker: boolean
|
|
is_versioned: boolean
|
|
last_accessed_at: string | null
|
|
metadata: Json | null
|
|
name: string | null
|
|
owner: string | null
|
|
owner_id: string | null
|
|
path_tokens: string[] | null
|
|
updated_at: string | null
|
|
user_metadata: Json | null
|
|
version: string | null
|
|
}
|
|
Insert: {
|
|
archived_at?: string | null
|
|
bucket_id?: string | null
|
|
created_at?: string | null
|
|
id?: string
|
|
is_delete_marker?: boolean
|
|
is_versioned?: boolean
|
|
last_accessed_at?: string | null
|
|
metadata?: Json | null
|
|
name?: string | null
|
|
owner?: string | null
|
|
owner_id?: string | null
|
|
path_tokens?: string[] | null
|
|
updated_at?: string | null
|
|
user_metadata?: Json | null
|
|
version?: string | null
|
|
}
|
|
Update: {
|
|
archived_at?: string | null
|
|
bucket_id?: string | null
|
|
created_at?: string | null
|
|
id?: string
|
|
is_delete_marker?: boolean
|
|
is_versioned?: boolean
|
|
last_accessed_at?: string | null
|
|
metadata?: Json | null
|
|
name?: string | null
|
|
owner?: string | null
|
|
owner_id?: string | null
|
|
path_tokens?: string[] | null
|
|
updated_at?: string | null
|
|
user_metadata?: Json | null
|
|
version?: string | null
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "objects_bucketId_fkey"
|
|
columns: ["bucket_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "buckets"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
s3_multipart_uploads: {
|
|
Row: {
|
|
bucket_id: string
|
|
created_at: string
|
|
id: string
|
|
in_progress_size: number
|
|
key: string
|
|
metadata: Json | null
|
|
owner_id: string | null
|
|
upload_signature: string
|
|
user_metadata: Json | null
|
|
version: string
|
|
}
|
|
Insert: {
|
|
bucket_id: string
|
|
created_at?: string
|
|
id: string
|
|
in_progress_size?: number
|
|
key: string
|
|
metadata?: Json | null
|
|
owner_id?: string | null
|
|
upload_signature: string
|
|
user_metadata?: Json | null
|
|
version: string
|
|
}
|
|
Update: {
|
|
bucket_id?: string
|
|
created_at?: string
|
|
id?: string
|
|
in_progress_size?: number
|
|
key?: string
|
|
metadata?: Json | null
|
|
owner_id?: string | null
|
|
upload_signature?: string
|
|
user_metadata?: Json | null
|
|
version?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "s3_multipart_uploads_bucket_id_fkey"
|
|
columns: ["bucket_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "buckets"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
s3_multipart_uploads_parts: {
|
|
Row: {
|
|
bucket_id: string
|
|
created_at: string
|
|
etag: string
|
|
id: string
|
|
key: string
|
|
owner_id: string | null
|
|
part_number: number
|
|
size: number
|
|
upload_id: string
|
|
version: string
|
|
}
|
|
Insert: {
|
|
bucket_id: string
|
|
created_at?: string
|
|
etag: string
|
|
id?: string
|
|
key: string
|
|
owner_id?: string | null
|
|
part_number: number
|
|
size?: number
|
|
upload_id: string
|
|
version: string
|
|
}
|
|
Update: {
|
|
bucket_id?: string
|
|
created_at?: string
|
|
etag?: string
|
|
id?: string
|
|
key?: string
|
|
owner_id?: string | null
|
|
part_number?: number
|
|
size?: number
|
|
upload_id?: string
|
|
version?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "s3_multipart_uploads_parts_bucket_id_fkey"
|
|
columns: ["bucket_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "buckets"
|
|
referencedColumns: ["id"]
|
|
},
|
|
{
|
|
foreignKeyName: "s3_multipart_uploads_parts_upload_id_fkey"
|
|
columns: ["upload_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "s3_multipart_uploads"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
vector_indexes: {
|
|
Row: {
|
|
bucket_id: string
|
|
created_at: string
|
|
data_type: string
|
|
dimension: number
|
|
distance_metric: string
|
|
id: string
|
|
metadata_configuration: Json | null
|
|
name: string
|
|
updated_at: string
|
|
}
|
|
Insert: {
|
|
bucket_id: string
|
|
created_at?: string
|
|
data_type: string
|
|
dimension: number
|
|
distance_metric: string
|
|
id?: string
|
|
metadata_configuration?: Json | null
|
|
name: string
|
|
updated_at?: string
|
|
}
|
|
Update: {
|
|
bucket_id?: string
|
|
created_at?: string
|
|
data_type?: string
|
|
dimension?: number
|
|
distance_metric?: string
|
|
id?: string
|
|
metadata_configuration?: Json | null
|
|
name?: string
|
|
updated_at?: string
|
|
}
|
|
Relationships: [
|
|
{
|
|
foreignKeyName: "vector_indexes_bucket_id_fkey"
|
|
columns: ["bucket_id"]
|
|
isOneToOne: false
|
|
referencedRelation: "buckets_vectors"
|
|
referencedColumns: ["id"]
|
|
},
|
|
]
|
|
}
|
|
}
|
|
Views: {
|
|
[_ in never]: never
|
|
}
|
|
Functions: {
|
|
allow_any_operation: {
|
|
Args: { expected_operations: string[] }
|
|
Returns: boolean
|
|
}
|
|
allow_only_operation: {
|
|
Args: { expected_operation: string }
|
|
Returns: boolean
|
|
}
|
|
can_insert_object: {
|
|
Args: { bucketid: string; metadata: Json; name: string; owner: string }
|
|
Returns: undefined
|
|
}
|
|
extension: { Args: { name: string }; Returns: string }
|
|
filename: { Args: { name: string }; Returns: string }
|
|
foldername: { Args: { name: string }; Returns: string[] }
|
|
get_common_prefix: {
|
|
Args: { p_delimiter: string; p_key: string; p_prefix: string }
|
|
Returns: string
|
|
}
|
|
get_size_by_bucket: {
|
|
Args: never
|
|
Returns: {
|
|
bucket_id: string
|
|
size: number
|
|
}[]
|
|
}
|
|
list_multipart_uploads_with_delimiter: {
|
|
Args: {
|
|
bucket_id: string
|
|
delimiter_param: string
|
|
max_keys?: number
|
|
next_key_token?: string
|
|
next_upload_token?: string
|
|
prefix_param: string
|
|
}
|
|
Returns: {
|
|
created_at: string
|
|
id: string
|
|
key: string
|
|
}[]
|
|
}
|
|
list_objects_with_delimiter: {
|
|
Args: {
|
|
_bucket_id: string
|
|
delimiter_param: string
|
|
max_keys?: number
|
|
next_token?: string
|
|
prefix_param: string
|
|
sort_order?: string
|
|
start_after?: string
|
|
}
|
|
Returns: {
|
|
created_at: string
|
|
id: string
|
|
last_accessed_at: string
|
|
metadata: Json
|
|
name: string
|
|
updated_at: string
|
|
}[]
|
|
}
|
|
operation: { Args: never; Returns: string }
|
|
search: {
|
|
Args: {
|
|
bucketname: string
|
|
levels?: number
|
|
limits?: number
|
|
offsets?: number
|
|
prefix: string
|
|
search?: string
|
|
sortcolumn?: string
|
|
sortorder?: string
|
|
}
|
|
Returns: {
|
|
created_at: string
|
|
id: string
|
|
last_accessed_at: string
|
|
metadata: Json
|
|
name: string
|
|
updated_at: string
|
|
}[]
|
|
}
|
|
search_by_timestamp: {
|
|
Args: {
|
|
p_bucket_id: string
|
|
p_level: number
|
|
p_limit: number
|
|
p_prefix: string
|
|
p_sort_column: string
|
|
p_sort_column_after: string
|
|
p_sort_order: string
|
|
p_start_after: string
|
|
}
|
|
Returns: {
|
|
created_at: string
|
|
id: string
|
|
key: string
|
|
last_accessed_at: string
|
|
metadata: Json
|
|
name: string
|
|
updated_at: string
|
|
}[]
|
|
}
|
|
search_v2: {
|
|
Args: {
|
|
bucket_name: string
|
|
levels?: number
|
|
limits?: number
|
|
prefix: string
|
|
sort_column?: string
|
|
sort_column_after?: string
|
|
sort_order?: string
|
|
start_after?: string
|
|
}
|
|
Returns: {
|
|
created_at: string
|
|
id: string
|
|
key: string
|
|
last_accessed_at: string
|
|
metadata: Json
|
|
name: string
|
|
updated_at: string
|
|
}[]
|
|
}
|
|
}
|
|
Enums: {
|
|
buckettype: "STANDARD" | "ANALYTICS" | "VECTOR"
|
|
}
|
|
CompositeTypes: {
|
|
[_ in never]: never
|
|
}
|
|
}
|
|
}
|
|
|
|
type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">
|
|
|
|
type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">]
|
|
|
|
export type Tables<
|
|
DefaultSchemaTableNameOrOptions extends
|
|
| keyof (DefaultSchema["Tables"] & DefaultSchema["Views"])
|
|
| { schema: keyof DatabaseWithoutInternals },
|
|
TableName extends DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
|
|
DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])
|
|
: never = never,
|
|
> = DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
|
|
DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
|
|
Row: infer R
|
|
}
|
|
? R
|
|
: never
|
|
: DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] &
|
|
DefaultSchema["Views"])
|
|
? (DefaultSchema["Tables"] &
|
|
DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
|
|
Row: infer R
|
|
}
|
|
? R
|
|
: never
|
|
: never
|
|
|
|
export type TablesInsert<
|
|
DefaultSchemaTableNameOrOptions extends
|
|
| keyof DefaultSchema["Tables"]
|
|
| { schema: keyof DatabaseWithoutInternals },
|
|
TableName extends DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
|
|
: never = never,
|
|
> = DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
Insert: infer I
|
|
}
|
|
? I
|
|
: never
|
|
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
|
|
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
|
|
Insert: infer I
|
|
}
|
|
? I
|
|
: never
|
|
: never
|
|
|
|
export type TablesUpdate<
|
|
DefaultSchemaTableNameOrOptions extends
|
|
| keyof DefaultSchema["Tables"]
|
|
| { schema: keyof DatabaseWithoutInternals },
|
|
TableName extends DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
|
|
: never = never,
|
|
> = DefaultSchemaTableNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
|
|
Update: infer U
|
|
}
|
|
? U
|
|
: never
|
|
: DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
|
|
? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
|
|
Update: infer U
|
|
}
|
|
? U
|
|
: never
|
|
: never
|
|
|
|
export type Enums<
|
|
DefaultSchemaEnumNameOrOptions extends
|
|
| keyof DefaultSchema["Enums"]
|
|
| { schema: keyof DatabaseWithoutInternals },
|
|
EnumName extends DefaultSchemaEnumNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"]
|
|
: never = never,
|
|
> = DefaultSchemaEnumNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName]
|
|
: DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"]
|
|
? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions]
|
|
: never
|
|
|
|
export type CompositeTypes<
|
|
PublicCompositeTypeNameOrOptions extends
|
|
| keyof DefaultSchema["CompositeTypes"]
|
|
| { schema: keyof DatabaseWithoutInternals },
|
|
CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
|
|
: never = never,
|
|
> = PublicCompositeTypeNameOrOptions extends {
|
|
schema: keyof DatabaseWithoutInternals
|
|
}
|
|
? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
|
|
: PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"]
|
|
? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
|
|
: never
|
|
|
|
export const Constants = {
|
|
graphql_public: {
|
|
Enums: {},
|
|
},
|
|
public: {
|
|
Enums: {},
|
|
},
|
|
storage: {
|
|
Enums: {
|
|
buckettype: ["STANDARD", "ANALYTICS", "VECTOR"],
|
|
},
|
|
},
|
|
} as const
|
|
|