

--
-- Name: workflow_difficulty; Type: TYPE; Schema: public; Owner: postgres
--

CREATE TYPE public.workflow_difficulty AS ENUM (
    'beginner',
    'intermediate',
    'advanced'
);


ALTER TYPE public.workflow_difficulty OWNER TO postgres;


ALTER FUNCTION public.update_extension_status_on_assignment() OWNER TO agentlabs;

--
-- Name: update_sip_updated_at(); Type: FUNCTION; Schema: public; Owner: agentlabs
--

CREATE FUNCTION public.update_sip_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
BEGIN
    NEW.updated_at = NOW();
    RETURN NEW;
END;
$$;


ALTER FUNCTION public.update_sip_updated_at() OWNER TO agentlabs;

--
-- Name: update_team_tables_updated_at(); Type: FUNCTION; Schema: public; Owner: agentlabs
--

CREATE FUNCTION public.update_team_tables_updated_at() RETURNS trigger
    LANGUAGE plpgsql
    AS $$
        BEGIN
          NEW.updated_at = NOW();
          RETURN NEW;
        END;
        $$;


ALTER FUNCTION public.update_team_tables_updated_at() OWNER TO agentlabs;



--
-- Name: admin_team_activity_logs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.admin_team_activity_logs (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    admin_team_id uuid NOT NULL,
    member_id uuid,
    action character varying(100) NOT NULL,
    target_type character varying(100),
    target_id uuid,
    metadata jsonb,
    ip_address character varying(45),
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.admin_team_activity_logs OWNER TO agentlabs;

--
-- Name: admin_team_permissions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.admin_team_permissions (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    role_id uuid NOT NULL,
    section character varying(100) NOT NULL,
    subsection character varying(100) NOT NULL,
    can_create boolean DEFAULT false NOT NULL,
    can_read boolean DEFAULT false NOT NULL,
    can_update boolean DEFAULT false NOT NULL,
    can_delete boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.admin_team_permissions OWNER TO agentlabs;

--
-- Name: admin_team_roles; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.admin_team_roles (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    admin_team_id uuid NOT NULL,
    name character varying(100) NOT NULL,
    display_name character varying(255) NOT NULL,
    description text,
    is_system boolean DEFAULT false NOT NULL,
    is_default boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.admin_team_roles OWNER TO agentlabs;

--
-- Name: admin_teams; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.admin_teams (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    name character varying(255) DEFAULT 'Admin Team'::character varying NOT NULL,
    description text,
    settings jsonb DEFAULT '{"maxMembers": 50, "allowCustomRoles": true, "sessionExpiryHours": 24, "requireEmailVerification": false}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.admin_teams OWNER TO agentlabs;

--
-- Name: agent_versions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.agent_versions (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    agent_id character varying NOT NULL,
    version_number integer NOT NULL,
    snapshot jsonb NOT NULL,
    changes_summary text,
    changed_fields text[],
    edited_by character varying,
    note text,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.agent_versions OWNER TO agentlabs;

--
-- Name: analytics_scripts; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.analytics_scripts (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    name text NOT NULL,
    type text DEFAULT 'custom'::text NOT NULL,
    code text NOT NULL,
    head_code text,
    body_code text,
    placement text[] DEFAULT ARRAY['head'::text] NOT NULL,
    load_priority integer DEFAULT 0 NOT NULL,
    async boolean DEFAULT false,
    defer boolean DEFAULT false,
    enabled boolean DEFAULT true NOT NULL,
    hide_on_internal_pages boolean DEFAULT false NOT NULL,
    description text,
    updated_by character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.analytics_scripts OWNER TO agentlabs;

--
-- Name: appointment_settings; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.appointment_settings (
    id character varying NOT NULL,
    user_id character varying NOT NULL,
    allow_overlapping boolean DEFAULT false NOT NULL,
    buffer_minutes integer DEFAULT 0 NOT NULL,
    working_hours jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.appointment_settings OWNER TO agentlabs;

--
-- Name: appointments; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.appointments (
    id character varying NOT NULL,
    user_id character varying NOT NULL,
    call_id character varying,
    flow_id character varying,
    contact_name character varying(255) NOT NULL,
    contact_phone character varying(50) NOT NULL,
    contact_email character varying(255),
    appointment_date date NOT NULL,
    appointment_time time without time zone NOT NULL,
    duration integer NOT NULL,
    service_name character varying(255),
    notes text,
    status character varying(50) DEFAULT 'scheduled'::character varying NOT NULL,
    metadata jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.appointments OWNER TO agentlabs;

--
-- Name: audit_logs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.audit_logs (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    action text NOT NULL,
    user_id character varying,
    target_user_id character varying,
    resource_type text,
    resource_id character varying,
    ip_address text,
    user_agent text,
    metadata jsonb,
    severity text DEFAULT 'info'::text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.audit_logs OWNER TO agentlabs;

--
-- Name: banned_words; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.banned_words (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    word text NOT NULL,
    category text DEFAULT 'general'::text NOT NULL,
    severity text DEFAULT 'medium'::text NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    auto_block boolean DEFAULT false NOT NULL,
    created_by character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.banned_words OWNER TO agentlabs;

--
-- Name: calls; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.calls (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying,
    campaign_id character varying,
    contact_id character varying,
    incoming_connection_id character varying,
    widget_id character varying,
    incoming_agent_id character varying,
    phone_number text,
    from_number text,
    to_number text,
    twilio_sid text,
    elevenlabs_conversation_id text,
    status text DEFAULT 'pending'::text NOT NULL,
    call_direction text DEFAULT 'outgoing'::text NOT NULL,
    duration integer,
    recording_url text,
    transcript text,
    ai_summary text,
    classification text,
    sentiment text,
    metadata jsonb,
    was_transferred boolean DEFAULT false,
    transferred_to text,
    transferred_at timestamp without time zone,
    started_at timestamp without time zone,
    ended_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.calls OWNER TO agentlabs;

--
-- Name: campaign_jobs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.campaign_jobs (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    campaign_id character varying NOT NULL,
    contact_id character varying NOT NULL,
    engine text DEFAULT 'plivo'::text NOT NULL,
    status text DEFAULT 'pending'::text NOT NULL,
    attempts integer DEFAULT 0 NOT NULL,
    last_error text,
    worker_id text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    processed_at timestamp without time zone,
    completed_at timestamp without time zone
);


ALTER TABLE public.campaign_jobs OWNER TO agentlabs;

--
-- Name: campaigns; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.campaigns (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    agent_id character varying,
    voice_id text,
    phone_number_id character varying,
    sip_phone_number_id character varying,
    plivo_phone_number_id character varying,
    flow_id character varying,
    name text NOT NULL,
    type text NOT NULL,
    goal text,
    script text,
    status text DEFAULT 'pending'::text NOT NULL,
    total_contacts integer DEFAULT 0 NOT NULL,
    completed_calls integer DEFAULT 0 NOT NULL,
    successful_calls integer DEFAULT 0 NOT NULL,
    failed_calls integer DEFAULT 0 NOT NULL,
    scheduled_for timestamp without time zone,
    started_at timestamp without time zone,
    completed_at timestamp without time zone,
    deleted_at timestamp without time zone,
    schedule_enabled boolean DEFAULT false NOT NULL,
    schedule_time_start text,
    schedule_time_end text,
    schedule_days text[],
    schedule_timezone text DEFAULT 'America/New_York'::text,
    batch_job_id text,
    batch_job_status text,
    retry_enabled boolean DEFAULT false NOT NULL,
    error_message text,
    error_code text,
    config jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.campaigns OWNER TO agentlabs;

--
-- Name: categories; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.categories (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    name_en text NOT NULL,
    name_ar text NOT NULL,
    icon text,
    description_en text,
    description_ar text,
    sort_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.categories OWNER TO postgres;

--
-- Name: contacts; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.contacts (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    campaign_id character varying NOT NULL,
    first_name text NOT NULL,
    last_name text,
    phone text NOT NULL,
    email text,
    custom_fields jsonb,
    status text DEFAULT 'pending'::text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.contacts OWNER TO agentlabs;

--
-- Name: content_violations; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.content_violations (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    call_id character varying NOT NULL,
    user_id character varying NOT NULL,
    banned_word_id character varying,
    detected_word text NOT NULL,
    context text,
    severity text DEFAULT 'medium'::text NOT NULL,
    status text DEFAULT 'pending'::text NOT NULL,
    reviewed_by character varying,
    reviewed_at timestamp without time zone,
    action_taken text,
    notes text,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.content_violations OWNER TO agentlabs;

--
-- Name: credit_packages; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.credit_packages (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    name text NOT NULL,
    description text,
    credits integer NOT NULL,
    price numeric(10,2) NOT NULL,
    razorpay_price numeric(10,2),
    stripe_product_id text,
    stripe_price_id text,
    razorpay_item_id text,
    paypal_price numeric(10,2),
    paystack_price numeric(10,2),
    mercadopago_price numeric(10,2),
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.credit_packages OWNER TO agentlabs;

--
-- Name: credit_transactions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.credit_transactions (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    type text NOT NULL,
    amount integer NOT NULL,
    description text NOT NULL,
    reference text,
    stripe_payment_id text,
    widget_id character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.credit_transactions OWNER TO agentlabs;

--
-- Name: crm_category_preferences; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.crm_category_preferences (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    column_order text[] DEFAULT ARRAY['warm'::text, 'hot'::text, 'appointment_booked'::text, 'form_submitted'::text, 'call_transfer'::text, 'need_follow_up'::text] NOT NULL,
    color_overrides jsonb DEFAULT '{}'::jsonb,
    column_sort_preferences jsonb DEFAULT '{}'::jsonb,
    hide_leads_without_phone boolean DEFAULT false NOT NULL,
    category_pipeline_mappings jsonb DEFAULT '{}'::jsonb,
    hot_score_threshold integer DEFAULT 80,
    warm_score_threshold integer DEFAULT 50,
    hidden_categories text[] DEFAULT ARRAY[]::text[],
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.crm_category_preferences OWNER TO agentlabs;

--
-- Name: email_notification_settings; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.email_notification_settings (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    event_type text NOT NULL,
    display_name text NOT NULL,
    description text,
    is_enabled boolean DEFAULT true NOT NULL,
    template_id character varying,
    threshold_value integer,
    category text DEFAULT 'general'::text NOT NULL,
    updated_by character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.email_notification_settings OWNER TO agentlabs;

--
-- Name: email_templates; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.email_templates (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    template_type text NOT NULL,
    name text NOT NULL,
    subject text NOT NULL,
    html_body text NOT NULL,
    text_body text NOT NULL,
    variables text[],
    is_active boolean DEFAULT true NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.email_templates OWNER TO agentlabs;

--
-- Name: flow_executions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.flow_executions (
    id character varying NOT NULL,
    call_id character varying NOT NULL,
    flow_id character varying NOT NULL,
    current_node_id character varying,
    status character varying(50) NOT NULL,
    variables jsonb DEFAULT '{}'::jsonb,
    path_taken jsonb DEFAULT '[]'::jsonb,
    metadata jsonb,
    error text,
    started_at timestamp without time zone DEFAULT now() NOT NULL,
    completed_at timestamp without time zone
);


ALTER TABLE public.flow_executions OWNER TO agentlabs;

--
-- Name: flows; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.flows (
    id character varying NOT NULL,
    user_id character varying NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    nodes jsonb NOT NULL,
    edges jsonb NOT NULL,
    agent_id character varying,
    voice_settings jsonb,
    execution_config jsonb,
    is_active boolean DEFAULT true NOT NULL,
    is_template boolean DEFAULT false NOT NULL,
    compiled_system_prompt text,
    compiled_first_message text,
    compiled_states jsonb,
    compiled_tools jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.flows OWNER TO agentlabs;

--
-- Name: form_fields; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.form_fields (
    id character varying NOT NULL,
    form_id character varying NOT NULL,
    question text NOT NULL,
    field_type character varying(50) NOT NULL,
    options jsonb,
    is_required boolean DEFAULT true NOT NULL,
    "order" integer NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.form_fields OWNER TO agentlabs;

--
-- Name: form_submissions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.form_submissions (
    id character varying NOT NULL,
    form_id character varying NOT NULL,
    call_id character varying,
    flow_execution_id character varying,
    contact_name character varying(255),
    contact_phone character varying(50),
    responses jsonb NOT NULL,
    submitted_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.form_submissions OWNER TO agentlabs;

--
-- Name: forms; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.forms (
    id character varying NOT NULL,
    user_id character varying NOT NULL,
    name character varying(255) NOT NULL,
    description text,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.forms OWNER TO agentlabs;

--
-- Name: freepbx_calls; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.freepbx_calls (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    user_id character varying(36),
    assignment_id character varying(36),
    agent_id character varying(36),
    campaign_id character varying(36),
    contact_id character varying(36),
    incoming_connection_id character varying(36),
    sip_extension_id character varying(36),
    sip_extension character varying(20) NOT NULL,
    freepbx_connection_id character varying(36),
    direction character varying(10) NOT NULL,
    caller_id character varying(100),
    caller_name character varying(255),
    destination character varying(100),
    destination_name character varying(255),
    status character varying(20) DEFAULT 'initiated'::character varying,
    hangup_cause character varying(50),
    hangup_cause_code integer,
    initiated_at timestamp with time zone DEFAULT now(),
    ringing_at timestamp with time zone,
    answered_at timestamp with time zone,
    ended_at timestamp with time zone,
    duration_seconds integer DEFAULT 0,
    billable_seconds integer DEFAULT 0,
    credits_used numeric(10,2) DEFAULT 0,
    credit_rate numeric(10,4),
    recording_enabled boolean DEFAULT false,
    recording_url text,
    recording_duration_seconds integer,
    recording_size_bytes bigint,
    transcript text,
    transcript_segments jsonb,
    ai_summary text,
    ai_summary_ar text,
    sentiment character varying(20),
    sentiment_score numeric(3,2),
    keywords text[],
    action_items jsonb,
    lead_data jsonb,
    freepbx_unique_id character varying(100),
    freepbx_linked_id character varying(100),
    asterisk_channel character varying(255),
    mos_score numeric(3,2),
    jitter_ms integer,
    packet_loss_percent numeric(5,2),
    error_message text,
    error_code character varying(50),
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.freepbx_calls OWNER TO agentlabs;

--
-- Name: TABLE freepbx_calls; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.freepbx_calls IS 'Call records for FreePBX SIP-based calls';


--
-- Name: global_settings; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.global_settings (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    key text NOT NULL,
    value jsonb NOT NULL,
    description text,
    updated_by character varying,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.global_settings OWNER TO agentlabs;

--
-- Name: incoming_connections; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.incoming_connections (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    agent_id character varying NOT NULL,
    phone_number_id character varying NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.incoming_connections OWNER TO agentlabs;

--
-- Name: invoices; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.invoices (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    transaction_id character varying NOT NULL,
    user_id character varying NOT NULL,
    invoice_number text NOT NULL,
    customer_name text NOT NULL,
    customer_email text NOT NULL,
    customer_address text,
    description text NOT NULL,
    line_items jsonb NOT NULL,
    subtotal numeric(10,2) NOT NULL,
    tax numeric(10,2) DEFAULT 0.00,
    total numeric(10,2) NOT NULL,
    currency text DEFAULT 'USD'::text NOT NULL,
    gateway text NOT NULL,
    payment_method text,
    pdf_url text,
    pdf_generated_at timestamp without time zone,
    status text DEFAULT 'draft'::text NOT NULL,
    email_sent_at timestamp without time zone,
    email_sent_to text,
    issued_at timestamp without time zone DEFAULT now() NOT NULL,
    due_at timestamp without time zone,
    paid_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.invoices OWNER TO agentlabs;

--
-- Name: knowledge_base; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.knowledge_base (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    type text NOT NULL,
    title text NOT NULL,
    content text,
    url text,
    file_url text,
    eleven_labs_doc_id text,
    metadata jsonb,
    storage_size integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.knowledge_base OWNER TO agentlabs;

--
-- Name: knowledge_chunks; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.knowledge_chunks (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    knowledge_base_id character varying NOT NULL,
    user_id character varying NOT NULL,
    chunk_index integer NOT NULL,
    chunk_text text NOT NULL,
    embedding jsonb,
    token_count integer DEFAULT 0 NOT NULL,
    metadata jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.knowledge_chunks OWNER TO agentlabs;

--
-- Name: knowledge_processing_queue; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.knowledge_processing_queue (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    knowledge_base_id character varying NOT NULL,
    user_id character varying NOT NULL,
    status text DEFAULT 'pending'::text NOT NULL,
    error_message text,
    total_chunks integer DEFAULT 0,
    processed_chunks integer DEFAULT 0,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.knowledge_processing_queue OWNER TO agentlabs;

--
-- Name: lead_activities; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.lead_activities (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    lead_id character varying NOT NULL,
    user_id character varying NOT NULL,
    activity_type text NOT NULL,
    title text NOT NULL,
    description text,
    metadata jsonb,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.lead_activities OWNER TO agentlabs;

--
-- Name: lead_notes; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.lead_notes (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    lead_id character varying NOT NULL,
    user_id character varying NOT NULL,
    content text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.lead_notes OWNER TO agentlabs;

--
-- Name: lead_stages; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.lead_stages (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    name text NOT NULL,
    color text DEFAULT '#6B7280'::text NOT NULL,
    "order" integer DEFAULT 0 NOT NULL,
    is_default boolean DEFAULT false NOT NULL,
    is_custom boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.lead_stages OWNER TO agentlabs;

--
-- Name: leads; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.leads (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    source_type text NOT NULL,
    campaign_id character varying,
    incoming_connection_id character varying,
    first_name text,
    last_name text,
    phone text NOT NULL,
    email text,
    company text,
    custom_fields jsonb,
    stage_id character varying,
    stage text DEFAULT 'new'::text NOT NULL,
    lead_score integer,
    ai_summary text,
    ai_next_action text,
    sentiment text,
    ai_category text,
    has_appointment boolean DEFAULT false NOT NULL,
    has_form_submission boolean DEFAULT false NOT NULL,
    has_transfer boolean DEFAULT false NOT NULL,
    has_callback boolean DEFAULT false NOT NULL,
    appointment_date timestamp without time zone,
    appointment_details jsonb,
    form_data jsonb,
    transferred_to text,
    transferred_at timestamp without time zone,
    callback_scheduled timestamp without time zone,
    callback_completed boolean DEFAULT false NOT NULL,
    call_id character varying,
    plivo_call_id character varying,
    twilio_openai_call_id character varying,
    total_calls integer DEFAULT 1 NOT NULL,
    last_call_at timestamp without time zone,
    tags text[],
    assigned_user_id character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.leads OWNER TO agentlabs;

--
-- Name: llm_models; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.llm_models (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    model_id text NOT NULL,
    name text NOT NULL,
    provider text NOT NULL,
    tier text NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    sort_order integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.llm_models OWNER TO agentlabs;

--
-- Name: n8n_settings; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.n8n_settings (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    setting_key text NOT NULL,
    setting_value jsonb NOT NULL,
    description_en text,
    description_ar text,
    is_encrypted boolean DEFAULT false,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.n8n_settings OWNER TO postgres;

--
-- Name: notifications; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.notifications (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying,
    type text NOT NULL,
    title text NOT NULL,
    message text NOT NULL,
    link text,
    icon text,
    display_type text DEFAULT 'bell'::text NOT NULL,
    priority integer DEFAULT 0 NOT NULL,
    dismissible boolean DEFAULT true NOT NULL,
    expires_at timestamp without time zone,
    is_read boolean DEFAULT false NOT NULL,
    is_dismissed boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.notifications OWNER TO agentlabs;

--
-- Name: payment_transactions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.payment_transactions (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    type text NOT NULL,
    gateway text NOT NULL,
    gateway_transaction_id text,
    gateway_subscription_id text,
    amount numeric(10,2) NOT NULL,
    currency text DEFAULT 'USD'::text NOT NULL,
    plan_id character varying,
    credit_package_id character varying,
    subscription_id character varying,
    description text NOT NULL,
    billing_period text,
    credits_awarded integer,
    status text DEFAULT 'pending'::text NOT NULL,
    invoice_id character varying,
    metadata jsonb,
    completed_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.payment_transactions OWNER TO agentlabs;

--
-- Name: payment_webhook_queue; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.payment_webhook_queue (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    gateway text NOT NULL,
    event_type text NOT NULL,
    event_id text NOT NULL,
    payload jsonb NOT NULL,
    status text DEFAULT 'pending'::text NOT NULL,
    attempt_count integer DEFAULT 0 NOT NULL,
    max_attempts integer DEFAULT 5 NOT NULL,
    last_attempt_at timestamp without time zone,
    next_retry_at timestamp without time zone,
    last_error text,
    error_history jsonb,
    user_id character varying,
    transaction_id character varying,
    received_at timestamp without time zone DEFAULT now() NOT NULL,
    processed_at timestamp without time zone,
    expires_at timestamp without time zone NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.payment_webhook_queue OWNER TO agentlabs;

--
-- Name: phone_number_rentals; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.phone_number_rentals (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    phone_number_id character varying NOT NULL,
    user_id character varying NOT NULL,
    credits_charged integer NOT NULL,
    billing_date timestamp without time zone DEFAULT now() NOT NULL,
    status text DEFAULT 'success'::text NOT NULL,
    transaction_id character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.phone_number_rentals OWNER TO agentlabs;

--
-- Name: plans; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.plans (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    name text NOT NULL,
    display_name text NOT NULL,
    description text NOT NULL,
    monthly_price numeric(10,2) NOT NULL,
    yearly_price numeric(10,2),
    razorpay_monthly_price numeric(10,2),
    razorpay_yearly_price numeric(10,2),
    stripe_monthly_price_id text,
    stripe_yearly_price_id text,
    stripe_product_id text,
    razorpay_plan_id text,
    razorpay_yearly_plan_id text,
    paypal_monthly_price numeric(10,2),
    paypal_yearly_price numeric(10,2),
    paypal_product_id text,
    paypal_monthly_plan_id text,
    paypal_yearly_plan_id text,
    paystack_monthly_price numeric(10,2),
    paystack_yearly_price numeric(10,2),
    paystack_monthly_plan_code text,
    paystack_yearly_plan_code text,
    mercadopago_monthly_price numeric(10,2),
    mercadopago_yearly_price numeric(10,2),
    mercadopago_monthly_plan_id text,
    mercadopago_yearly_plan_id text,
    max_agents integer DEFAULT 1 NOT NULL,
    max_campaigns integer DEFAULT 1 NOT NULL,
    max_contacts_per_campaign integer DEFAULT 5 NOT NULL,
    max_webhooks integer DEFAULT 3 NOT NULL,
    max_knowledge_bases integer DEFAULT 5 NOT NULL,
    max_flows integer DEFAULT 3 NOT NULL,
    max_phone_numbers integer DEFAULT 1 NOT NULL,
    max_widgets integer DEFAULT 1 NOT NULL,
    included_credits integer DEFAULT 0 NOT NULL,
    default_llm_model text,
    can_choose_llm boolean DEFAULT false NOT NULL,
    can_purchase_numbers boolean DEFAULT false NOT NULL,
    use_system_pool boolean DEFAULT true NOT NULL,
    features jsonb,
    sip_enabled boolean DEFAULT false NOT NULL,
    max_concurrent_sip_calls integer DEFAULT 1 NOT NULL,
    sip_engines_allowed text[] DEFAULT ARRAY['elevenlabs-sip'::text],
    rest_api_enabled boolean DEFAULT false NOT NULL,
    team_management_enabled boolean DEFAULT false NOT NULL,
    max_team_members integer DEFAULT 0 NOT NULL,
    max_custom_roles integer DEFAULT 0 NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.plans OWNER TO agentlabs;

--
-- Name: platform_languages; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.platform_languages (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    code text NOT NULL,
    name text NOT NULL,
    native_name text NOT NULL,
    flag text,
    direction text DEFAULT 'ltr'::text NOT NULL,
    is_enabled boolean DEFAULT true NOT NULL,
    is_default boolean DEFAULT false NOT NULL,
    sort_order integer DEFAULT 0 NOT NULL,
    translations jsonb NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.platform_languages OWNER TO agentlabs;

--
-- Name: plivo_phone_pricing; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.plivo_phone_pricing (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    country_code text NOT NULL,
    country_name text NOT NULL,
    purchase_credits integer DEFAULT 100 NOT NULL,
    monthly_credits integer DEFAULT 50 NOT NULL,
    kyc_required boolean DEFAULT false NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.plivo_phone_pricing OWNER TO agentlabs;

--
-- Name: prompt_templates; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.prompt_templates (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying,
    name text NOT NULL,
    description text,
    category text DEFAULT 'general'::text NOT NULL,
    system_prompt text NOT NULL,
    first_message text,
    variables text[],
    suggested_voice_tone text,
    suggested_personality text,
    is_system_template boolean DEFAULT false NOT NULL,
    is_public boolean DEFAULT false NOT NULL,
    usage_count integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.prompt_templates OWNER TO agentlabs;

--
-- Name: refunds; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.refunds (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    transaction_id character varying NOT NULL,
    user_id character varying NOT NULL,
    amount numeric(10,2) NOT NULL,
    currency text DEFAULT 'USD'::text NOT NULL,
    gateway text NOT NULL,
    gateway_refund_id text,
    reason text NOT NULL,
    initiated_by text NOT NULL,
    admin_id character varying,
    status text DEFAULT 'pending'::text NOT NULL,
    credits_reversed integer,
    user_suspended boolean DEFAULT false NOT NULL,
    admin_note text,
    customer_note text,
    metadata jsonb,
    refund_note_number text,
    pdf_url text,
    pdf_generated_at timestamp without time zone,
    processed_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.refunds OWNER TO agentlabs;

--
-- Name: seo_settings; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.seo_settings (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    default_title text DEFAULT 'AI Calling Platform'::text,
    default_description text DEFAULT 'Enterprise AI-powered bulk calling platform with voice agents, Twilio integration, and intelligent lead classification.'::text,
    default_keywords text[] DEFAULT ARRAY[]::text[],
    default_og_image text DEFAULT '/og-image.png'::text,
    sitemap_enabled boolean DEFAULT true,
    sitemap_urls jsonb DEFAULT '[]'::jsonb,
    sitemap_auto_generate boolean DEFAULT true,
    robots_enabled boolean DEFAULT true,
    robots_rules jsonb DEFAULT '[{"allow": ["/", "/pricing", "/features", "/blog", "/contact"], "disallow": ["/app/", "/admin/", "/api/"], "userAgent": "*"}]'::jsonb,
    robots_crawl_delay integer DEFAULT 0,
    structured_data_enabled boolean DEFAULT true,
    structured_data jsonb DEFAULT '{"contactEmail": "", "contactPhone": "", "socialProfiles": [], "organizationUrl": "", "organizationLogo": "/logo.png", "organizationName": "", "organizationDescription": "AI-powered voice agents for automated calling"}'::jsonb,
    structured_data_faq jsonb DEFAULT '[]'::jsonb,
    structured_data_faq_enabled boolean DEFAULT false,
    structured_data_product jsonb DEFAULT 'null'::jsonb,
    structured_data_product_enabled boolean DEFAULT false,
    twitter_handle text,
    facebook_app_id text,
    canonical_base_url text,
    google_verification text,
    bing_verification text,
    updated_by character varying,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.seo_settings OWNER TO agentlabs;

--
-- Name: sip_audit_logs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_audit_logs (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    user_id character varying(36),
    action character varying(50) NOT NULL,
    action_category character varying(30) NOT NULL,
    entity_type character varying(50) NOT NULL,
    entity_id character varying(36) NOT NULL,
    entity_name character varying(255),
    old_values jsonb,
    new_values jsonb,
    changes_summary text,
    ip_address character varying(45),
    user_agent text,
    request_id character varying(36),
    status character varying(20) DEFAULT 'success'::character varying,
    error_message text,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sip_audit_logs OWNER TO agentlabs;

--
-- Name: TABLE sip_audit_logs; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.sip_audit_logs IS 'Audit trail for all SIP-related operations';


--
-- Name: sip_calls; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_calls (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    sip_phone_number_id character varying NOT NULL,
    user_id character varying NOT NULL,
    agent_id character varying,
    campaign_id character varying,
    contact_id character varying,
    direction text NOT NULL,
    engine text NOT NULL,
    to_number text,
    from_number text,
    external_call_id text,
    status text DEFAULT 'initiated'::text NOT NULL,
    duration_seconds integer,
    transcript_json jsonb,
    conversation_data jsonb,
    started_at timestamp without time zone,
    ended_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.sip_calls OWNER TO agentlabs;

--
-- Name: sip_extension_assignments; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_extension_assignments (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    user_id character varying(36) NOT NULL,
    sip_extension_id character varying(36) NOT NULL,
    agent_id character varying(36),
    status character varying(20) DEFAULT 'active'::character varying,
    assigned_at timestamp with time zone DEFAULT now(),
    assigned_by character varying(36),
    expires_at timestamp with time zone,
    auto_renew boolean DEFAULT false,
    max_concurrent_calls integer,
    max_daily_minutes integer,
    max_monthly_minutes integer,
    total_calls integer DEFAULT 0,
    total_minutes integer DEFAULT 0,
    current_month_minutes integer DEFAULT 0,
    last_call_at timestamp with time zone,
    admin_notes text,
    user_notes text,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sip_extension_assignments OWNER TO agentlabs;

--
-- Name: TABLE sip_extension_assignments; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.sip_extension_assignments IS 'User assignments to SIP extensions (one extension per user)';


--
-- Name: sip_extension_groups; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_extension_groups (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    name character varying(100) NOT NULL,
    name_ar character varying(100),
    description text,
    description_ar text,
    color character varying(7) DEFAULT '#3B82F6'::character varying,
    icon character varying(50) DEFAULT 'Phone'::character varying,
    sort_order integer DEFAULT 0,
    is_active boolean DEFAULT true,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sip_extension_groups OWNER TO agentlabs;

--
-- Name: TABLE sip_extension_groups; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.sip_extension_groups IS 'Groups for organizing SIP extensions';


--
-- Name: sip_extension_requests; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_extension_requests (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    user_id character varying(36) NOT NULL,
    sip_extension_id character varying(36) NOT NULL,
    status character varying(20) DEFAULT 'pending'::character varying,
    priority character varying(10) DEFAULT 'normal'::character varying,
    request_reason text,
    intended_use text,
    reviewed_by character varying(36),
    reviewed_at timestamp with time zone,
    admin_notes text,
    rejection_reason text,
    assignment_id character varying(36),
    user_notified boolean DEFAULT false,
    user_notified_at timestamp with time zone,
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sip_extension_requests OWNER TO agentlabs;

--
-- Name: TABLE sip_extension_requests; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.sip_extension_requests IS 'User requests for SIP extensions pending admin approval';


--
-- Name: sip_phone_numbers; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_phone_numbers (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    sip_trunk_id character varying NOT NULL,
    user_id character varying NOT NULL,
    phone_number text NOT NULL,
    label text,
    engine text NOT NULL,
    agent_id character varying,
    inbound_enabled boolean DEFAULT true NOT NULL,
    outbound_enabled boolean DEFAULT true NOT NULL,
    external_elevenlabs_phone_id text,
    external_fonoster_phone_id text,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL,
    trunk_id character varying
);


ALTER TABLE public.sip_phone_numbers OWNER TO agentlabs;

--
-- Name: sip_usage_stats; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.sip_usage_stats (
    id character varying(36) DEFAULT (gen_random_uuid())::text NOT NULL,
    user_id character varying(36),
    sip_extension_id character varying(36),
    stat_date date NOT NULL,
    total_calls integer DEFAULT 0,
    inbound_calls integer DEFAULT 0,
    outbound_calls integer DEFAULT 0,
    answered_calls integer DEFAULT 0,
    missed_calls integer DEFAULT 0,
    failed_calls integer DEFAULT 0,
    total_duration_seconds integer DEFAULT 0,
    inbound_duration_seconds integer DEFAULT 0,
    outbound_duration_seconds integer DEFAULT 0,
    avg_call_duration_seconds integer DEFAULT 0,
    credits_used numeric(10,2) DEFAULT 0,
    avg_sentiment_score numeric(3,2),
    avg_mos_score numeric(3,2),
    metadata jsonb DEFAULT '{}'::jsonb,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.sip_usage_stats OWNER TO agentlabs;

--
-- Name: TABLE sip_usage_stats; Type: COMMENT; Schema: public; Owner: agentlabs
--

COMMENT ON TABLE public.sip_usage_stats IS 'Aggregated daily usage statistics';


ALTER TABLE public.subscriptions OWNER TO postgres;

--
-- Name: supported_languages; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.supported_languages (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    code text NOT NULL,
    label text NOT NULL,
    providers text NOT NULL,
    sort_order integer DEFAULT 0 NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.supported_languages OWNER TO agentlabs;

--
-- Name: team_activity_logs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.team_activity_logs (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    team_id uuid NOT NULL,
    member_id uuid,
    action character varying(100) NOT NULL,
    target_type character varying(100),
    target_id uuid,
    metadata jsonb,
    ip_address character varying(45),
    created_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.team_activity_logs OWNER TO agentlabs;

--
-- Name: team_permissions; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.team_permissions (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    role_id uuid NOT NULL,
    section character varying(100) NOT NULL,
    subsection character varying(100) NOT NULL,
    can_create boolean DEFAULT false NOT NULL,
    can_read boolean DEFAULT false NOT NULL,
    can_update boolean DEFAULT false NOT NULL,
    can_delete boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.team_permissions OWNER TO agentlabs;

--
-- Name: team_roles; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.team_roles (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    team_id uuid NOT NULL,
    name character varying(100) NOT NULL,
    display_name character varying(255) NOT NULL,
    description text,
    is_system boolean DEFAULT false NOT NULL,
    is_default boolean DEFAULT false NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.team_roles OWNER TO agentlabs;

--
-- Name: teams; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.teams (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    name character varying(255) DEFAULT 'My Team'::character varying NOT NULL,
    description text,
    settings jsonb DEFAULT '{"maxMembers": 10, "allowCustomRoles": true, "sessionExpiryHours": 24, "requireEmailVerification": false}'::jsonb NOT NULL,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now()
);


ALTER TABLE public.teams OWNER TO agentlabs;

--
-- Name: tools; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.tools (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    name text NOT NULL,
    type text NOT NULL,
    config jsonb NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.tools OWNER TO agentlabs;

--
-- Name: twilio_countries; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.twilio_countries (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    code character varying(2) NOT NULL,
    name text NOT NULL,
    dial_code text NOT NULL,
    is_active boolean DEFAULT true NOT NULL,
    sort_order integer DEFAULT 100 NOT NULL
);


ALTER TABLE public.twilio_countries OWNER TO agentlabs;

--
-- Name: usage_records; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.usage_records (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    subscription_id character varying,
    call_id character varying,
    type text NOT NULL,
    minutes_used integer DEFAULT 0 NOT NULL,
    cost numeric(10,2) DEFAULT 0.00 NOT NULL,
    billing_status text DEFAULT 'pending'::text NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.usage_records OWNER TO agentlabs;

--
-- Name: user_addresses; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.user_addresses (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    customer_name text NOT NULL,
    street text NOT NULL,
    city text NOT NULL,
    region text NOT NULL,
    postal_code text NOT NULL,
    iso_country text NOT NULL,
    twilio_address_sid text,
    status text DEFAULT 'pending'::text NOT NULL,
    verification_status text,
    validation_status text,
    rejection_reason text,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.user_addresses OWNER TO agentlabs;

--
-- Name: user_knowledge_storage_limits; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.user_knowledge_storage_limits (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    max_storage_bytes integer DEFAULT 20971520 NOT NULL,
    used_storage_bytes integer DEFAULT 0 NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL,
    updated_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.user_knowledge_storage_limits OWNER TO agentlabs;

--
-- Name: user_kyc_documents; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.user_kyc_documents (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    document_type text NOT NULL,
    file_name text NOT NULL,
    file_path text NOT NULL,
    mime_type text NOT NULL,
    file_size integer,
    uploaded_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.user_kyc_documents OWNER TO agentlabs;

--
-- Name: user_workflows; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.user_workflows (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    user_id text NOT NULL,
    workflow_id uuid NOT NULL,
    status text DEFAULT 'inactive'::text,
    payment_status text DEFAULT 'completed'::text,
    payment_method text,
    transfer_image_url text,
    config jsonb DEFAULT '{}'::jsonb,
    executions_count integer DEFAULT 0,
    last_executed_at timestamp with time zone,
    created_at timestamp with time zone DEFAULT now(),
    updated_at timestamp with time zone DEFAULT now(),
    CONSTRAINT user_workflows_payment_method_check CHECK ((payment_method = ANY (ARRAY['online'::text, 'transfer'::text, 'free'::text, 'admin'::text]))),
    CONSTRAINT user_workflows_payment_status_check CHECK ((payment_status = ANY (ARRAY['pending'::text, 'completed'::text, 'failed'::text, 'refunded'::text]))),
    CONSTRAINT user_workflows_status_check CHECK ((status = ANY (ARRAY['inactive'::text, 'active'::text, 'suspended'::text, 'expired'::text])))
);


ALTER TABLE public.user_workflows OWNER TO postgres;

--
-- Name: voices; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.voices (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    user_id character varying NOT NULL,
    name text NOT NULL,
    eleven_labs_voice_id text,
    gender text,
    accent text,
    tone text,
    is_custom boolean DEFAULT false NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.voices OWNER TO agentlabs;

--
-- Name: webhook_deliveries; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.webhook_deliveries (
    id character varying DEFAULT gen_random_uuid() NOT NULL,
    webhook_id character varying NOT NULL,
    call_id character varying,
    status text NOT NULL,
    response_code integer,
    response_body text,
    payload jsonb NOT NULL,
    error_message text,
    attempt_count integer DEFAULT 1 NOT NULL,
    last_attempt_at timestamp without time zone DEFAULT now() NOT NULL,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.webhook_deliveries OWNER TO agentlabs;

--
-- Name: webhook_logs; Type: TABLE; Schema: public; Owner: agentlabs
--

CREATE TABLE public.webhook_logs (
    id integer NOT NULL,
    webhook_id character varying,
    event character varying(100) NOT NULL,
    payload jsonb NOT NULL,
    success boolean NOT NULL,
    status_code integer,
    response_body text,
    response_time integer,
    error text,
    attempt integer DEFAULT 1 NOT NULL,
    max_attempts integer DEFAULT 3,
    next_retry_at timestamp without time zone,
    created_at timestamp without time zone DEFAULT now() NOT NULL
);


ALTER TABLE public.webhook_logs OWNER TO agentlabs;

--
-- Name: webhook_logs_id_seq; Type: SEQUENCE; Schema: public; Owner: agentlabs
--

CREATE SEQUENCE public.webhook_logs_id_seq
    AS integer
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.webhook_logs_id_seq OWNER TO agentlabs;

--
-- Name: webhook_logs_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: agentlabs
--

ALTER SEQUENCE public.webhook_logs_id_seq OWNED BY public.webhook_logs.id;

--
-- Name: workflows_library; Type: TABLE; Schema: public; Owner: postgres
--

CREATE TABLE public.workflows_library (
    id uuid DEFAULT gen_random_uuid() NOT NULL,
    name_en text NOT NULL,
    name_ar text NOT NULL,
    description_en text,
    description_ar text,
    long_description_en text,
    long_description_ar text,
    category_id uuid,
    json_template jsonb DEFAULT '{}'::jsonb NOT NULL,
    requirements jsonb DEFAULT '[]'::jsonb,
    price numeric(10,2) DEFAULT 0,
    icon text,
    thumbnail_url text,
    difficulty public.workflow_difficulty DEFAULT 'beginner'::public.workflow_difficulty,
    features jsonb DEFAULT '[]'::jsonb,
    tags text[] DEFAULT '{}'::text[],
    is_active boolean DEFAULT true,
    downloads_count integer DEFAULT 0,
    avg_rating numeric(3,2) DEFAULT 0,
    created_at timestamp with time zone DEFAULT now() NOT NULL,
    updated_at timestamp with time zone DEFAULT now() NOT NULL,
    requires_rag_storage boolean DEFAULT false,
    agent_role_en text,
    agent_role_ar text,
    speaking_tone_en text,
    speaking_tone_ar text,
    trigger_type text DEFAULT 'manual'::text,
    trigger_config jsonb DEFAULT '{}'::jsonb,
    execution_limits jsonb DEFAULT '{"max_daily": 100, "max_monthly": 2000, "timeout_seconds": 120}'::jsonb,
    retry_config jsonb DEFAULT '{"retry_on": ["network_error", "timeout"], "max_attempts": 3, "delay_seconds": 30}'::jsonb,
    notification_settings jsonb DEFAULT '{"channels": ["in_app"], "on_failure": true, "on_success": false, "on_limit_reached": true}'::jsonb,
    advanced_settings jsonb DEFAULT '{"save_io": true, "version": "1.0.0", "log_level": "info", "max_concurrent": 1, "allow_concurrent": false}'::jsonb,
    source_url text,
    source_type text DEFAULT 'manual'::text,
    visibility text DEFAULT 'public'::text,
    assigned_to text,
    variable_substitution_enabled boolean DEFAULT true,
    CONSTRAINT workflows_library_visibility_check CHECK ((visibility = ANY (ARRAY['public'::text, 'private'::text])))
);


ALTER TABLE public.workflows_library OWNER TO postgres;

--
-- Name: webhook_logs id; Type: DEFAULT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_logs ALTER COLUMN id SET DEFAULT nextval('public.webhook_logs_id_seq'::regclass);


--
-- Data for Name: admin_team_activity_logs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.admin_team_activity_logs (id, admin_team_id, member_id, action, target_type, target_id, metadata, ip_address, created_at) FROM stdin;
\.


--
-- Data for Name: admin_team_permissions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.admin_team_permissions (id, role_id, section, subsection, can_create, can_read, can_update, can_delete, created_at, updated_at) FROM stdin;
f03ee114-5627-41ca-b42e-55f4bd9d40fd	468661e6-2674-4645-b419-388f967629d8	users	view_users	t	t	t	t	2026-01-27 01:50:55.738204+00	2026-01-27 01:50:55.738204+00
ba46c019-ab27-4ba1-b97f-dd8c7a78cb9f	468661e6-2674-4645-b419-388f967629d8	users	edit_users	t	t	t	t	2026-01-27 01:50:55.738921+00	2026-01-27 01:50:55.738921+00
138076ed-c1ae-48ae-b2b9-546513d2e66b	468661e6-2674-4645-b419-388f967629d8	users	suspend_users	t	t	t	t	2026-01-27 01:50:55.739377+00	2026-01-27 01:50:55.739377+00
41b176d5-fccf-4bdd-b7f9-94e353ac844a	468661e6-2674-4645-b419-388f967629d8	users	delete_users	t	t	t	t	2026-01-27 01:50:55.739776+00	2026-01-27 01:50:55.739776+00
df9d846b-06a8-478d-8457-0fc056705ea0	468661e6-2674-4645-b419-388f967629d8	users	manage_credits	t	t	t	t	2026-01-27 01:50:55.740227+00	2026-01-27 01:50:55.740227+00
d72cf06b-9496-4dcb-ac9c-d99d6fe6cb98	468661e6-2674-4645-b419-388f967629d8	users	manage_plans	t	t	t	t	2026-01-27 01:50:55.740942+00	2026-01-27 01:50:55.740942+00
bb48a79f-2197-4ca6-bf9d-ee4b47e9fca5	468661e6-2674-4645-b419-388f967629d8	contacts	view_contacts	t	t	t	t	2026-01-27 01:50:55.74149+00	2026-01-27 01:50:55.74149+00
b66c570c-923a-44d2-b9c0-77032e0c4008	468661e6-2674-4645-b419-388f967629d8	contacts	edit_contacts	t	t	t	t	2026-01-27 01:50:55.741916+00	2026-01-27 01:50:55.741916+00
9cf35cb4-cda1-491d-891c-46f7c6dff1b4	468661e6-2674-4645-b419-388f967629d8	contacts	delete_contacts	t	t	t	t	2026-01-27 01:50:55.742571+00	2026-01-27 01:50:55.742571+00
1a143487-2527-4178-a744-c65c25c6f534	468661e6-2674-4645-b419-388f967629d8	contacts	export_contacts	t	t	t	t	2026-01-27 01:50:55.74303+00	2026-01-27 01:50:55.74303+00
8339c8ef-8f83-416f-abe8-efbb33af961c	468661e6-2674-4645-b419-388f967629d8	billing	plans	t	t	t	t	2026-01-27 01:50:55.743469+00	2026-01-27 01:50:55.743469+00
66a818d4-c3aa-4d11-9d58-3e2ba9ba0776	468661e6-2674-4645-b419-388f967629d8	billing	credits	t	t	t	t	2026-01-27 01:50:55.743913+00	2026-01-27 01:50:55.743913+00
a5159ade-729a-469b-b3a2-9de06cc94ba2	468661e6-2674-4645-b419-388f967629d8	billing	transactions	t	t	t	t	2026-01-27 01:50:55.74429+00	2026-01-27 01:50:55.74429+00
06be6aec-5fe9-4ab0-8859-add29cc02a57	468661e6-2674-4645-b419-388f967629d8	billing	payments	t	t	t	t	2026-01-27 01:50:55.744757+00	2026-01-27 01:50:55.744757+00
dcf15654-a8ba-4ca5-ac5e-bbd6ea16cb79	468661e6-2674-4645-b419-388f967629d8	phones	phone_numbers	t	t	t	t	2026-01-27 01:50:55.745152+00	2026-01-27 01:50:55.745152+00
de1522ca-7c08-4b5e-8a2c-8eb1db509205	468661e6-2674-4645-b419-388f967629d8	batch_jobs	view_batch_jobs	t	t	t	t	2026-01-27 01:50:55.745611+00	2026-01-27 01:50:55.745611+00
9e10cc3c-f103-4b4f-8e82-60b326b493e0	468661e6-2674-4645-b419-388f967629d8	batch_jobs	manage_batch_jobs	t	t	t	t	2026-01-27 01:50:55.746022+00	2026-01-27 01:50:55.746022+00
a26b448b-6c02-431b-bddc-6ecf087aa1cc	468661e6-2674-4645-b419-388f967629d8	batch_jobs	cancel_batch_jobs	t	t	t	t	2026-01-27 01:50:55.746375+00	2026-01-27 01:50:55.746375+00
d5642afc-229d-47c6-8ea1-cc83d799826c	468661e6-2674-4645-b419-388f967629d8	call_monitoring	all_calls	t	t	t	t	2026-01-27 01:50:55.746921+00	2026-01-27 01:50:55.746921+00
e0684389-c318-4efc-a215-c17e8b893096	468661e6-2674-4645-b419-388f967629d8	call_monitoring	banned_words	t	t	t	t	2026-01-27 01:50:55.747336+00	2026-01-27 01:50:55.747336+00
9fa54edf-01dc-4747-b458-824132bc0253	468661e6-2674-4645-b419-388f967629d8	communications	email_settings	t	t	t	t	2026-01-27 01:50:55.747781+00	2026-01-27 01:50:55.747781+00
0ba2a2cb-b2ef-47c3-ab81-8280f9a8d456	468661e6-2674-4645-b419-388f967629d8	communications	notifications	t	t	t	t	2026-01-27 01:50:55.748142+00	2026-01-27 01:50:55.748142+00
ccb7541f-a51f-4a85-96c1-ae12a3af1737	468661e6-2674-4645-b419-388f967629d8	voice_ai	twilio_openai_engine	t	t	t	t	2026-01-27 01:50:55.748586+00	2026-01-27 01:50:55.748586+00
71c67bd0-87d5-45fa-b5c8-4a7f592839d0	468661e6-2674-4645-b419-388f967629d8	voice_ai	plivo_openai_engine	t	t	t	t	2026-01-27 01:50:55.748996+00	2026-01-27 01:50:55.748996+00
34d5b8dc-e643-41b3-878b-3878585d04b4	468661e6-2674-4645-b419-388f967629d8	voice_ai	openai_pool	t	t	t	t	2026-01-27 01:50:55.749399+00	2026-01-27 01:50:55.749399+00
ae623905-1f04-44bc-8366-4ecc4cdac171	468661e6-2674-4645-b419-388f967629d8	voice_ai	plivo_settings	t	t	t	t	2026-01-27 01:50:55.749829+00	2026-01-27 01:50:55.749829+00
92678aa0-7f4f-4d10-abbf-7635233b46f5	468661e6-2674-4645-b419-388f967629d8	settings	master_settings	t	t	t	t	2026-01-27 01:50:55.75018+00	2026-01-27 01:50:55.75018+00
0030d42e-dc0d-4eda-b225-9af0799fe14c	468661e6-2674-4645-b419-388f967629d8	settings	elevenlabs_settings	t	t	t	t	2026-01-27 01:50:55.750654+00	2026-01-27 01:50:55.750654+00
8a7a38dc-8632-4ff5-aa37-87573e6c8171	468661e6-2674-4645-b419-388f967629d8	settings	seo_settings	t	t	t	t	2026-01-27 01:50:55.75103+00	2026-01-27 01:50:55.75103+00
347dd24e-fcaf-4a26-b90c-8795f18077d0	468661e6-2674-4645-b419-388f967629d8	settings	analytics_settings	t	t	t	t	2026-01-27 01:50:55.751446+00	2026-01-27 01:50:55.751446+00
33bb1597-56b2-4f6e-85aa-b3855536dff2	468661e6-2674-4645-b419-388f967629d8	settings	languages_settings	t	t	t	t	2026-01-27 01:50:55.751866+00	2026-01-27 01:50:55.751866+00
58c713c1-54ef-437d-8131-427298b609f0	468661e6-2674-4645-b419-388f967629d8	settings	system_settings	t	t	t	t	2026-01-27 01:50:55.752244+00	2026-01-27 01:50:55.752244+00
97a40433-5637-4b42-affd-020fdbf9bc4f	9474289d-cf13-4cf9-b712-c87d16994509	users	view_users	t	t	t	f	2026-01-27 01:50:55.753295+00	2026-01-27 01:50:55.753295+00
5540d8a2-67ba-4c49-aed0-925d3da77995	9474289d-cf13-4cf9-b712-c87d16994509	users	edit_users	t	t	t	f	2026-01-27 01:50:55.753651+00	2026-01-27 01:50:55.753651+00
8b54fe47-a262-4d4d-a362-d21528bc3558	9474289d-cf13-4cf9-b712-c87d16994509	users	suspend_users	t	t	t	f	2026-01-27 01:50:55.753938+00	2026-01-27 01:50:55.753938+00
b4458033-f559-4f53-8e96-d6b8c846cf79	9474289d-cf13-4cf9-b712-c87d16994509	users	delete_users	t	t	t	f	2026-01-27 01:50:55.754219+00	2026-01-27 01:50:55.754219+00
c8fe9424-c7db-4ad6-8c41-9a86cdfebbd8	9474289d-cf13-4cf9-b712-c87d16994509	users	manage_credits	t	t	t	f	2026-01-27 01:50:55.75466+00	2026-01-27 01:50:55.75466+00
7eb833b0-7f48-4658-8706-eebd117b6cd0	9474289d-cf13-4cf9-b712-c87d16994509	users	manage_plans	t	t	t	f	2026-01-27 01:50:55.754988+00	2026-01-27 01:50:55.754988+00
1b5ed2ef-cb1c-4879-a888-1b7d651a54df	9474289d-cf13-4cf9-b712-c87d16994509	contacts	view_contacts	t	t	t	f	2026-01-27 01:50:55.755336+00	2026-01-27 01:50:55.755336+00
a96672a3-1147-405e-ae16-a8c92c048e8d	9474289d-cf13-4cf9-b712-c87d16994509	contacts	edit_contacts	t	t	t	f	2026-01-27 01:50:55.755745+00	2026-01-27 01:50:55.755745+00
800f4d5e-91b4-48c5-bda4-50bb2101d0e8	9474289d-cf13-4cf9-b712-c87d16994509	contacts	delete_contacts	t	t	t	f	2026-01-27 01:50:55.756158+00	2026-01-27 01:50:55.756158+00
a55ef212-103f-4a3d-94d8-836663f02fdd	9474289d-cf13-4cf9-b712-c87d16994509	contacts	export_contacts	t	t	t	f	2026-01-27 01:50:55.756546+00	2026-01-27 01:50:55.756546+00
d6f41661-2148-45cc-aea1-e7d6440d1ae1	9474289d-cf13-4cf9-b712-c87d16994509	billing	plans	t	t	t	f	2026-01-27 01:50:55.756914+00	2026-01-27 01:50:55.756914+00
016dc07c-6607-45a3-8f09-ff423867a749	9474289d-cf13-4cf9-b712-c87d16994509	billing	credits	t	t	t	f	2026-01-27 01:50:55.757285+00	2026-01-27 01:50:55.757285+00
fb048241-b04c-4729-b035-0c3568cc9c8f	9474289d-cf13-4cf9-b712-c87d16994509	billing	transactions	t	t	t	f	2026-01-27 01:50:55.757638+00	2026-01-27 01:50:55.757638+00
1deb0c50-a180-47f2-9d8c-ab3f66c4cf35	9474289d-cf13-4cf9-b712-c87d16994509	billing	payments	t	t	t	f	2026-01-27 01:50:55.757991+00	2026-01-27 01:50:55.757991+00
746fbc93-402e-48dc-9afa-cc9aa62f5bbd	9474289d-cf13-4cf9-b712-c87d16994509	phones	phone_numbers	t	t	t	f	2026-01-27 01:50:55.758365+00	2026-01-27 01:50:55.758365+00
e471114e-01da-495c-8d2b-3c8b0c02b88f	9474289d-cf13-4cf9-b712-c87d16994509	batch_jobs	view_batch_jobs	t	t	t	f	2026-01-27 01:50:55.758716+00	2026-01-27 01:50:55.758716+00
ff9b06eb-28be-4bc0-ad23-d52be996691b	9474289d-cf13-4cf9-b712-c87d16994509	batch_jobs	manage_batch_jobs	t	t	t	f	2026-01-27 01:50:55.759076+00	2026-01-27 01:50:55.759076+00
a65c9aa2-c5a1-4195-b610-89ea39259714	9474289d-cf13-4cf9-b712-c87d16994509	batch_jobs	cancel_batch_jobs	t	t	t	f	2026-01-27 01:50:55.759512+00	2026-01-27 01:50:55.759512+00
ecc3407a-8d0e-481d-844d-8ec876d73275	9474289d-cf13-4cf9-b712-c87d16994509	call_monitoring	all_calls	t	t	t	f	2026-01-27 01:50:55.759968+00	2026-01-27 01:50:55.759968+00
853e468e-06cf-4b90-a13b-2ad90899689e	9474289d-cf13-4cf9-b712-c87d16994509	call_monitoring	banned_words	t	t	t	f	2026-01-27 01:50:55.760438+00	2026-01-27 01:50:55.760438+00
d2f6c939-dd18-4a43-9588-ddc9c83f6956	9474289d-cf13-4cf9-b712-c87d16994509	communications	email_settings	t	t	t	f	2026-01-27 01:50:55.760877+00	2026-01-27 01:50:55.760877+00
4c54d570-3994-4b55-b798-16e2f018abd0	9474289d-cf13-4cf9-b712-c87d16994509	communications	notifications	t	t	t	f	2026-01-27 01:50:55.761281+00	2026-01-27 01:50:55.761281+00
b1d6b756-05a2-421a-8eba-54e4e6d92260	9474289d-cf13-4cf9-b712-c87d16994509	voice_ai	twilio_openai_engine	t	t	t	f	2026-01-27 01:50:55.761689+00	2026-01-27 01:50:55.761689+00
e3156d93-2b8f-4d30-99cb-e27aa5a19823	9474289d-cf13-4cf9-b712-c87d16994509	voice_ai	plivo_openai_engine	t	t	t	f	2026-01-27 01:50:55.762086+00	2026-01-27 01:50:55.762086+00
f0afef80-f227-447e-8c4c-9565a47b61b7	9474289d-cf13-4cf9-b712-c87d16994509	voice_ai	openai_pool	t	t	t	f	2026-01-27 01:50:55.762517+00	2026-01-27 01:50:55.762517+00
54f9d92a-931f-4337-a999-d43cf4fe90f0	9474289d-cf13-4cf9-b712-c87d16994509	voice_ai	plivo_settings	t	t	t	f	2026-01-27 01:50:55.762972+00	2026-01-27 01:50:55.762972+00
5d286010-b5cb-4fc5-ac12-eb1d7a2f5365	9474289d-cf13-4cf9-b712-c87d16994509	settings	master_settings	t	t	t	f	2026-01-27 01:50:55.763406+00	2026-01-27 01:50:55.763406+00
d6a9325c-48b4-458e-b992-443e1f44dca3	9474289d-cf13-4cf9-b712-c87d16994509	settings	elevenlabs_settings	t	t	t	f	2026-01-27 01:50:55.763826+00	2026-01-27 01:50:55.763826+00
9d44ca76-efb4-483f-aae9-2b13da1d41e9	9474289d-cf13-4cf9-b712-c87d16994509	settings	seo_settings	t	t	t	f	2026-01-27 01:50:55.764177+00	2026-01-27 01:50:55.764177+00
c453d83d-d062-4222-a119-0bfc29da6d51	9474289d-cf13-4cf9-b712-c87d16994509	settings	analytics_settings	t	t	t	f	2026-01-27 01:50:55.764531+00	2026-01-27 01:50:55.764531+00
4823c8d4-71af-4474-bd0c-03ae2d14289a	9474289d-cf13-4cf9-b712-c87d16994509	settings	languages_settings	t	t	t	f	2026-01-27 01:50:55.76486+00	2026-01-27 01:50:55.76486+00
f17eddf3-230d-470b-b358-fa10d2cfbadf	9474289d-cf13-4cf9-b712-c87d16994509	settings	system_settings	t	t	t	f	2026-01-27 01:50:55.765189+00	2026-01-27 01:50:55.765189+00
46b843ca-abed-45d6-9d1c-ac74878d32d0	04db68d6-3870-434f-beed-04f4ac73380f	users	view_users	f	t	f	f	2026-01-27 01:50:55.765957+00	2026-01-27 01:50:55.765957+00
f4f62041-1fe1-44a1-86f9-9543b4cc89e1	04db68d6-3870-434f-beed-04f4ac73380f	users	edit_users	f	t	f	f	2026-01-27 01:50:55.766321+00	2026-01-27 01:50:55.766321+00
3638dc3a-af7a-466a-8fb9-e5bd9c98e659	04db68d6-3870-434f-beed-04f4ac73380f	users	suspend_users	f	t	f	f	2026-01-27 01:50:55.766699+00	2026-01-27 01:50:55.766699+00
5c60db56-d559-4731-962f-4fade9e04efe	04db68d6-3870-434f-beed-04f4ac73380f	users	delete_users	f	t	f	f	2026-01-27 01:50:55.767025+00	2026-01-27 01:50:55.767025+00
7b52388d-1cf0-4427-ab95-7eeb58533502	04db68d6-3870-434f-beed-04f4ac73380f	users	manage_credits	f	t	f	f	2026-01-27 01:50:55.767369+00	2026-01-27 01:50:55.767369+00
1a27c666-2eeb-4a48-9220-d3d45ee41102	04db68d6-3870-434f-beed-04f4ac73380f	users	manage_plans	f	t	f	f	2026-01-27 01:50:55.7677+00	2026-01-27 01:50:55.7677+00
5f01b4d2-c08b-4370-9f14-960c48e21a55	04db68d6-3870-434f-beed-04f4ac73380f	contacts	view_contacts	f	t	f	f	2026-01-27 01:50:55.768043+00	2026-01-27 01:50:55.768043+00
3a1cc009-1ea6-4d69-9899-49c9b9673e60	04db68d6-3870-434f-beed-04f4ac73380f	contacts	edit_contacts	f	t	f	f	2026-01-27 01:50:55.768355+00	2026-01-27 01:50:55.768355+00
94a4d8d7-457b-426d-a6f7-33af1bf5de1c	04db68d6-3870-434f-beed-04f4ac73380f	contacts	delete_contacts	f	t	f	f	2026-01-27 01:50:55.768702+00	2026-01-27 01:50:55.768702+00
5c476b4e-e57b-46c9-bab5-5330f42a7317	04db68d6-3870-434f-beed-04f4ac73380f	contacts	export_contacts	f	t	f	f	2026-01-27 01:50:55.769025+00	2026-01-27 01:50:55.769025+00
80b4fda2-df36-4e8e-ad68-7e44470f6f56	04db68d6-3870-434f-beed-04f4ac73380f	billing	plans	f	t	f	f	2026-01-27 01:50:55.769372+00	2026-01-27 01:50:55.769372+00
bba254f9-ab85-44fb-aa9e-3393874ffbe9	04db68d6-3870-434f-beed-04f4ac73380f	billing	credits	f	t	f	f	2026-01-27 01:50:55.769774+00	2026-01-27 01:50:55.769774+00
6a6a62c5-316f-409c-aaaf-254366df931c	04db68d6-3870-434f-beed-04f4ac73380f	billing	transactions	f	t	f	f	2026-01-27 01:50:55.77015+00	2026-01-27 01:50:55.77015+00
9e1e4b04-3937-441c-8a46-03bc1912f375	04db68d6-3870-434f-beed-04f4ac73380f	billing	payments	f	t	f	f	2026-01-27 01:50:55.770664+00	2026-01-27 01:50:55.770664+00
e793ac01-7346-4092-9fec-3f3464255eb9	04db68d6-3870-434f-beed-04f4ac73380f	phones	phone_numbers	f	t	f	f	2026-01-27 01:50:55.77106+00	2026-01-27 01:50:55.77106+00
4119e6a9-4c56-4e54-af6a-f7e17c289eef	04db68d6-3870-434f-beed-04f4ac73380f	batch_jobs	view_batch_jobs	f	t	f	f	2026-01-27 01:50:55.771526+00	2026-01-27 01:50:55.771526+00
e0acd840-fc19-4fe2-b30f-655200133489	04db68d6-3870-434f-beed-04f4ac73380f	batch_jobs	manage_batch_jobs	f	t	f	f	2026-01-27 01:50:55.771886+00	2026-01-27 01:50:55.771886+00
bc350957-898d-4c73-bc07-7ae57b4616ff	04db68d6-3870-434f-beed-04f4ac73380f	batch_jobs	cancel_batch_jobs	f	t	f	f	2026-01-27 01:50:55.772182+00	2026-01-27 01:50:55.772182+00
642fef82-ff0a-46ef-bb41-bb9904d6c2d4	04db68d6-3870-434f-beed-04f4ac73380f	call_monitoring	all_calls	f	t	f	f	2026-01-27 01:50:55.772599+00	2026-01-27 01:50:55.772599+00
c3c5cddc-7e73-4610-8899-5bc9552afd89	04db68d6-3870-434f-beed-04f4ac73380f	call_monitoring	banned_words	f	t	f	f	2026-01-27 01:50:55.772945+00	2026-01-27 01:50:55.772945+00
a6dc4bd5-24a2-4809-8e0e-cca1c2484d9e	04db68d6-3870-434f-beed-04f4ac73380f	communications	email_settings	f	t	f	f	2026-01-27 01:50:55.773308+00	2026-01-27 01:50:55.773308+00
bbc688fd-e37b-4a9d-973b-c78ae8c48532	04db68d6-3870-434f-beed-04f4ac73380f	communications	notifications	f	t	f	f	2026-01-27 01:50:55.77372+00	2026-01-27 01:50:55.77372+00
df738c15-0e8a-4236-bb57-4b32e5004571	04db68d6-3870-434f-beed-04f4ac73380f	voice_ai	twilio_openai_engine	f	t	f	f	2026-01-27 01:50:55.774088+00	2026-01-27 01:50:55.774088+00
480c4f88-cffc-420f-9bdb-026589d33dc2	04db68d6-3870-434f-beed-04f4ac73380f	voice_ai	plivo_openai_engine	f	t	f	f	2026-01-27 01:50:55.774809+00	2026-01-27 01:50:55.774809+00
dfb930cb-7653-4d40-8ee1-1aa4edf9ded9	04db68d6-3870-434f-beed-04f4ac73380f	voice_ai	openai_pool	f	t	f	f	2026-01-27 01:50:55.775153+00	2026-01-27 01:50:55.775153+00
57b9a11e-652e-4e0e-b89e-27ab7cf0421c	04db68d6-3870-434f-beed-04f4ac73380f	voice_ai	plivo_settings	f	t	f	f	2026-01-27 01:50:55.77555+00	2026-01-27 01:50:55.77555+00
b8414859-dcee-4157-a8b4-d1fd73b1a22b	04db68d6-3870-434f-beed-04f4ac73380f	settings	master_settings	f	t	f	f	2026-01-27 01:50:55.775897+00	2026-01-27 01:50:55.775897+00
7df07f1f-2ed0-4ea8-aa8b-165ffc770a8b	04db68d6-3870-434f-beed-04f4ac73380f	settings	elevenlabs_settings	f	t	f	f	2026-01-27 01:50:55.776298+00	2026-01-27 01:50:55.776298+00
4d4ef403-86d6-4bfc-ae9b-ee096af7ebe4	04db68d6-3870-434f-beed-04f4ac73380f	settings	seo_settings	f	t	f	f	2026-01-27 01:50:55.776689+00	2026-01-27 01:50:55.776689+00
64710ebc-b690-451c-bd41-840b3b901aa6	04db68d6-3870-434f-beed-04f4ac73380f	settings	analytics_settings	f	t	f	f	2026-01-27 01:50:55.777032+00	2026-01-27 01:50:55.777032+00
e39270d0-870b-4166-9fc1-670c6230a020	04db68d6-3870-434f-beed-04f4ac73380f	settings	languages_settings	f	t	f	f	2026-01-27 01:50:55.777419+00	2026-01-27 01:50:55.777419+00
7d6abcf0-f444-43e6-94bb-49dbd5783f77	04db68d6-3870-434f-beed-04f4ac73380f	settings	system_settings	f	t	f	f	2026-01-27 01:50:55.777792+00	2026-01-27 01:50:55.777792+00
fd16d4b0-b4d7-497f-b90c-848cdf17d79d	34479650-ef48-4e6e-a186-08dc6771a0fa	users	view_users	f	t	f	f	2026-01-27 01:50:55.778741+00	2026-01-27 01:50:55.778741+00
639a9ec4-7f51-4c53-b3df-c8c7a51709db	34479650-ef48-4e6e-a186-08dc6771a0fa	users	edit_users	f	t	f	f	2026-01-27 01:50:55.779149+00	2026-01-27 01:50:55.779149+00
c545dd0e-22c8-4a27-9b2d-5b22edec1400	34479650-ef48-4e6e-a186-08dc6771a0fa	users	suspend_users	f	t	f	f	2026-01-27 01:50:55.779605+00	2026-01-27 01:50:55.779605+00
ce655d9d-953c-46e8-b2c0-38aedbedd2a4	34479650-ef48-4e6e-a186-08dc6771a0fa	users	delete_users	f	t	f	f	2026-01-27 01:50:55.779997+00	2026-01-27 01:50:55.779997+00
5ee41cc2-87c2-4b54-ab07-a22e7f84e142	34479650-ef48-4e6e-a186-08dc6771a0fa	users	manage_credits	f	t	f	f	2026-01-27 01:50:55.78037+00	2026-01-27 01:50:55.78037+00
5820673d-c85f-43c6-9925-1f1f8a96678f	34479650-ef48-4e6e-a186-08dc6771a0fa	users	manage_plans	f	t	f	f	2026-01-27 01:50:55.780743+00	2026-01-27 01:50:55.780743+00
0e957329-4c1a-405c-8356-6954fbbd73f2	34479650-ef48-4e6e-a186-08dc6771a0fa	contacts	view_contacts	f	t	f	f	2026-01-27 01:50:55.781046+00	2026-01-27 01:50:55.781046+00
c688f003-8b04-43a2-9fbe-10e746abde85	34479650-ef48-4e6e-a186-08dc6771a0fa	contacts	edit_contacts	f	t	f	f	2026-01-27 01:50:55.781437+00	2026-01-27 01:50:55.781437+00
66fa063d-bdad-4b7f-b82a-de058a2093bf	34479650-ef48-4e6e-a186-08dc6771a0fa	contacts	delete_contacts	f	t	f	f	2026-01-27 01:50:55.781837+00	2026-01-27 01:50:55.781837+00
0a6a56f2-bc7c-418d-a84f-2a8ce59d7070	34479650-ef48-4e6e-a186-08dc6771a0fa	contacts	export_contacts	f	t	f	f	2026-01-27 01:50:55.782174+00	2026-01-27 01:50:55.782174+00
ebf3df37-7fbd-4406-a904-f4e077fa1220	34479650-ef48-4e6e-a186-08dc6771a0fa	billing	plans	f	t	f	f	2026-01-27 01:50:55.782518+00	2026-01-27 01:50:55.782518+00
1e74acfc-c5d4-434e-b0ec-930312d8d907	34479650-ef48-4e6e-a186-08dc6771a0fa	billing	credits	f	t	f	f	2026-01-27 01:50:55.782863+00	2026-01-27 01:50:55.782863+00
e02acb46-189f-41a9-9129-ba28c26780de	34479650-ef48-4e6e-a186-08dc6771a0fa	billing	transactions	f	t	f	f	2026-01-27 01:50:55.783149+00	2026-01-27 01:50:55.783149+00
50004c9b-9320-4ff3-aa00-2944a5ccce7a	34479650-ef48-4e6e-a186-08dc6771a0fa	billing	payments	f	t	f	f	2026-01-27 01:50:55.783494+00	2026-01-27 01:50:55.783494+00
ac898687-666a-4f24-81ed-de21758e1f2b	34479650-ef48-4e6e-a186-08dc6771a0fa	phones	phone_numbers	f	t	f	f	2026-01-27 01:50:55.783783+00	2026-01-27 01:50:55.783783+00
aa85c615-e7b6-4518-9c16-e4ca3deed8b6	34479650-ef48-4e6e-a186-08dc6771a0fa	batch_jobs	view_batch_jobs	f	t	f	f	2026-01-27 01:50:55.784131+00	2026-01-27 01:50:55.784131+00
149ce3b3-f77e-42cc-8298-a89fd320c93a	34479650-ef48-4e6e-a186-08dc6771a0fa	batch_jobs	manage_batch_jobs	f	t	f	f	2026-01-27 01:50:55.784542+00	2026-01-27 01:50:55.784542+00
9644282a-0150-4439-a1b4-9df1ad6822fe	34479650-ef48-4e6e-a186-08dc6771a0fa	batch_jobs	cancel_batch_jobs	f	t	f	f	2026-01-27 01:50:55.784958+00	2026-01-27 01:50:55.784958+00
22f5b2f6-b7ae-4cd8-aca1-cc5b4c90eda5	34479650-ef48-4e6e-a186-08dc6771a0fa	call_monitoring	all_calls	f	t	f	f	2026-01-27 01:50:55.785364+00	2026-01-27 01:50:55.785364+00
c2cb9f91-78c3-48ee-85f6-c93831e3fd69	34479650-ef48-4e6e-a186-08dc6771a0fa	call_monitoring	banned_words	f	t	f	f	2026-01-27 01:50:55.785738+00	2026-01-27 01:50:55.785738+00
bafe63de-197d-4794-80e8-d90791f1dc4b	34479650-ef48-4e6e-a186-08dc6771a0fa	communications	email_settings	f	t	f	f	2026-01-27 01:50:55.786091+00	2026-01-27 01:50:55.786091+00
90d207e3-d45c-4db2-8f1a-d2e6a04f2697	34479650-ef48-4e6e-a186-08dc6771a0fa	communications	notifications	f	t	f	f	2026-01-27 01:50:55.78646+00	2026-01-27 01:50:55.78646+00
867f4935-58b8-4a8a-9675-4f117014bdc1	34479650-ef48-4e6e-a186-08dc6771a0fa	voice_ai	twilio_openai_engine	f	t	f	f	2026-01-27 01:50:55.786902+00	2026-01-27 01:50:55.786902+00
4e665db6-4399-4a73-bff0-2ed2eefbe2d9	34479650-ef48-4e6e-a186-08dc6771a0fa	voice_ai	plivo_openai_engine	f	t	f	f	2026-01-27 01:50:55.78733+00	2026-01-27 01:50:55.78733+00
52b22571-54b9-425e-b793-a5037c5c2815	34479650-ef48-4e6e-a186-08dc6771a0fa	voice_ai	openai_pool	f	t	f	f	2026-01-27 01:50:55.787726+00	2026-01-27 01:50:55.787726+00
7d822da3-7277-4eae-9516-caea27d4c36b	34479650-ef48-4e6e-a186-08dc6771a0fa	voice_ai	plivo_settings	f	t	f	f	2026-01-27 01:50:55.788147+00	2026-01-27 01:50:55.788147+00
0dba7c16-447a-4353-be56-44aec6608063	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	master_settings	f	t	f	f	2026-01-27 01:50:55.788547+00	2026-01-27 01:50:55.788547+00
4d3010a7-a982-4472-b5d9-57fe4d08dc59	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	elevenlabs_settings	f	t	f	f	2026-01-27 01:50:55.788966+00	2026-01-27 01:50:55.788966+00
636679bc-15c4-4651-9868-aef90114ca54	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	seo_settings	f	t	f	f	2026-01-27 01:50:55.789374+00	2026-01-27 01:50:55.789374+00
111e91b6-58d4-4210-a7c3-1e9283f436e2	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	analytics_settings	f	t	f	f	2026-01-27 01:50:55.789789+00	2026-01-27 01:50:55.789789+00
029bf57a-1247-421f-af42-009855ddc45b	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	languages_settings	f	t	f	f	2026-01-27 01:50:55.790215+00	2026-01-27 01:50:55.790215+00
1ca797a4-00a0-472c-b418-18c8166aa659	34479650-ef48-4e6e-a186-08dc6771a0fa	settings	system_settings	f	t	f	f	2026-01-27 01:50:55.790585+00	2026-01-27 01:50:55.790585+00
\.


--
-- Data for Name: admin_team_roles; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.admin_team_roles (id, admin_team_id, name, display_name, description, is_system, is_default, created_at, updated_at) FROM stdin;
468661e6-2674-4645-b419-388f967629d8	a19587da-5407-4b1a-89a3-2f1fdf86f906	super_admin	Super Admin	Full access to all admin features	t	f	2026-01-27 01:50:55.736872+00	2026-01-27 01:50:55.736872+00
9474289d-cf13-4cf9-b712-c87d16994509	a19587da-5407-4b1a-89a3-2f1fdf86f906	admin	Admin	Manage users and billing	t	t	2026-01-27 01:50:55.752637+00	2026-01-27 01:50:55.752637+00
04db68d6-3870-434f-beed-04f4ac73380f	a19587da-5407-4b1a-89a3-2f1fdf86f906	support	Support	View users and handle support	t	f	2026-01-27 01:50:55.765544+00	2026-01-27 01:50:55.765544+00
34479650-ef48-4e6e-a186-08dc6771a0fa	a19587da-5407-4b1a-89a3-2f1fdf86f906	viewer	Viewer	Read-only access	t	f	2026-01-27 01:50:55.778153+00	2026-01-27 01:50:55.778153+00
\.


--
-- Data for Name: admin_teams; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.admin_teams (id, name, description, settings, created_at, updated_at) FROM stdin;
a19587da-5407-4b1a-89a3-2f1fdf86f906	Admin Team	Platform administration team for sub-admins	{"maxMembers": 50, "allowCustomRoles": true, "sessionExpiryHours": 24, "requireEmailVerification": false}	2026-01-27 01:50:55.735665+00	2026-01-27 01:50:55.735665+00
\.


--
-- Data for Name: agent_versions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.agent_versions (id, agent_id, version_number, snapshot, changes_summary, changed_fields, edited_by, note, created_at) FROM stdin;
95f701c4-9964-4052-a79e-689d463a0495	d3a95385-aa47-42a5-b26d-8ebd9a5afed3	1	{"name": "test in Agent", "type": "incoming", "config": null, "language": "ar", "llmModel": "gpt-4o-mini-realtime-preview", "voiceTone": "Friendly, efficient, organized", "voiceSpeed": 1, "personality": "Helpful scheduling assistant who values your time", "temperature": 0.5, "firstMessage": "Hi there! Thanks for your interest in scheduling a meeting with Hala Voice. I'd love to help you find a time that works. May I start by getting your name?", "systemPrompt": "You are an appointment scheduling assistant for Hala Voice. Your responsibilities are:\\n- Qualify callers to ensure they're a good fit\\n- Check available time slots\\n- Book appointments efficiently\\n- Confirm date, time, and meeting details\\n- Send confirmation information\\n\\nAsk qualifying questions naturally before booking:\\n1. What service are you interested in?\\n2. Have you worked with us before?\\n3. What's the best time for you?\\n\\nBe efficient with the caller's time while ensuring you gather all necessary information.\\n\\nAvailable services: تطبيقات الذكاء الاصطناعي و تطبيعات الجوال و اى شىء مرتبط بالتقنية\\nMeeting duration: 30 minutes", "voiceStability": 0.55, "transferEnabled": false, "knowledgeBaseIds": [], "elevenLabsVoiceId": "", "maxDurationSeconds": null, "transferPhoneNumber": null, "voiceSimilarityBoost": 0.85, "detectLanguageEnabled": false, "endConversationEnabled": false}	Changed voice tone, Changed personality, Changed transfer phone number, Changed detect language enabled, Changed end conversation enabled, Changed max duration seconds, Changed conversation flow	{voiceTone,personality,transferPhoneNumber,detectLanguageEnabled,endConversationEnabled,maxDurationSeconds,flowId}	bec9ca09-fb9c-417b-ba28-108c859422b2	\N	2026-02-14 10:02:23.732962
a5516236-b428-4570-b819-41bf5f548d58	d3a95385-aa47-42a5-b26d-8ebd9a5afed3	2	{"name": "test in Agent", "type": "incoming", "config": null, "language": "ar", "llmModel": "gpt-4o-mini-realtime-preview", "voiceTone": "professional", "voiceSpeed": 1, "personality": "helpful", "temperature": 0.5, "firstMessage": "Hi there! Thanks for your interest in scheduling a meeting with Hala Voice. I'd love to help you find a time that works. May I start by getting your name?", "systemPrompt": "You are an appointment scheduling assistant for Hala Voice. Your responsibilities are:\\n- Qualify callers to ensure they're a good fit\\n- Check available time slots\\n- Book appointments efficiently\\n- Confirm date, time, and meeting details\\n- Send confirmation information\\n\\nAsk qualifying questions naturally before booking:\\n1. What service are you interested in?\\n2. Have you worked with us before?\\n3. What's the best time for you?\\n\\nBe efficient with the caller's time while ensuring you gather all necessary information.\\n\\nAvailable services: تطبيقات الذكاء الاصطناعي و تطبيعات الجوال و اى شىء مرتبط بالتقنية\\nMeeting duration: 30 minutes", "voiceStability": 0.55, "transferEnabled": false, "knowledgeBaseIds": [], "elevenLabsVoiceId": "", "maxDurationSeconds": 600, "transferPhoneNumber": "", "voiceSimilarityBoost": 0.85, "detectLanguageEnabled": true, "endConversationEnabled": true}	Changed name	{name}	bec9ca09-fb9c-417b-ba28-108c859422b2	\N	2026-02-14 10:02:42.340337
\.


--
-- Data for Name: analytics_scripts; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.analytics_scripts (id, name, type, code, head_code, body_code, placement, load_priority, async, defer, enabled, hide_on_internal_pages, description, updated_by, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: appointment_settings; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.appointment_settings (id, user_id, allow_overlapping, buffer_minutes, working_hours, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: appointments; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.appointments (id, user_id, call_id, flow_id, contact_name, contact_phone, contact_email, appointment_date, appointment_time, duration, service_name, notes, status, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: audit_logs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.audit_logs (id, action, user_id, target_user_id, resource_type, resource_id, ip_address, user_agent, metadata, severity, created_at) FROM stdin;
\.


--
-- Data for Name: banned_words; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.banned_words (id, word, category, severity, is_active, auto_block, created_by, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: calls; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.calls (id, user_id, campaign_id, contact_id, incoming_connection_id, widget_id, incoming_agent_id, phone_number, from_number, to_number, twilio_sid, elevenlabs_conversation_id, status, call_direction, duration, recording_url, transcript, ai_summary, classification, sentiment, metadata, was_transferred, transferred_to, transferred_at, started_at, ended_at, created_at) FROM stdin;
\.


--
-- Data for Name: campaign_jobs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.campaign_jobs (id, campaign_id, contact_id, engine, status, attempts, last_error, worker_id, created_at, processed_at, completed_at) FROM stdin;
\.


--
-- Data for Name: campaigns; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.campaigns (id, user_id, agent_id, voice_id, phone_number_id, sip_phone_number_id, plivo_phone_number_id, flow_id, name, type, goal, script, status, total_contacts, completed_calls, successful_calls, failed_calls, scheduled_for, started_at, completed_at, deleted_at, schedule_enabled, schedule_time_start, schedule_time_end, schedule_days, schedule_timezone, batch_job_id, batch_job_status, retry_enabled, error_message, error_code, config, created_at) FROM stdin;
\.


--
-- Data for Name: categories; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.categories (id, name_en, name_ar, icon, description_en, description_ar, sort_order, is_active, created_at, updated_at) FROM stdin;
9473153f-e52d-4e26-9f9a-3f909467bebd	Customer Service	خدمة العملاء	💬	Automated customer support agents	وكلاء دعم عملاء آليين	1	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
15c55470-4f75-45ec-b7d2-31d874780399	Sales & Marketing	المبيعات والتسويق	📈	Sales automation and marketing workflows	أتمتة المبيعات وسير عمل التسويق	2	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
d4d18bb3-bf61-42a5-9b0a-5c1114fe9f34	Data Processing	معالجة البيانات	🔄	Data transformation and processing agents	وكلاء تحويل ومعالجة البيانات	3	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
da339a27-4896-43be-b5a7-8e2d3af1e6e0	Integration	التكامل	🔗	Third-party service integrations	تكاملات الخدمات الخارجية	4	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
e0c66e1b-5dbd-4299-bf49-5a72b8a282b3	AI & ML	الذكاء الاصطناعي	🤖	AI and machine learning workflows	سير عمل الذكاء الاصطناعي والتعلم الآلي	5	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
043439e4-3162-44c7-aefe-4f1f41105c36	Automation	الأتمتة	⚡	General automation workflows	سير عمل الأتمتة العامة	6	t	2026-02-22 11:34:13.762101+00	2026-02-22 11:34:13.762101+00
\.


--
-- Data for Name: contacts; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.contacts (id, campaign_id, first_name, last_name, phone, email, custom_fields, status, created_at) FROM stdin;
\.


--
-- Data for Name: content_violations; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.content_violations (id, call_id, user_id, banned_word_id, detected_word, context, severity, status, reviewed_by, reviewed_at, action_taken, notes, created_at) FROM stdin;
\.


--
-- Data for Name: credit_packages; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.credit_packages (id, name, description, credits, price, razorpay_price, stripe_product_id, stripe_price_id, razorpay_item_id, paypal_price, paystack_price, mercadopago_price, is_active, created_at, updated_at) FROM stdin;
bf8d9204-bfd7-47b1-8ffd-758f961fe913	Starter Pack	100 credits - Perfect for testing and small campaigns	100	9.99	799.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
ee6ea6da-6080-45b6-8546-dae056735935	Growth Pack	500 credits - Best value for growing teams. Save 10%!	500	44.99	3599.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
0ffc6510-a076-431a-a162-7c6ddc985ee1	Business Pack	1,000 credits - Ideal for regular campaigns. Save 15%!	1000	84.99	6799.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
ad459703-aeb3-4b47-a66e-f89af68139e0	Professional Pack	2,500 credits - For power users. Save 20%!	2500	199.99	15999.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
a04aa2bf-6961-4beb-bff5-71a6f82c3711	Enterprise Pack	5,000 credits - Maximum savings for high-volume needs. Save 25%!	5000	374.99	29999.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
6dc20e98-cb11-491c-8b3e-ba7a0bdb9153	Mega Pack	10,000 credits - Best value for enterprise. Save 30%!	10000	699.99	55999.00	\N	\N	\N	\N	\N	\N	t	2026-01-26 23:27:41.878078	2026-01-26 23:27:41.878078
\.


--
-- Data for Name: credit_transactions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.credit_transactions (id, user_id, type, amount, description, reference, stripe_payment_id, widget_id, created_at) FROM stdin;
\.


--
-- Data for Name: crm_category_preferences; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.crm_category_preferences (id, user_id, column_order, color_overrides, column_sort_preferences, hide_leads_without_phone, category_pipeline_mappings, hot_score_threshold, warm_score_threshold, hidden_categories, created_at, updated_at) FROM stdin;
9b17465f-af5c-4265-be47-57e04f8dba82	bec9ca09-fb9c-417b-ba28-108c859422b2	{warm,hot,appointment_booked,form_submitted,call_transfer,need_follow_up}	{}	{}	f	{}	80	50	{}	2026-01-27 01:52:13.415464	2026-01-27 01:52:13.415464
\.


--
-- Data for Name: email_notification_settings; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.email_notification_settings (id, event_type, display_name, description, is_enabled, template_id, threshold_value, category, updated_by, created_at, updated_at) FROM stdin;
b59a84e4-a12f-457e-af67-c542ebbcdabe	welcomeEmail	Welcome Email	Sent when new user signs up	t	\N	\N	authentication	\N	2026-01-27 01:48:49.654024	2026-01-27 01:48:49.654024
69d937ad-75ca-42cb-a8b6-55e6c7d50736	purchaseConfirmation	Purchase Confirmation	Sent after successful payment	t	\N	\N	billing	\N	2026-01-27 01:48:49.656209	2026-01-27 01:48:49.656209
b25210a2-bde2-4d99-ab1d-b493e047665b	lowCredits	Low Credits Alert	Sent when credits fall below threshold	t	\N	\N	billing	\N	2026-01-27 01:48:49.659016	2026-01-27 01:48:49.659016
8595dba3-1408-4537-8e2b-78185fbdfe52	campaignCompleted	Campaign Completed	Sent when campaign finishes	t	\N	\N	campaigns	\N	2026-01-27 01:48:49.660406	2026-01-27 01:48:49.660406
40423bf2-b04b-4afa-b43e-c1b4d043fdc9	renewalReminder	Renewal Reminder	Sent before subscription renewal	t	\N	\N	billing	\N	2026-01-27 01:48:49.662048	2026-01-27 01:48:49.662048
e8be9c7d-cea2-4153-8b86-fb63fe99530e	paymentFailed	Payment Failed	Sent when payment fails	t	\N	\N	billing	\N	2026-01-27 01:48:49.663111	2026-01-27 01:48:49.663111
275db14c-9104-4231-ba4d-466fde432b74	accountSuspended	Account Suspended	Sent when account is suspended	t	\N	\N	account	\N	2026-01-27 01:48:49.664564	2026-01-27 01:48:49.664564
22066ee9-fa29-4330-bde0-38f2324efca5	accountReactivated	Account Reactivated	Sent when account is reactivated	t	\N	\N	account	\N	2026-01-27 01:48:49.665457	2026-01-27 01:48:49.665457
540c36fd-c213-457d-aad2-6191c5be6f94	membershipUpgrade	Membership Upgrade	Sent when user upgrades their plan	t	\N	\N	billing	\N	2026-01-27 01:48:49.666183	2026-01-27 01:48:49.666183
99fe6cc9-d4b4-40e6-92ab-ac2fe9e30157	phoneNumberBilling	Phone Number Billing	Sent for monthly phone number billing	t	\N	\N	billing	\N	2026-01-27 01:48:49.667094	2026-01-27 01:48:49.667094
\.


--
-- Data for Name: email_templates; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.email_templates (id, template_type, name, subject, html_body, text_body, variables, is_active, updated_at, created_at) FROM stdin;
66c3660b-6257-4c61-9c21-d6634561fbde	welcome	Welcome Email	Welcome to {{companyName}}!	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Welcome to {{companyName}}!</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        Thank you for joining {{companyName}}! We're excited to have you on board. Our AI-powered bulk calling platform is designed to help you automate your outreach and engage with your contacts more effectively.\n      </p>\n      <div class="email-highlight-box">\n        <p style="margin: 0 0 12px 0; font-weight: 600; color: #1e293b;">Here's what you can do with {{companyName}}:</p>\n        <ul style="margin: 0; padding-left: 20px; color: #4b5563;">\n          <li style="margin-bottom: 8px;">Create AI-powered voice agents for automated calling</li>\n          <li style="margin-bottom: 8px;">Launch bulk calling campaigns with intelligent scheduling</li>\n          <li style="margin-bottom: 8px;">Track call analytics and performance metrics</li>\n          <li style="margin-bottom: 8px;">Integrate with your existing workflows</li>\n        </ul>\n      </div>\n      <p class="email-text">\n        Ready to get started? Log in to your dashboard and create your first AI agent.\n      </p>\n      <a href="{{dashboardUrl}}" class="email-button">Go to Dashboard</a>\n      <p class="email-text" style="font-size: 14px; color: #6b7280;">\n        If you have any questions, our support team is here to help.\n      </p>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Welcome to {{companyName}}!\n\nHi {{userName}},\n\nThank you for joining {{companyName}}! We're excited to have you on board. Our AI-powered bulk calling platform is designed to help you automate your outreach and engage with your contacts more effectively.\n\nHere's what you can do with {{companyName}}:\n- Create AI-powered voice agents for automated calling\n- Launch bulk calling campaigns with intelligent scheduling\n- Track call analytics and performance metrics\n- Integrate with your existing workflows\n\nReady to get started? Log in to your dashboard and create your first AI agent.\n\nGo to Dashboard: {{dashboardUrl}}\n\nIf you have any questions, our support team is here to help.\n\n© 2025 {{companyName}}. All rights reserved.	{userName,companyName,dashboardUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
c6509f82-637b-4498-b509-196a43bbbadf	purchase_confirmation	Purchase Confirmation	Payment Confirmed - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Payment Confirmed</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        Thank you for your purchase! Your payment has been successfully processed.\n      </p>\n      <div class="email-highlight-box">\n        <table class="email-table">\n          <tr>\n            <td>Description</td>\n            <td>{{description}}</td>\n          </tr>\n          <tr>\n            <td>Invoice Number</td>\n            <td style="font-family: monospace;">{{invoiceNumber}}</td>\n          </tr>\n          <tr>\n            <td>Transaction ID</td>\n            <td style="font-family: monospace; font-size: 13px;">{{transactionId}}</td>\n          </tr>\n          <tr>\n            <td>Amount Paid</td>\n            <td>{{currency}} {{amount}}</td>\n          </tr>\n        </table>\n      </div>\n      <div class="email-alert email-alert-success">\n        <strong>Your payment was successful!</strong> Your credits or subscription have been added to your account.\n      </div>\n      <p class="email-text">\n        You can view your transaction history and download invoices from your billing dashboard.\n      </p>\n      <a href="{{billingUrl}}" class="email-button">View Transaction History</a>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Payment Confirmed\n\nHi {{userName}},\n\nThank you for your purchase! Your payment has been successfully processed.\n\nTransaction Details:\n- Description: {{description}}\n- Invoice Number: {{invoiceNumber}}\n- Transaction ID: {{transactionId}}\n- Amount Paid: {{currency}} {{amount}}\n\nYour payment was successful! Your credits or subscription have been added to your account.\n\nYou can view your transaction history and download invoices from your billing dashboard.\n\nView Transaction History: {{billingUrl}}\n\n© 2025 {{companyName}}. All rights reserved.	{userName,amount,currency,description,invoiceNumber,transactionId,billingUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
ba9c7e45-9dd9-457d-9494-1ba4e82bb4df	low_credits	Low Credits Alert	Low Credits Alert - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Low Credits Alert</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        Your account credits are running low. To ensure uninterrupted service, consider purchasing more credits.\n      </p>\n      <div class="email-highlight-box">\n        <div class="email-metric">\n          <p class="email-metric-value">{{currentCredits}}</p>\n          <p class="email-metric-label">Credits Remaining</p>\n        </div>\n      </div>\n      <div class="email-alert">\n        <strong>Warning:</strong> Your credit balance is below {{threshold}} credits. Your campaigns may be paused if you run out of credits.\n      </div>\n      <p class="email-text">\n        Top up your credits now to keep your campaigns running smoothly.\n      </p>\n      <a href="{{creditsUrl}}" class="email-button">Purchase Credits</a>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Low Credits Alert\n\nHi {{userName}},\n\nYour account credits are running low. To ensure uninterrupted service, consider purchasing more credits.\n\nCredits Remaining: {{currentCredits}}\n\nWarning: Your credit balance is below {{threshold}} credits. Your campaigns may be paused if you run out of credits.\n\nTop up your credits now to keep your campaigns running smoothly.\n\nPurchase Credits: {{creditsUrl}}\n\n© 2025 {{companyName}}. All rights reserved.	{userName,currentCredits,threshold,creditsUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
091a89ba-a3f6-4b01-adcc-f468c7579b0b	campaign_completed	Campaign Completed	Campaign Completed: {{campaignName}} - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Campaign Completed</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        Great news! Your campaign "<strong>{{campaignName}}</strong>" has finished running.\n      </p>\n      <div class="email-highlight-box">\n        <table style="width: 100%; text-align: center;">\n          <tr>\n            <td style="padding: 16px;">\n              <p class="email-metric-value">{{callsCompleted}}</p>\n              <p class="email-metric-label">Calls Completed</p>\n            </td>\n            <td style="padding: 16px;">\n              <p class="email-metric-value">{{callsSuccessful}}</p>\n              <p class="email-metric-label">Successful Calls</p>\n            </td>\n            <td style="padding: 16px;">\n              <p class="email-metric-value">{{successRate}}%</p>\n              <p class="email-metric-label">Success Rate</p>\n            </td>\n          </tr>\n        </table>\n      </div>\n      <div class="email-alert email-alert-success">\n        <strong>Campaign completed successfully!</strong> View detailed analytics and transcripts in your dashboard.\n      </div>\n      <a href="{{campaignUrl}}" class="email-button">View Campaign Results</a>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Campaign Completed\n\nHi {{userName}},\n\nGreat news! Your campaign "{{campaignName}}" has finished running.\n\nCampaign Results:\n- Calls Completed: {{callsCompleted}}\n- Successful Calls: {{callsSuccessful}}\n- Success Rate: {{successRate}}%\n\nCampaign completed successfully! View detailed analytics and transcripts in your dashboard.\n\nView Campaign Results: {{campaignUrl}}\n\n© 2025 {{companyName}}. All rights reserved.	{userName,campaignName,callsCompleted,callsSuccessful,successRate,campaignUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
b4d71501-1771-402e-bd59-8d9477473c43	renewal_reminder	Subscription Renewal Reminder	Subscription Renewal Reminder - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Subscription Renewal Reminder</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        This is a friendly reminder that your {{planName}} subscription will renew soon.\n      </p>\n      <div class="email-highlight-box">\n        <table class="email-table">\n          <tr>\n            <td>Plan</td>\n            <td>{{planName}}</td>\n          </tr>\n          <tr>\n            <td>Renewal Date</td>\n            <td>{{renewalDate}}</td>\n          </tr>\n          <tr>\n            <td>Amount</td>\n            <td>{{amount}}</td>\n          </tr>\n        </table>\n      </div>\n      <div class="email-alert email-alert-info">\n        <strong>No action required.</strong> Your subscription will automatically renew on the date shown above.\n      </div>\n      <p class="email-text">\n        If you'd like to make changes to your subscription or update your payment method, please visit your billing settings.\n      </p>\n      <a href="{{billingUrl}}" class="email-button">Manage Subscription</a>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Subscription Renewal Reminder\n\nHi {{userName}},\n\nThis is a friendly reminder that your {{planName}} subscription will renew soon.\n\nSubscription Details:\n- Plan: {{planName}}\n- Renewal Date: {{renewalDate}}\n- Amount: {{amount}}\n\nNo action required. Your subscription will automatically renew on the date shown above.\n\nIf you'd like to make changes to your subscription or update your payment method, please visit your billing settings.\n\nManage Subscription: {{billingUrl}}\n\n© 2025 {{companyName}}. All rights reserved.	{userName,planName,renewalDate,amount,billingUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
78486b80-c6b7-4415-9da5-6066655a41b2	payment_failed	Payment Failed	Payment Failed - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Payment Failed</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        We were unable to process your payment. Please update your payment method to continue using {{companyName}}.\n      </p>\n      <div class="email-alert email-alert-error">\n        <strong>Payment declined:</strong> {{reason}}\n      </div>\n      <div class="email-highlight-box">\n        <div class="email-metric">\n          <p class="email-metric-value">{{amount}}</p>\n          <p class="email-metric-label">Amount Due</p>\n        </div>\n      </div>\n      <p class="email-text">\n        Please update your payment method as soon as possible to avoid any service interruptions.\n      </p>\n      <a href="{{billingUrl}}" class="email-button">Update Payment Method</a>\n      <p class="email-text" style="font-size: 14px; color: #6b7280; margin-top: 24px;">\n        If you believe this is an error or need assistance, please contact our support team.\n      </p>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Payment Failed\n\nHi {{userName}},\n\nWe were unable to process your payment. Please update your payment method to continue using {{companyName}}.\n\nPayment declined: {{reason}}\n\nAmount Due: {{amount}}\n\nPlease update your payment method as soon as possible to avoid any service interruptions.\n\nUpdate Payment Method: {{billingUrl}}\n\nIf you believe this is an error or need assistance, please contact our support team.\n\n© 2025 {{companyName}}. All rights reserved.	{userName,amount,reason,billingUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
6ddf3645-d2b6-4894-a1ee-f12cd064c511	account_suspended	Account Suspended	Account Suspended - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Account Suspended</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        Your {{companyName}} account has been suspended.\n      </p>\n      <div class="email-alert email-alert-error">\n        <strong>Reason for suspension:</strong> {{reason}}\n      </div>\n      <p class="email-text">\n        While your account is suspended, you will not be able to:\n      </p>\n      <ul style="color: #4b5563; margin: 0 0 24px 0; padding-left: 20px;">\n        <li style="margin-bottom: 8px;">Run or create new campaigns</li>\n        <li style="margin-bottom: 8px;">Make outbound calls</li>\n        <li style="margin-bottom: 8px;">Access certain features</li>\n      </ul>\n      <p class="email-text">\n        If you believe this suspension is in error, or if you would like to resolve the issue, please contact our support team immediately.\n      </p>\n      <a href="{{supportUrl}}" class="email-button">Contact Support</a>\n      <p class="email-text" style="font-size: 14px; color: #6b7280; margin-top: 24px;">\n        Please respond to this notice within 7 days to avoid permanent account termination.\n      </p>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Account Suspended\n\nHi {{userName}},\n\nYour {{companyName}} account has been suspended.\n\nReason for suspension: {{reason}}\n\nWhile your account is suspended, you will not be able to:\n- Run or create new campaigns\n- Make outbound calls\n- Access certain features\n\nIf you believe this suspension is in error, or if you would like to resolve the issue, please contact our support team immediately.\n\nContact Support: {{supportUrl}}\n\nPlease respond to this notice within 7 days to avoid permanent account termination.\n\n© 2025 {{companyName}}. All rights reserved.	{userName,reason,supportUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
c4c7f248-833d-4d03-9248-3f6da4590ba8	phone_billing	Phone Number Billing	Phone Number Billing - {{companyName}}	<!DOCTYPE html>\n<html lang="en">\n<head>\n  <meta charset="utf-8">\n  <meta name="viewport" content="width=device-width, initial-scale=1.0">\n  <meta http-equiv="X-UA-Compatible" content="IE=edge">\n  <title>{{companyName}}</title>\n  <style>\n    body {\n      font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;\n      line-height: 1.6;\n      color: #1f2937;\n      background-color: #f3f4f6;\n      margin: 0;\n      padding: 0;\n    }\n    .email-wrapper {\n      max-width: 600px;\n      margin: 0 auto;\n      padding: 40px 20px;\n    }\n    .email-container {\n      background: #ffffff;\n      border-radius: 12px;\n      box-shadow: 0 4px 6px rgba(0, 0, 0, 0.05);\n      overflow: hidden;\n    }\n    .email-header {\n      background: linear-gradient(135deg, #1e293b 0%, #334155 100%);\n      padding: 32px;\n      text-align: center;\n    }\n    .email-logo {\n      font-size: 28px;\n      font-weight: 700;\n      color: #ffffff;\n      margin: 0;\n      letter-spacing: -0.5px;\n    }\n    .email-tagline {\n      color: #94a3b8;\n      font-size: 14px;\n      margin: 8px 0 0 0;\n    }\n    .email-body {\n      padding: 40px 32px;\n    }\n    .email-title {\n      font-size: 24px;\n      font-weight: 600;\n      color: #1f2937;\n      margin: 0 0 16px 0;\n    }\n    .email-text {\n      font-size: 16px;\n      color: #4b5563;\n      margin: 0 0 24px 0;\n    }\n    .email-highlight-box {\n      background: #f8fafc;\n      border: 1px solid #e2e8f0;\n      border-radius: 8px;\n      padding: 24px;\n      margin: 24px 0;\n    }\n    .email-metric {\n      text-align: center;\n      padding: 16px;\n    }\n    .email-metric-value {\n      font-size: 36px;\n      font-weight: 700;\n      color: #1e293b;\n      margin: 0;\n      font-family: 'SF Mono', 'Monaco', 'Inconsolata', 'Fira Mono', monospace;\n    }\n    .email-metric-label {\n      font-size: 14px;\n      color: #64748b;\n      margin: 4px 0 0 0;\n      text-transform: uppercase;\n      letter-spacing: 0.5px;\n    }\n    .email-table {\n      width: 100%;\n      border-collapse: collapse;\n      margin: 16px 0;\n    }\n    .email-table td {\n      padding: 12px 0;\n      border-bottom: 1px solid #e5e7eb;\n      font-size: 15px;\n    }\n    .email-table td:first-child {\n      color: #6b7280;\n    }\n    .email-table td:last-child {\n      text-align: right;\n      font-weight: 500;\n      color: #1f2937;\n    }\n    .email-table tr:last-child td {\n      border-bottom: none;\n      font-weight: 600;\n    }\n    .email-button {\n      display: inline-block;\n      background: #1e293b;\n      color: #ffffff !important;\n      text-decoration: none;\n      padding: 14px 28px;\n      border-radius: 8px;\n      font-weight: 600;\n      font-size: 15px;\n      margin: 24px 0;\n    }\n    .email-button-secondary {\n      background: #f1f5f9;\n      color: #1e293b !important;\n    }\n    .email-alert {\n      background: #fef3c7;\n      border-left: 4px solid #f59e0b;\n      padding: 16px;\n      margin: 24px 0;\n      border-radius: 0 8px 8px 0;\n    }\n    .email-alert-error {\n      background: #fee2e2;\n      border-left-color: #ef4444;\n    }\n    .email-alert-success {\n      background: #dcfce7;\n      border-left-color: #22c55e;\n    }\n    .email-alert-info {\n      background: #dbeafe;\n      border-left-color: #3b82f6;\n    }\n    .email-footer {\n      background: #f8fafc;\n      padding: 24px 32px;\n      text-align: center;\n      border-top: 1px solid #e5e7eb;\n    }\n    .email-footer-text {\n      font-size: 13px;\n      color: #9ca3af;\n      margin: 0 0 12px 0;\n    }\n    .email-footer-links a {\n      color: #6b7280;\n      text-decoration: none;\n      margin: 0 8px;\n      font-size: 13px;\n    }\n    .email-footer-links a:hover {\n      color: #1f2937;\n    }\n    .email-divider {\n      border: 0;\n      height: 1px;\n      background: #e5e7eb;\n      margin: 24px 0;\n    }\n    @media only screen and (max-width: 600px) {\n      .email-wrapper {\n        padding: 20px 12px;\n      }\n      .email-body {\n        padding: 28px 20px;\n      }\n      .email-header {\n        padding: 24px 20px;\n      }\n      .email-title {\n        font-size: 20px;\n      }\n    }\n  </style>\n</head>\n<body>\n  <div class="email-wrapper">\n    <div class="email-container">\n      <div class="email-header">\n        <h1 class="email-logo">{{companyName}}</h1>\n        <p class="email-tagline">AI-Powered Bulk Calling Platform</p>\n      </div>\n      \n    <div class="email-body">\n      <h2 class="email-title">Phone Number Billing</h2>\n      <p class="email-text">\n        Hi {{userName}},\n      </p>\n      <p class="email-text">\n        This is a notification regarding the monthly billing for your phone number(s) on {{companyName}}.\n      </p>\n      <div class="email-highlight-box">\n        <table class="email-table">\n          <tr>\n            <td>Phone Number</td>\n            <td>{{phoneNumber}}</td>\n          </tr>\n          <tr>\n            <td>Billing Period</td>\n            <td>{{billingPeriod}}</td>\n          </tr>\n          <tr>\n            <td>Amount</td>\n            <td>{{amount}}</td>\n          </tr>\n          <tr>\n            <td>Status</td>\n            <td>{{status}}</td>\n          </tr>\n        </table>\n      </div>\n      <p class="email-text">\n        {{message}}\n      </p>\n      <a href="{{billingUrl}}" class="email-button">View Billing Details</a>\n      <p class="email-text" style="font-size: 14px; color: #6b7280; margin-top: 24px;">\n        If you have any questions about this charge, please contact our support team.\n      </p>\n    </div>\n  \n      <div class="email-footer">\n        <p class="email-footer-text">\n          &copy; 2025 {{companyName}}. All rights reserved.\n        </p>\n        <p class="email-footer-links">\n          <a href="{{unsubscribeUrl}}">Unsubscribe</a> |\n          <a href="{{privacyUrl}}">Privacy Policy</a> |\n          <a href="{{supportUrl}}">Contact Support</a>\n        </p>\n      </div>\n    </div>\n  </div>\n</body>\n</html>	Phone Number Billing\n\nHi {{userName}},\n\nThis is a notification regarding the monthly billing for your phone number(s) on {{companyName}}.\n\nPhone Number: {{phoneNumber}}\nBilling Period: {{billingPeriod}}\nAmount: {{amount}}\nStatus: {{status}}\n\n{{message}}\n\nView Billing Details: {{billingUrl}}\n\nIf you have any questions about this charge, please contact our support team.\n\n© 2025 {{companyName}}. All rights reserved.	{userName,phoneNumber,billingPeriod,amount,status,message,billingUrl}	t	2026-01-26 23:27:41.889332	2026-01-26 23:27:41.889332
\.


--
-- Data for Name: flow_executions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.flow_executions (id, call_id, flow_id, current_node_id, status, variables, path_taken, metadata, error, started_at, completed_at) FROM stdin;
\.


--
-- Data for Name: flows; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.flows (id, user_id, name, description, nodes, edges, agent_id, voice_settings, execution_config, is_active, is_template, compiled_system_prompt, compiled_first_message, compiled_states, compiled_tools, created_at, updated_at) FROM stdin;
template-lead-qualification	system	Lead Qualification	Qualify leads by asking about budget, timeline, and decision-making authority. Automatically routes qualified leads for follow-up.	[{"id": "node-greeting", "data": {"type": "message", "label": "Greeting", "config": {"type": "message", "message": "Hi! I'm calling to learn more about your business needs and see if our solutions might be a good fit. This will only take a few minutes. Is now a good time?", "waitForResponse": true}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-ask-company", "data": {"type": "question", "label": "Company Name", "config": {"type": "question", "question": "Great! To get started, could you tell me the name of your company?", "variableName": "company_name", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-ask-role", "data": {"type": "question", "label": "Role/Position", "config": {"type": "question", "question": "And what's your role at the company?", "variableName": "contact_role", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 290}}, {"id": "node-ask-budget", "data": {"type": "question", "label": "Budget Range", "config": {"type": "question", "question": "What's your approximate budget for this type of solution? Just a ballpark figure is fine.", "variableName": "budget_range", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 410}}, {"id": "node-ask-timeline", "data": {"type": "question", "label": "Timeline", "config": {"type": "question", "question": "When are you looking to implement a solution - in the next month, quarter, or is this for future planning?", "variableName": "timeline", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 530}}, {"id": "node-ask-authority", "data": {"type": "question", "label": "Decision Authority", "config": {"type": "question", "question": "Are you the primary decision-maker for this purchase, or will others be involved in the decision?", "variableName": "decision_authority", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 650}}, {"id": "node-check-qualified", "data": {"type": "condition", "label": "Check Qualification", "config": {"type": "condition", "condition": "The lead has a budget above $5000 and timeline within 3 months"}}, "type": "condition", "position": {"x": 250, "y": 770}}, {"id": "node-qualified-webhook", "data": {"type": "webhook", "label": "Send to CRM", "config": {"url": "https://your-crm-api.com/leads", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"status": "qualified", "priority": "high"}, "description": "Send qualified lead to CRM for immediate follow-up"}}, "type": "webhook", "position": {"x": 450, "y": 890}}, {"id": "node-qualified-end", "data": {"type": "end", "label": "Qualified Goodbye", "config": {"type": "end", "endMessage": "Wonderful! Based on what you've shared, I think we have some great options for you. Our sales team will reach out within 24 hours to schedule a detailed demo. Thank you for your time!"}}, "type": "end", "position": {"x": 450, "y": 1010}}, {"id": "node-nurture-webhook", "data": {"type": "webhook", "label": "Add to Nurture", "config": {"url": "https://your-crm-api.com/leads", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"status": "nurture", "priority": "normal"}, "description": "Add lead to nurture campaign for future follow-up"}}, "type": "webhook", "position": {"x": 50, "y": 890}}, {"id": "node-nurture-end", "data": {"type": "end", "label": "Nurture Goodbye", "config": {"type": "end", "endMessage": "Thank you for your time today. We'll keep you on our list and reach out when we have updates that might interest you. Have a great day!"}}, "type": "end", "position": {"x": 50, "y": 1010}}]	[{"id": "e1", "source": "node-greeting", "target": "node-ask-company"}, {"id": "e2", "source": "node-ask-company", "target": "node-ask-role"}, {"id": "e3", "source": "node-ask-role", "target": "node-ask-budget"}, {"id": "e4", "source": "node-ask-budget", "target": "node-ask-timeline"}, {"id": "e5", "source": "node-ask-timeline", "target": "node-ask-authority"}, {"id": "e6", "source": "node-ask-authority", "target": "node-check-qualified"}, {"id": "e7", "source": "node-check-qualified", "target": "node-qualified-webhook", "sourceHandle": "true"}, {"id": "e8", "source": "node-check-qualified", "target": "node-nurture-webhook", "sourceHandle": "false"}, {"id": "e9", "source": "node-qualified-webhook", "target": "node-qualified-end"}, {"id": "e10", "source": "node-nurture-webhook", "target": "node-nurture-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-appointment-booking	system	Appointment Booking	Schedule appointments with service selection, date/time collection, and automatic confirmation. Perfect for service businesses.	[{"id": "node-greeting", "data": {"type": "message", "label": "Welcome", "config": {"type": "message", "message": "Hi! Thank you for calling. I'd be happy to help you schedule an appointment. Let me collect a few details to find the best time for you.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-ask-name", "data": {"type": "question", "label": "Full Name", "config": {"type": "question", "question": "May I have your full name please?", "variableName": "full_name", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-ask-phone", "data": {"type": "question", "label": "Phone Number", "config": {"type": "question", "question": "And what's the best phone number to reach you?", "variableName": "phone_number", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 290}}, {"id": "node-ask-service", "data": {"type": "question", "label": "Service Type", "config": {"type": "question", "question": "Which service are you interested in? We offer Consultation, Demo, Technical Support, or Training sessions.", "variableName": "service_type", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 410}}, {"id": "node-book-appointment", "data": {"type": "appointment", "label": "Book Appointment", "config": {"type": "appointment", "appointmentType": "General Appointment", "waitForResponse": true}}, "type": "appointment", "position": {"x": 250, "y": 530}}, {"id": "node-confirm", "data": {"type": "message", "label": "Confirmation", "config": {"type": "message", "message": "Perfect! Your appointment has been confirmed. You'll receive a confirmation email and SMS reminder before your appointment.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 650}}, {"id": "node-webhook-notify", "data": {"type": "webhook", "label": "Notify Team", "config": {"url": "https://your-calendar-api.com/appointments", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"event": "appointment_booked"}, "description": "Notify team about new appointment"}}, "type": "webhook", "position": {"x": 250, "y": 770}}, {"id": "node-end", "data": {"type": "end", "label": "Goodbye", "config": {"type": "end", "endMessage": "Thank you for scheduling with us! We look forward to seeing you. Is there anything else I can help you with today? If not, have a wonderful day!"}}, "type": "end", "position": {"x": 250, "y": 890}}]	[{"id": "e1", "source": "node-greeting", "target": "node-ask-name"}, {"id": "e2", "source": "node-ask-name", "target": "node-ask-phone"}, {"id": "e3", "source": "node-ask-phone", "target": "node-ask-service"}, {"id": "e4", "source": "node-ask-service", "target": "node-book-appointment"}, {"id": "e5", "source": "node-book-appointment", "target": "node-confirm"}, {"id": "e6", "source": "node-confirm", "target": "node-webhook-notify"}, {"id": "e7", "source": "node-webhook-notify", "target": "node-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-nps-survey	system	Customer Satisfaction Survey (NPS)	Collect Net Promoter Score and detailed feedback. Routes promoters to testimonial requests and detractors to resolution paths.	[{"id": "node-greeting", "data": {"type": "message", "label": "Introduction", "config": {"type": "message", "message": "Hi! I'm calling from the customer success team. We'd love to hear about your recent experience with our service. This quick survey takes less than 2 minutes. Do you have a moment?", "waitForResponse": true}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-nps-score", "data": {"type": "question", "label": "NPS Score", "config": {"type": "question", "question": "On a scale of 0 to 10, how likely are you to recommend our service to a friend or colleague?", "variableName": "nps_score", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-ask-reason", "data": {"type": "question", "label": "Reason", "config": {"type": "question", "question": "Thank you! Could you briefly share the main reason for your score?", "variableName": "nps_reason", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 290}}, {"id": "node-check-promoter", "data": {"type": "condition", "label": "Check Score", "config": {"type": "condition", "condition": "The NPS score is 9 or 10 (promoter)"}}, "type": "condition", "position": {"x": 250, "y": 410}}, {"id": "node-ask-testimonial", "data": {"type": "question", "label": "Request Testimonial", "config": {"type": "question", "question": "We're so glad to hear that! Would you be willing to provide a brief testimonial we could share on our website?", "variableName": "testimonial_consent", "waitForResponse": true}}, "type": "question", "position": {"x": 450, "y": 530}}, {"id": "node-promoter-webhook", "data": {"type": "webhook", "label": "Log Promoter", "config": {"url": "https://your-crm.com/feedback", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"category": "promoter", "request_testimonial": true}, "description": "Log promoter feedback and testimonial request"}}, "type": "webhook", "position": {"x": 450, "y": 650}}, {"id": "node-ask-improvement", "data": {"type": "question", "label": "Improvement Ideas", "config": {"type": "question", "question": "We appreciate your honest feedback. What's one thing we could improve to make your experience better?", "variableName": "improvement_suggestion", "waitForResponse": true}}, "type": "question", "position": {"x": 50, "y": 530}}, {"id": "node-offer-callback", "data": {"type": "question", "label": "Offer Callback", "config": {"type": "question", "question": "Would you like a member of our support team to follow up with you about your concerns?", "variableName": "callback_requested", "waitForResponse": true}}, "type": "question", "position": {"x": 50, "y": 650}}, {"id": "node-detractor-webhook", "data": {"type": "webhook", "label": "Log Detractor", "config": {"url": "https://your-crm.com/feedback", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"category": "detractor", "priority": "high"}, "description": "Log detractor feedback for follow-up"}}, "type": "webhook", "position": {"x": 50, "y": 770}}, {"id": "node-promoter-end", "data": {"type": "end", "label": "Thank Promoter", "config": {"type": "end", "endMessage": "Thank you so much for your kind feedback and support! We truly appreciate customers like you. Have a wonderful day!"}}, "type": "end", "position": {"x": 450, "y": 770}}, {"id": "node-detractor-end", "data": {"type": "end", "label": "Thank Detractor", "config": {"type": "end", "endMessage": "Thank you for taking the time to share your feedback. We're committed to improving and will work on addressing your concerns. Have a great day!"}}, "type": "end", "position": {"x": 50, "y": 890}}]	[{"id": "e1", "source": "node-greeting", "target": "node-nps-score"}, {"id": "e2", "source": "node-nps-score", "target": "node-ask-reason"}, {"id": "e3", "source": "node-ask-reason", "target": "node-check-promoter"}, {"id": "e4", "source": "node-check-promoter", "target": "node-ask-testimonial", "sourceHandle": "true"}, {"id": "e5", "source": "node-check-promoter", "target": "node-ask-improvement", "sourceHandle": "false"}, {"id": "e6", "source": "node-ask-testimonial", "target": "node-promoter-webhook"}, {"id": "e7", "source": "node-promoter-webhook", "target": "node-promoter-end"}, {"id": "e8", "source": "node-ask-improvement", "target": "node-offer-callback"}, {"id": "e9", "source": "node-offer-callback", "target": "node-detractor-webhook"}, {"id": "e10", "source": "node-detractor-webhook", "target": "node-detractor-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-order-placement	system	Order Placement	Collect order details including product, quantity, and shipping information. Sends order data to your backend via webhook.	[{"id": "node-greeting", "data": {"type": "message", "label": "Welcome", "config": {"type": "message", "message": "Hello! Welcome to our ordering service. I'm here to help you place an order today. Let me collect a few details to process your order.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-ask-product", "data": {"type": "question", "label": "Product Name", "config": {"type": "question", "question": "What product would you like to order?", "variableName": "product_name", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-ask-quantity", "data": {"type": "question", "label": "Quantity", "config": {"type": "question", "question": "How many units would you like to order?", "variableName": "quantity", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 290}}, {"id": "node-ask-address", "data": {"type": "question", "label": "Delivery Address", "config": {"type": "question", "question": "What is your delivery address including city and zip code?", "variableName": "delivery_address", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 410}}, {"id": "node-ask-email", "data": {"type": "question", "label": "Email Address", "config": {"type": "question", "question": "What email address should we send the order confirmation to?", "variableName": "customer_email", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 530}}, {"id": "node-processing", "data": {"type": "message", "label": "Processing", "config": {"type": "message", "message": "Thank you! I'm now processing your order. Please hold for just a moment.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 650}}, {"id": "node-submit-order", "data": {"type": "webhook", "label": "Submit Order", "config": {"url": "https://your-order-api.com/orders", "type": "webhook", "method": "POST", "headers": {"X-API-Key": "your-api-key", "Content-Type": "application/json"}, "payload": {"source": "phone_order"}, "description": "Submit order to backend. Automatically includes caller_phone, product, quantity, address, email, and conversation data."}}, "type": "webhook", "position": {"x": 250, "y": 770}}, {"id": "node-confirmation", "data": {"type": "message", "label": "Confirmation", "config": {"type": "message", "message": "Great news! Your order has been successfully submitted. You will receive a confirmation email shortly with your order details and tracking information.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 890}}, {"id": "node-end", "data": {"type": "end", "label": "Goodbye", "config": {"type": "end", "endMessage": "Thank you for your order! Is there anything else I can help you with today? If not, have a wonderful day!"}}, "type": "end", "position": {"x": 250, "y": 1010}}]	[{"id": "e1", "source": "node-greeting", "target": "node-ask-product"}, {"id": "e2", "source": "node-ask-product", "target": "node-ask-quantity"}, {"id": "e3", "source": "node-ask-quantity", "target": "node-ask-address"}, {"id": "e4", "source": "node-ask-address", "target": "node-ask-email"}, {"id": "e5", "source": "node-ask-email", "target": "node-processing"}, {"id": "e6", "source": "node-processing", "target": "node-submit-order"}, {"id": "e7", "source": "node-submit-order", "target": "node-confirmation"}, {"id": "e8", "source": "node-confirmation", "target": "node-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-call-transfer	system	Call Transfer / Receptionist	Greet callers, identify their needs, and route to the appropriate department or person. Includes fallback to voicemail.	[{"id": "node-greeting", "data": {"type": "message", "label": "Reception Greeting", "config": {"type": "message", "message": "Good day! Thank you for calling. How may I direct your call today?", "waitForResponse": true}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-ask-department", "data": {"type": "question", "label": "Department", "config": {"type": "question", "question": "Which department would you like to reach? We have Sales, Support, Billing, or you can ask for a specific person.", "variableName": "requested_department", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-check-sales", "data": {"type": "condition", "label": "Is Sales?", "config": {"type": "condition", "condition": "The caller wants to reach Sales or is asking about purchasing, pricing, or products"}}, "type": "condition", "position": {"x": 250, "y": 290}}, {"id": "node-transfer-sales", "data": {"type": "transfer", "label": "Transfer to Sales", "config": {"type": "transfer", "message": "I'll transfer you to our Sales team right away. Please hold.", "transferNumber": "+1234567890"}}, "type": "transfer", "position": {"x": 50, "y": 410}}, {"id": "node-check-support", "data": {"type": "condition", "label": "Is Support?", "config": {"type": "condition", "condition": "The caller wants to reach Support or is asking for help with a technical issue"}}, "type": "condition", "position": {"x": 450, "y": 410}}, {"id": "node-transfer-support", "data": {"type": "transfer", "label": "Transfer to Support", "config": {"type": "transfer", "message": "I'll connect you with our Support team. One moment please.", "transferNumber": "+1234567891"}}, "type": "transfer", "position": {"x": 300, "y": 530}}, {"id": "node-check-billing", "data": {"type": "condition", "label": "Is Billing?", "config": {"type": "condition", "condition": "The caller wants to reach Billing or is asking about invoices, payments, or accounts"}}, "type": "condition", "position": {"x": 600, "y": 530}}, {"id": "node-transfer-billing", "data": {"type": "transfer", "label": "Transfer to Billing", "config": {"type": "transfer", "message": "I'll transfer you to our Billing department. Please hold.", "transferNumber": "+1234567892"}}, "type": "transfer", "position": {"x": 500, "y": 650}}, {"id": "node-take-message", "data": {"type": "question", "label": "Take Message", "config": {"type": "question", "question": "I couldn't identify the right department for your request. Can I take a message and have someone call you back?", "variableName": "callback_message", "waitForResponse": true}}, "type": "question", "position": {"x": 700, "y": 650}}, {"id": "node-log-message", "data": {"type": "webhook", "label": "Log Message", "config": {"url": "https://your-api.com/messages", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"type": "callback_request"}, "description": "Log callback message request"}}, "type": "webhook", "position": {"x": 700, "y": 770}}, {"id": "node-end-transfer", "data": {"type": "end", "label": "Transfer Complete", "config": {"type": "end", "endMessage": "Thank you for calling. Your call is being transferred now."}}, "type": "end", "position": {"x": 175, "y": 530}}, {"id": "node-end-message", "data": {"type": "end", "label": "Message Taken", "config": {"type": "end", "endMessage": "Thank you! We've recorded your message and someone will get back to you within 24 hours. Have a great day!"}}, "type": "end", "position": {"x": 700, "y": 890}}]	[{"id": "e1", "source": "node-greeting", "target": "node-ask-department"}, {"id": "e2", "source": "node-ask-department", "target": "node-check-sales"}, {"id": "e3", "source": "node-check-sales", "target": "node-transfer-sales", "sourceHandle": "true"}, {"id": "e4", "source": "node-check-sales", "target": "node-check-support", "sourceHandle": "false"}, {"id": "e5", "source": "node-transfer-sales", "target": "node-end-transfer"}, {"id": "e6", "source": "node-check-support", "target": "node-transfer-support", "sourceHandle": "true"}, {"id": "e7", "source": "node-check-support", "target": "node-check-billing", "sourceHandle": "false"}, {"id": "e8", "source": "node-transfer-support", "target": "node-end-transfer"}, {"id": "e9", "source": "node-check-billing", "target": "node-transfer-billing", "sourceHandle": "true"}, {"id": "e10", "source": "node-check-billing", "target": "node-take-message", "sourceHandle": "false"}, {"id": "e11", "source": "node-transfer-billing", "target": "node-end-transfer"}, {"id": "e12", "source": "node-take-message", "target": "node-log-message"}, {"id": "e13", "source": "node-log-message", "target": "node-end-message"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-event-registration	system	Event Registration	Register attendees for events, collect dietary preferences and accessibility needs, and send confirmation.	[{"id": "node-greeting", "data": {"type": "message", "label": "Event Welcome", "config": {"type": "message", "message": "Hi! Thank you for your interest in our upcoming event. I'd be happy to help you register. This will only take a couple of minutes.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-ask-name", "data": {"type": "question", "label": "Full Name", "config": {"type": "question", "question": "May I have your full name for the registration?", "variableName": "attendee_name", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-ask-email", "data": {"type": "question", "label": "Email", "config": {"type": "question", "question": "What email address should we send your confirmation and event details to?", "variableName": "attendee_email", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 290}}, {"id": "node-ask-company", "data": {"type": "question", "label": "Company", "config": {"type": "question", "question": "Which company or organization are you representing?", "variableName": "company_name", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 410}}, {"id": "node-ask-dietary", "data": {"type": "question", "label": "Dietary Preferences", "config": {"type": "question", "question": "Do you have any dietary restrictions or preferences we should know about? For example, vegetarian, vegan, gluten-free, or any allergies?", "variableName": "dietary_restrictions", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 530}}, {"id": "node-ask-accessibility", "data": {"type": "question", "label": "Accessibility Needs", "config": {"type": "question", "question": "Do you require any accessibility accommodations?", "variableName": "accessibility_needs", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 650}}, {"id": "node-register-webhook", "data": {"type": "webhook", "label": "Register Attendee", "config": {"url": "https://your-events-api.com/registrations", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"source": "phone", "event_id": "your-event-id"}, "description": "Register attendee in event system"}}, "type": "webhook", "position": {"x": 250, "y": 770}}, {"id": "node-confirmation", "data": {"type": "message", "label": "Confirmation", "config": {"type": "message", "message": "Wonderful! You're all registered. You'll receive a confirmation email shortly with all the event details including venue information, agenda, and parking instructions.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 890}}, {"id": "node-end", "data": {"type": "end", "label": "Goodbye", "config": {"type": "end", "endMessage": "Thank you for registering! We look forward to seeing you at the event. Have a great day!"}}, "type": "end", "position": {"x": 250, "y": 1010}}]	[{"id": "e1", "source": "node-greeting", "target": "node-ask-name"}, {"id": "e2", "source": "node-ask-name", "target": "node-ask-email"}, {"id": "e3", "source": "node-ask-email", "target": "node-ask-company"}, {"id": "e4", "source": "node-ask-company", "target": "node-ask-dietary"}, {"id": "e5", "source": "node-ask-dietary", "target": "node-ask-accessibility"}, {"id": "e6", "source": "node-ask-accessibility", "target": "node-register-webhook"}, {"id": "e7", "source": "node-register-webhook", "target": "node-confirmation"}, {"id": "e8", "source": "node-confirmation", "target": "node-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-payment-reminder	system	Payment Reminder	Remind customers about overdue payments, offer payment options, and route to billing support if needed.	[{"id": "node-greeting", "data": {"type": "message", "label": "Introduction", "config": {"type": "message", "message": "Hello! This is a courtesy call from the billing department regarding your account. We noticed there's an outstanding balance. Is this a good time to discuss your payment options?", "waitForResponse": true}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-verify-identity", "data": {"type": "question", "label": "Verify Identity", "config": {"type": "question", "question": "For security purposes, may I please verify the last 4 digits of your phone number on file?", "variableName": "phone_verification", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 170}}, {"id": "node-explain-balance", "data": {"type": "message", "label": "Balance Info", "config": {"type": "message", "message": "Thank you for confirming. According to our records, your current balance is due. Would you like to make a payment today or discuss payment options?", "waitForResponse": true}}, "type": "message", "position": {"x": 250, "y": 290}}, {"id": "node-ask-payment", "data": {"type": "question", "label": "Payment Decision", "config": {"type": "question", "question": "Would you like to pay the full balance today, set up a payment plan, or speak with a billing specialist?", "variableName": "payment_choice", "waitForResponse": true}}, "type": "question", "position": {"x": 250, "y": 410}}, {"id": "node-check-fullpay", "data": {"type": "condition", "label": "Full Payment?", "config": {"type": "condition", "condition": "The customer wants to pay the full balance today"}}, "type": "condition", "position": {"x": 250, "y": 530}}, {"id": "node-collect-payment", "data": {"type": "message", "label": "Payment Link", "config": {"type": "message", "message": "Perfect! I'll send you a secure payment link via text message right now. You can complete the payment at your convenience within the next 24 hours.", "waitForResponse": false}}, "type": "message", "position": {"x": 50, "y": 650}}, {"id": "node-send-link-webhook", "data": {"type": "webhook", "label": "Send Payment Link", "config": {"url": "https://your-billing-api.com/send-payment-link", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"action": "send_payment_link"}, "description": "Send secure payment link to customer"}}, "type": "webhook", "position": {"x": 50, "y": 770}}, {"id": "node-check-plan", "data": {"type": "condition", "label": "Payment Plan?", "config": {"type": "condition", "condition": "The customer wants to set up a payment plan"}}, "type": "condition", "position": {"x": 450, "y": 650}}, {"id": "node-plan-details", "data": {"type": "question", "label": "Plan Preference", "config": {"type": "question", "question": "We can split the balance into 2, 3, or 4 monthly payments. Which option works best for you?", "variableName": "payment_plan_months", "waitForResponse": true}}, "type": "question", "position": {"x": 300, "y": 770}}, {"id": "node-plan-webhook", "data": {"type": "webhook", "label": "Create Plan", "config": {"url": "https://your-billing-api.com/payment-plans", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"action": "create_payment_plan"}, "description": "Create payment plan in billing system"}}, "type": "webhook", "position": {"x": 300, "y": 890}}, {"id": "node-transfer-billing", "data": {"type": "transfer", "label": "Transfer to Billing", "config": {"type": "transfer", "message": "I'll connect you with a billing specialist who can help with your specific situation. Please hold.", "transferNumber": "+1234567890"}}, "type": "transfer", "position": {"x": 550, "y": 770}}, {"id": "node-end-payment", "data": {"type": "end", "label": "Payment Link Sent", "config": {"type": "end", "endMessage": "The payment link has been sent to your phone. Thank you for taking care of this. Have a great day!"}}, "type": "end", "position": {"x": 50, "y": 890}}, {"id": "node-end-plan", "data": {"type": "end", "label": "Plan Created", "config": {"type": "end", "endMessage": "Your payment plan has been set up. You'll receive confirmation details via email. Thank you for working with us!"}}, "type": "end", "position": {"x": 300, "y": 1010}}, {"id": "node-end-transfer", "data": {"type": "end", "label": "Transfer Complete", "config": {"type": "end", "endMessage": "Transferring you now. Thank you for your patience."}}, "type": "end", "position": {"x": 550, "y": 890}}]	[{"id": "e1", "source": "node-greeting", "target": "node-verify-identity"}, {"id": "e2", "source": "node-verify-identity", "target": "node-explain-balance"}, {"id": "e3", "source": "node-explain-balance", "target": "node-ask-payment"}, {"id": "e4", "source": "node-ask-payment", "target": "node-check-fullpay"}, {"id": "e5", "source": "node-check-fullpay", "target": "node-collect-payment", "sourceHandle": "true"}, {"id": "e6", "source": "node-check-fullpay", "target": "node-check-plan", "sourceHandle": "false"}, {"id": "e7", "source": "node-collect-payment", "target": "node-send-link-webhook"}, {"id": "e8", "source": "node-send-link-webhook", "target": "node-end-payment"}, {"id": "e9", "source": "node-check-plan", "target": "node-plan-details", "sourceHandle": "true"}, {"id": "e10", "source": "node-check-plan", "target": "node-transfer-billing", "sourceHandle": "false"}, {"id": "e11", "source": "node-plan-details", "target": "node-plan-webhook"}, {"id": "e12", "source": "node-plan-webhook", "target": "node-end-plan"}, {"id": "e13", "source": "node-transfer-billing", "target": "node-end-transfer"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
template-data-collection	system	Data Collection Form	Collect structured data from callers using a form. Perfect for registrations, applications, or information gathering.	[{"id": "node-greeting", "data": {"type": "message", "label": "Welcome", "config": {"type": "message", "message": "Hello! Thank you for calling. I'll need to collect some information from you. This should only take a few minutes.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 50}}, {"id": "node-collect-form", "data": {"type": "form", "label": "Collect Information", "config": {"type": "form", "formId": null, "message": "I'll ask you a few questions now. Please answer each one clearly.", "waitForResponse": true}}, "type": "form", "position": {"x": 250, "y": 170}}, {"id": "node-review", "data": {"type": "message", "label": "Review Info", "config": {"type": "message", "message": "Thank you for providing that information. Let me review what we collected.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 290}}, {"id": "node-submit-webhook", "data": {"type": "webhook", "label": "Submit Data", "config": {"url": "https://your-api.com/submissions", "type": "webhook", "method": "POST", "headers": {"Content-Type": "application/json"}, "payload": {"source": "phone_form"}, "description": "Submit collected form data to backend"}}, "type": "webhook", "position": {"x": 250, "y": 410}}, {"id": "node-confirmation", "data": {"type": "message", "label": "Confirmation", "config": {"type": "message", "message": "All your information has been recorded successfully. You'll receive a confirmation email shortly.", "waitForResponse": false}}, "type": "message", "position": {"x": 250, "y": 530}}, {"id": "node-end", "data": {"type": "end", "label": "Goodbye", "config": {"type": "end", "endMessage": "Thank you for your time today. Is there anything else I can help you with? If not, have a wonderful day!"}}, "type": "end", "position": {"x": 250, "y": 650}}]	[{"id": "e1", "source": "node-greeting", "target": "node-collect-form"}, {"id": "e2", "source": "node-collect-form", "target": "node-review"}, {"id": "e3", "source": "node-review", "target": "node-submit-webhook"}, {"id": "e4", "source": "node-submit-webhook", "target": "node-confirmation"}, {"id": "e5", "source": "node-confirmation", "target": "node-end"}]	\N	\N	\N	t	t	\N	\N	\N	\N	2026-01-26 23:27:41.886529	2026-01-26 23:27:41.886529
\.


--
-- Data for Name: form_fields; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.form_fields (id, form_id, question, field_type, options, is_required, "order", created_at) FROM stdin;
\.


--
-- Data for Name: form_submissions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.form_submissions (id, form_id, call_id, flow_execution_id, contact_name, contact_phone, responses, submitted_at) FROM stdin;
\.


--
-- Data for Name: forms; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.forms (id, user_id, name, description, is_active, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: freepbx_calls; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.freepbx_calls (id, user_id, assignment_id, agent_id, campaign_id, contact_id, incoming_connection_id, sip_extension_id, sip_extension, freepbx_connection_id, direction, caller_id, caller_name, destination, destination_name, status, hangup_cause, hangup_cause_code, initiated_at, ringing_at, answered_at, ended_at, duration_seconds, billable_seconds, credits_used, credit_rate, recording_enabled, recording_url, recording_duration_seconds, recording_size_bytes, transcript, transcript_segments, ai_summary, ai_summary_ar, sentiment, sentiment_score, keywords, action_items, lead_data, freepbx_unique_id, freepbx_linked_id, asterisk_channel, mos_score, jitter_ms, packet_loss_percent, error_message, error_code, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: global_settings; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.global_settings (id, key, value, description, updated_by, updated_at) FROM stdin;
87c12142-959d-4d3a-9304-6cf762ca9ea7	twilio_kyc_required	false	Twilio KYC Required	\N	2026-01-26 23:27:28.286774
41ea93d5-f9f5-4b66-bd92-112d623ee1bd	twilio_openai_enabled	true	Twilio OpenAI Engine Enabled	\N	2026-01-26 23:27:28.286774
708c5367-6b62-4287-b285-4e97cc7c04a3	company_name	""	Company name displayed throughout the platform	\N	2026-01-26 23:27:41.891706
88e359dc-56bb-4cb7-8cef-79698a5ecfac	company_tagline	"AI-Powered Bulk Calling Platform"	Company tagline for branding	\N	2026-01-26 23:27:41.892196
75e1b584-68af-453a-a831-19de29906e5e	company_logo_url	""	URL to company logo image	\N	2026-01-26 23:27:41.892572
62a4c1c3-b522-4b91-9c49-85ee911c39f9	company_favicon_url	""	URL to favicon	\N	2026-01-26 23:27:41.893029
a5054816-1226-4e38-9055-418da240f9e2	support_email	""	Support email address (must be configured in Admin Panel)	\N	2026-01-26 23:27:41.893383
64263b1b-eaa0-4197-bbbb-51a49473c706	support_phone	""	Support phone number	\N	2026-01-26 23:27:41.893834
ef1e9b3b-f849-42b9-b669-eaceb4267b78	company_address	""	Company physical address	\N	2026-01-26 23:27:41.894232
f2aeb8a9-377d-420b-9919-60fd33f0e4ad	terms_url	"/terms"	Terms of Service URL	\N	2026-01-26 23:27:41.8946
2c03bda0-2509-4dc9-a2e1-4b0633685303	privacy_url	"/privacy"	Privacy Policy URL	\N	2026-01-26 23:27:41.894979
34200fa0-10c1-43c7-91f4-4c5d291ecc8d	feature_registration_enabled	true	Enable/disable new user registration	\N	2026-01-26 23:27:41.895318
308ea884-87a1-44cd-95fb-aec80fbbc5d6	feature_google_auth_enabled	false	Enable/disable Google OAuth login	\N	2026-01-26 23:27:41.895669
5a321449-d9c7-4884-918a-0af061719df5	feature_email_verification_required	false	Require email verification for new accounts	\N	2026-01-26 23:27:41.896026
947cb770-0d6a-4b77-afb2-912db9e830f1	feature_maintenance_mode	false	Enable maintenance mode (blocks user access)	\N	2026-01-26 23:27:41.896412
a0e3bfac-441c-4375-90db-84647ad8fc26	feature_demo_mode	false	Enable demo mode with sample data	\N	2026-01-26 23:27:41.896786
48c9523c-84d3-438f-8566-19d0cf051a25	low_credits_threshold	50	Credit balance below which to send low credits alert	\N	2026-01-26 23:27:41.897107
aa652184-5dac-4fad-8e31-9c6e8c2a0fde	credits_per_minute	1	Credits consumed per minute of call time	\N	2026-01-26 23:27:41.897411
18ee5a7c-6b3f-4f63-9773-76469b57acba	free_trial_credits	50	Credits given to new users on signup (DEPRECATED: now uses Free plan includedCredits)	\N	2026-01-26 23:27:41.89777
bf5500a8-cd54-432c-8c40-40cf52cd34f4	phone_number_monthly_credits	50	Credits charged monthly for renting a phone number	\N	2026-01-26 23:27:41.898143
39bc2f5a-7e41-4dff-b7ee-88aad618eaa2	currency_default	"USD"	Default currency for the platform	\N	2026-01-26 23:27:41.898515
fe72f731-81be-4bc8-bfa9-a67983ac04b5	currency_symbol	"$"	Default currency symbol	\N	2026-01-26 23:27:41.898919
71a05547-d864-4054-b661-c044dd7fe2de	max_call_duration_seconds	1800	Maximum call duration in seconds (30 minutes)	\N	2026-01-26 23:27:41.899283
7960e526-460c-42e5-bc02-f47532c87ed9	default_call_retry_attempts	2	Default number of retry attempts for failed calls	\N	2026-01-26 23:27:41.899691
a121a229-919b-460b-928f-6ce245e1d21c	call_recording_enabled	true	Enable call recording by default	\N	2026-01-26 23:27:41.900061
3eed9f31-0d96-4a5f-95ff-7655d3e5c18c	transcription_enabled	true	Enable call transcription by default	\N	2026-01-26 23:27:41.900407
447167ab-2b74-4887-8e8c-0e9750c47e58	campaign_batch_size	10	Number of calls to process per batch	\N	2026-01-26 23:27:41.900827
37d348c7-10ee-48d3-a15e-7a87efe1cbcb	campaign_rate_limit_per_minute	60	Maximum calls per minute per campaign	\N	2026-01-26 23:27:41.901203
f1d441da-6fa5-4a49-b0ee-d2c085f71c48	campaign_time_window_start	"09:00"	Default campaign calling window start time	\N	2026-01-26 23:27:41.901573
31920bad-ec50-430a-bd81-e11156226594	campaign_time_window_end	"18:00"	Default campaign calling window end time	\N	2026-01-26 23:27:41.901955
5fc75666-3b72-4edb-b1b2-d14f260c4896	campaign_timezone_default	"America/New_York"	Default timezone for campaign scheduling	\N	2026-01-26 23:27:41.902328
0fb46aa6-ede1-4f6e-a3dd-2d197e89ce30	webhook_retry_max_attempts	5	Maximum webhook retry attempts	\N	2026-01-26 23:27:41.902703
705d6b59-b4db-47c5-a3d5-634b868cf17f	webhook_retry_intervals_minutes	[1, 5, 15, 30, 60]	Retry intervals in minutes for each attempt (array of 5 values)	\N	2026-01-26 23:27:41.903059
c00c0181-0e6f-4eb0-9b2d-3bcbc2f1247c	webhook_expiry_hours	24	Hours before a failed webhook expires and stops retrying	\N	2026-01-26 23:27:41.903426
4fcf5ce2-2c92-499a-91a1-aaf219b7212b	webhook_timeout_seconds	30	Webhook request timeout in seconds	\N	2026-01-26 23:27:41.90381
a0146982-664c-410a-9dd5-27b26a23f37b	otp_expiry_minutes	5	OTP verification code expiry time in minutes	\N	2026-01-26 23:27:41.904191
321003e4-35d6-4674-bfde-e00eddc409d6	jwt_expiry_days	7	JWT token expiry time in days	\N	2026-01-26 23:27:41.904561
ef4e2ffa-935b-4d15-823d-6a2b39faf269	session_timeout_minutes	1440	Session timeout in minutes (24 hours)	\N	2026-01-26 23:27:41.905011
28f1da91-67c4-4984-85d3-50725b1235f3	password_min_length	8	Minimum password length	\N	2026-01-26 23:27:41.905385
44d0dd94-6272-4c6d-a823-06b619c9c38b	max_login_attempts	5	Maximum login attempts before lockout	\N	2026-01-26 23:27:41.90572
06c83c75-d8bc-4677-9e54-061b138ac55b	lockout_duration_minutes	30	Account lockout duration in minutes	\N	2026-01-26 23:27:41.906082
086d3bd2-0bdb-47ff-8dba-390757894162	api_rate_limit_requests	1000	API rate limit - requests per hour	\N	2026-01-26 23:27:41.906438
a232a5c8-4146-4dec-87c0-2bae53047e71	notification_low_credits_enabled	true	Send email when credits are low	\N	2026-01-26 23:27:41.906806
81430f9f-a9ba-4787-b656-99086a837997	notification_campaign_completed_enabled	true	Send email when campaign completes	\N	2026-01-26 23:27:41.907204
c754d573-a3c8-4e08-b5ea-aaf1cf23a34b	notification_payment_received_enabled	true	Send email on successful payment	\N	2026-01-26 23:27:41.907566
84c6330f-4430-4a5a-a2ca-0f661393537e	notification_payment_failed_enabled	true	Send email on failed payment	\N	2026-01-26 23:27:41.907943
25a6d338-6714-41c8-8052-a0a977603d8d	system_timezone	"UTC"	System default timezone	\N	2026-01-26 23:27:41.908301
7acc561a-76f0-4c40-87c7-ce4e8bfd27e5	system_date_format	"YYYY-MM-DD"	System date format	\N	2026-01-26 23:27:41.908702
e1eeac53-e860-4be6-a225-298edc26fdfe	system_time_format	"HH:mm:ss"	System time format	\N	2026-01-26 23:27:41.909069
5c9652af-6560-421b-bc36-f2dd0b24dbde	pagination_default_limit	25	Default pagination limit	\N	2026-01-26 23:27:41.909426
06bbc070-25c4-409d-bf47-efe3f9de0db9	pagination_max_limit	100	Maximum pagination limit	\N	2026-01-26 23:27:41.909799
ae309599-172e-4ba3-8b2f-a3fc503e66ba	max_ws_connections_per_process	1000	Maximum WebSocket connections per server process	\N	2026-01-26 23:27:41.910167
f7b130d9-9e47-4053-a775-856f8e5c2a59	max_ws_connections_per_user	5	Maximum concurrent call connections per user	\N	2026-01-26 23:27:41.910524
c068b347-3f29-48bc-bd19-4314294fbeb2	max_ws_connections_per_ip	10	Maximum WebSocket connections per IP address	\N	2026-01-26 23:27:41.910987
917a98ca-499b-461d-b1c1-5a7e1be07198	max_openai_connections_per_credential	50	Maximum concurrent OpenAI connections per API key	\N	2026-01-26 23:27:41.911348
89b6e188-f923-47e2-9c90-392a4076499b	openai_connection_timeout_ms	3600000	OpenAI connection timeout in milliseconds	\N	2026-01-26 23:27:41.911697
142a3ca9-814e-46b2-aa56-c5cff9a597e9	openai_idle_timeout_ms	300000	OpenAI connection idle timeout in milliseconds	\N	2026-01-26 23:27:41.912065
1bd1a840-e63d-45c1-9397-a9345a9fc325	db_pool_min_connections	2	Minimum database connections in pool	\N	2026-01-26 23:27:41.912424
e0433fe8-7fe7-40b4-b8da-ad76103dc593	db_pool_max_connections	20	Maximum database connections in pool	\N	2026-01-26 23:27:41.912803
7b74514f-9718-48e3-b509-68d3af3eedb6	db_pool_idle_timeout_ms	30000	Database connection idle timeout in milliseconds	\N	2026-01-26 23:27:41.913159
2e0be3e7-dbbf-4b46-a7ef-12c229ddb3bf	campaign_batch_concurrency	10	Number of concurrent calls per campaign batch	\N	2026-01-26 23:27:41.913526
5e244dd7-6cd2-4dcf-91ce-0c8d5e054fdb	seo_site_title	"AI-Powered Calling Platform"	Default site title for SEO	\N	2026-01-26 23:27:41.916185
c8a0f7e5-f7d2-4b14-9b11-e24925688597	seo_site_description	"Automate your outbound communication with AI-powered voice agents. Scale your calling campaigns with intelligent automation, lead qualification, and real-time analytics."	Default meta description for SEO	\N	2026-01-26 23:27:41.916552
4724fa9d-a53d-4fe0-a434-5667d7f03711	seo_site_keywords	"AI calling, bulk calling, voice AI, automated calls, lead qualification, outbound automation, AI agents, conversational AI, sales automation, customer service automation"	Default meta keywords for SEO	\N	2026-01-26 23:27:41.916919
c4120946-4e0f-4923-8cb4-0439f226e708	seo_site_author	""	Site author for meta tags	\N	2026-01-26 23:27:41.917257
bcdc7b8a-a025-4460-b04d-742bdc7dd3bd	seo_og_title	"Scale Your Outreach with AI Voice Agents"	Open Graph title for social sharing	\N	2026-01-26 23:27:41.917596
e6413c38-62f3-4f5b-8bdc-d0a3d2f5eeae	seo_og_description	"Launch AI-powered calling campaigns that qualify leads, book appointments, and engage customers automatically. Start your free trial today."	Open Graph description for social sharing	\N	2026-01-26 23:27:41.917972
c2a4a08f-cdb4-417c-bb81-d13387e60c5a	seo_og_image	""	Open Graph image URL (1200x630 recommended)	\N	2026-01-26 23:27:41.918244
afdc41fe-25cc-4319-bf0c-a7986b4e05a3	seo_og_type	"website"	Open Graph type (website, article, product)	\N	2026-01-26 23:27:41.918573
3fc80b27-3114-4bc2-8e01-772aed2f844a	seo_og_site_name	""	Open Graph site name	\N	2026-01-26 23:27:41.918954
87c3c13f-930f-44de-b86d-243143d595ca	seo_twitter_card	"summary_large_image"	Twitter card type (summary, summary_large_image)	\N	2026-01-26 23:27:41.919276
b5b9d2d6-ae57-4bf5-8158-81d08023af84	seo_twitter_site	""	Twitter @username for the website	\N	2026-01-26 23:27:41.919652
a2c2f3da-f82e-4ac4-9c96-c1bcdd74f7bc	seo_twitter_creator	""	Twitter @username for content creator	\N	2026-01-26 23:27:41.920044
4cf8517b-da44-4363-9e91-295f3d64fcdf	seo_twitter_title	"AI-Powered Calling Platform"	Twitter card title	\N	2026-01-26 23:27:41.920397
bd37755c-aafd-422a-8ef0-d88e0e0bf7b3	seo_twitter_description	"Automate your calling campaigns with AI voice agents. Qualify leads, book appointments, and engage customers 24/7."	Twitter card description	\N	2026-01-26 23:27:41.920773
365f6781-81ab-47d7-b273-98e1e640cf5f	seo_twitter_image	""	Twitter card image URL	\N	2026-01-26 23:27:41.921138
4ba4b32c-2baf-4682-84e7-da9325ecc558	seo_robots_index	true	Allow search engines to index the site	\N	2026-01-26 23:27:41.921497
e51eb4da-e52e-4fa2-9122-621c59105fef	seo_robots_follow	true	Allow search engines to follow links	\N	2026-01-26 23:27:41.921894
758b0fa7-e4fb-4a2d-b5d7-700322713834	seo_robots_txt	"User-agent: *\\nAllow: /\\nDisallow: /app/\\nDisallow: /admin/\\nDisallow: /api/\\n\\nSitemap: {{site_url}}/sitemap.xml"	Custom robots.txt content	\N	2026-01-26 23:27:41.922234
a0856fa4-1455-47f1-9a21-a2fb25c442e1	seo_sitemap_enabled	true	Enable automatic sitemap generation	\N	2026-01-26 23:27:41.922564
8449bc5a-dc66-4b61-b05c-4dadffc31f02	seo_sitemap_change_frequency	"weekly"	Sitemap change frequency (daily, weekly, monthly)	\N	2026-01-26 23:27:41.922943
8eb95a07-55dc-4208-a11b-375fe300d7e5	seo_sitemap_priority	"0.8"	Default sitemap priority (0.0 to 1.0)	\N	2026-01-26 23:27:41.923279
201ff4d1-2e38-4a3c-9f24-29f2c80f0073	seo_schema_organization	{"url": "{{site_url}}", "logo": "{{logo_url}}", "name": "{{app_name}}", "@type": "Organization", "sameAs": [], "@context": "https://schema.org", "description": "AI-Powered Calling Platform", "contactPoint": {"@type": "ContactPoint", "email": "{{support_email}}", "contactType": "customer service"}}	Organization schema.org structured data	\N	2026-01-26 23:27:41.923579
0d83e9f2-dad1-4ea2-ab7a-c79a25414946	seo_schema_software	{"name": "{{app_name}}", "@type": "SoftwareApplication", "offers": {"@type": "Offer", "price": "0", "priceCurrency": "USD"}, "@context": "https://schema.org", "aggregateRating": {"@type": "AggregateRating", "ratingCount": "150", "ratingValue": "4.8"}, "operatingSystem": "Web", "applicationCategory": "BusinessApplication"}	SoftwareApplication schema.org structured data	\N	2026-01-26 23:27:41.923974
403322ca-d79d-4e43-a4d4-fe4b98f0dc14	seo_google_analytics_id	""	Google Analytics tracking ID (GA4)	\N	2026-01-26 23:27:41.924309
e888ecf9-1140-45b4-9908-5f3cfed8761c	seo_google_tag_manager_id	""	Google Tag Manager container ID	\N	2026-01-26 23:27:41.924723
247d9c02-ad46-498d-9c68-83dbf45ded54	seo_google_search_console_verification	""	Google Search Console verification meta tag	\N	2026-01-26 23:27:41.925204
01922963-b9db-4414-aec2-7e4020803da6	seo_bing_webmaster_verification	""	Bing Webmaster verification meta tag	\N	2026-01-26 23:27:41.925545
f5238080-7f47-438a-9985-c195aa17c2b9	seo_facebook_pixel_id	""	Facebook Pixel ID for conversion tracking	\N	2026-01-26 23:27:41.925987
1fc916a0-55cb-4141-9b09-7d64e501e9ee	seo_canonical_url	""	Canonical URL base (e.g., https://agentlabs.io)	\N	2026-01-26 23:27:41.926373
66da0f85-5312-496a-b529-fb0524b2ec8f	seo_default_language	"en"	Default content language	\N	2026-01-26 23:27:41.92677
47191206-ba19-4413-92aa-f8a4090daaa8	seo_hreflang_enabled	false	Enable hreflang tags for multilingual SEO	\N	2026-01-26 23:27:41.927112
c1d79a79-7fa4-4a85-aa64-309f7799e5e2	seo_available_languages	["en"]	Available languages for hreflang	\N	2026-01-26 23:27:41.927449
c685a0b3-b531-4c0f-b931-07be8724b427	seo_home_title	"AI-Powered Calling Platform | Automate Your Outreach"	Homepage specific title	\N	2026-01-26 23:27:41.927833
70473203-01f6-4881-a232-d6e476e7b278	seed_applied_at	"2026-02-21T07:47:10.074Z"	Timestamp when seed data was last applied	\N	2026-02-21 07:47:10.074247
b2ce2c00-58d5-4da9-a45a-5672cead6dea	seo_home_description	"Transform your outbound communication with AI voice agents. Automate calls, qualify leads, and scale your sales operations effortlessly."	Homepage specific description	\N	2026-01-26 23:27:41.928234
7fa3c024-c80e-47b2-aa8e-2dc012b9b5fe	seo_pricing_title	"Pricing | Flexible Plans for Every Business"	Pricing page specific title	\N	2026-01-26 23:27:41.928598
856edcd7-f7d5-4ea7-9594-59175fb31562	seo_pricing_description	"Choose the perfect plan for your calling needs. Start free with 50 credits or upgrade to Pro for advanced features and higher limits."	Pricing page specific description	\N	2026-01-26 23:27:41.928997
eab16c29-776e-4033-84a1-53cd22f96127	seo_login_title	"Sign In"	Login page specific title	\N	2026-01-26 23:27:41.929337
94860eaf-4f6a-48e3-afdf-69aace130e17	seo_register_title	"Create Account | Start Your Free Trial"	Registration page specific title	\N	2026-01-26 23:27:41.929708
53656180-ab33-4dbe-97c5-c7bc6d0ea290	demo_widget_enabled	true	Demo Widget Enabled	\N	2026-01-26 23:40:35.24938
9bf833c9-8166-48e1-a13a-16836d6892ce	demo_mode_enabled	true	Demo Mode Enabled	\N	2026-01-26 23:40:35.24938
ef995c4a-83ec-4263-9624-34636f1d79ff	demo_max_duration	60	Demo Max Duration	\N	2026-01-26 23:40:35.24938
59831754-a858-4526-92be-9b4619b41f1a	demo_max_concurrent	10	Demo Max Concurrent	\N	2026-01-26 23:40:35.24938
b16197d0-f1aa-4bbb-8486-d125f2656564	demo_cooldown_minutes	5	Demo Cooldown Minutes	\N	2026-01-26 23:40:35.24938
e337f28e-d091-4c4f-9e3e-b25c4cef96a2	demo_system_prompt	"You are a helpful AI assistant. Be friendly and keep responses concise."	Demo System Prompt	\N	2026-01-26 23:40:35.24938
5ba216d8-4cd4-4405-a2c9-dcf89b18c8f3	plugin_sip-engine_enabled	{"enabled": true}	Enable SIP Engine plugin	\N	2026-02-12 09:19:25.524162
9a88784f-aad4-4a65-bc26-1e3295112cfe	openai_sip_project_id	"proj_G3K9RKzccnGl1vi12QsuWUtZ"	OpenAI Project ID for SIP integration	\N	2026-02-13 07:43:03.849492
bbd0c72f-ab2a-423d-a900-6c21383bbc7d	openai_sip_webhook_secret	"whsec_K5kkP+YBfirF1HkylDC8gXQGOCLdzCFm7/oKNMbK59Q="	OpenAI SIP webhook secret for verification	\N	2026-02-13 07:43:13.036618
d62b8218-62db-4cdd-91fb-b0698f05b501	default_tts_model	"eleven_flash_v2_5"	\N	\N	2026-01-27 01:20:32.131265
aad442f7-fb21-47e2-9e82-c29379d19bb5	twilio_openai_engine_enabled	true	\N	\N	2026-01-27 01:20:51.492129
61d08abe-a5fa-438a-bdaa-55d1e4ae5b59	plivo_openai_engine_enabled	true	\N	\N	2026-01-27 01:20:52.691146
e7f5f327-d8c2-4e23-bf8b-799ad28c5ae7	twilio_account_sid	"AC8ccd811dd1cae1c44e66b8cd625b0a5c"	Twilio Account SID	\N	2026-01-27 01:22:04.613109
39895f50-9053-4a42-8ad7-fac6299752f4	openai_api_key	"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"	\N	\N	2026-01-27 01:22:04.618459
5c845efa-3b26-493c-bbd4-79687b82af53	twilio_auth_token	"116c41b46431e64a016b8e0513364353"	Twilio Auth Token	\N	2026-01-27 01:22:04.620604
82129ea0-b651-4c8a-b12e-ac02955bd6eb	team_management_enabled	true	Team Management Enabled	\N	2026-01-27 01:46:40.749565
76dbc7e3-fa84-4c97-a4c7-483bafe82869	max_team_members	50	Max Team Members	\N	2026-01-27 01:46:40.749565
0ca79fda-8dab-427d-b781-cb04821d79af	app_name	"Hala Voice"	\N	\N	2026-01-27 16:28:06.866854
bf5a5e1b-e171-4742-b58c-6594df0f7b02	app_tagline	""	\N	\N	2026-01-27 16:28:06.868688
c363faea-f7f6-4a39-a325-b2e91b53656d	admin_email	"welcome@halavoice.store"	\N	\N	2026-01-27 16:28:06.869283
ef7554ed-ef49-4eac-a888-433adec80aa9	social_twitter_url	""	\N	\N	2026-01-27 16:28:06.869755
f411b568-c913-446f-b534-34550d6fc72f	social_linkedin_url	""	\N	\N	2026-01-27 16:28:06.870127
0781e095-c013-4cc4-93bd-d2ecef97a065	social_github_url	""	\N	\N	2026-01-27 16:28:06.870632
0772e75c-1f71-4673-872d-90060a8b5a4d	branding_updated_at	"2026-01-27T16:28:06.871Z"	\N	\N	2026-01-27 16:28:06.871097
aaeb5c36-fa8c-4bdc-819d-16297948eb5b	plugin_rest-api_enabled	{"enabled": true}	Whether the rest-api plugin is enabled	\N	2026-02-13 07:39:35.067172
89345405-b773-46c3-9742-0a2a559a1838	plugin_free-pbx_enabled	true	Enable FreePBX SIP plugin	\N	2026-02-10 10:38:08.761766
55c3f071-e0db-48cb-9969-212a14c8e0d4	plugin_team-management_enabled	{"enabled": true}	Whether the team-management plugin is enabled	\N	2026-02-13 07:40:06.311552
a31045f7-6467-4f9f-a47f-2ab2e87f1af9	seed_version	"1.0.0"	Version of seed data applied (used for tracking updates)	\N	2026-02-21 07:47:10.073566
\.


--
-- Data for Name: incoming_connections; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.incoming_connections (id, user_id, agent_id, phone_number_id, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: invoices; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.invoices (id, transaction_id, user_id, invoice_number, customer_name, customer_email, customer_address, description, line_items, subtotal, tax, total, currency, gateway, payment_method, pdf_url, pdf_generated_at, status, email_sent_at, email_sent_to, issued_at, due_at, paid_at, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: knowledge_base; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.knowledge_base (id, user_id, type, title, content, url, file_url, eleven_labs_doc_id, metadata, storage_size, created_at) FROM stdin;
\.


--
-- Data for Name: knowledge_chunks; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.knowledge_chunks (id, knowledge_base_id, user_id, chunk_index, chunk_text, embedding, token_count, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: knowledge_processing_queue; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.knowledge_processing_queue (id, knowledge_base_id, user_id, status, error_message, total_chunks, processed_chunks, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: lead_activities; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.lead_activities (id, lead_id, user_id, activity_type, title, description, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: lead_notes; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.lead_notes (id, lead_id, user_id, content, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: lead_stages; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.lead_stages (id, user_id, name, color, "order", is_default, is_custom, created_at, updated_at) FROM stdin;
8a857449-daef-4bae-aec7-de0348e982bd	bec9ca09-fb9c-417b-ba28-108c859422b2	New Lead	#9CA3AF	0	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
d8e5a2e6-5c05-4555-9b3a-15298ef3134c	bec9ca09-fb9c-417b-ba28-108c859422b2	Hot Lead	#EF4444	1	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
7fc149ce-5ecf-47b7-8374-6a721794f415	bec9ca09-fb9c-417b-ba28-108c859422b2	Appointment Booked	#22C55E	2	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
233aa16d-2f07-4fd2-bda9-c2d1f45a9ddc	bec9ca09-fb9c-417b-ba28-108c859422b2	Form Submitted	#3B82F6	3	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
db8a7cec-1f8f-4ba9-8cb5-117cef532da7	bec9ca09-fb9c-417b-ba28-108c859422b2	Needs Follow-up	#F59E0B	4	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
f0564407-3f84-457c-925e-7777a1768735	bec9ca09-fb9c-417b-ba28-108c859422b2	Not Interested	#6B7280	5	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
aa45d923-cdbd-42cd-9df3-1e602ed319ca	bec9ca09-fb9c-417b-ba28-108c859422b2	No Answer	#D1D5DB	6	t	f	2026-01-27 01:52:13.422693	2026-01-27 01:52:13.422693
\.


--
-- Data for Name: leads; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.leads (id, user_id, source_type, campaign_id, incoming_connection_id, first_name, last_name, phone, email, company, custom_fields, stage_id, stage, lead_score, ai_summary, ai_next_action, sentiment, ai_category, has_appointment, has_form_submission, has_transfer, has_callback, appointment_date, appointment_details, form_data, transferred_to, transferred_at, callback_scheduled, callback_completed, call_id, plivo_call_id, twilio_openai_call_id, total_calls, last_call_at, tags, assigned_user_id, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: llm_models; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.llm_models (id, model_id, name, provider, tier, is_active, sort_order, created_at, updated_at) FROM stdin;
901233a3-693c-4612-8455-4144d6d2b8ab	gpt-4o-mini	GPT-4o Mini (OpenAI)	openai	free	t	1	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
902f8e09-262d-4a2c-aa79-976f26e50f56	gpt-3.5-turbo	GPT-3.5 Turbo (OpenAI)	openai	free	t	2	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
aa7c269d-ec8c-458f-9651-edcf9d98a838	claude-3-haiku	Claude 3 Haiku (Anthropic)	anthropic	free	t	3	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
4cbc96e7-70ac-4cd2-8e92-d4b164097049	gemini-2.5-flash-lite	Gemini 2.5 Flash Lite (Google)	google	free	t	4	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
1301227a-6815-4b44-bc09-f8147696a528	gemini-2.0-flash-lite	Gemini 2.0 Flash Lite (Google)	google	free	t	5	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
63a5f33c-e57e-4c97-9bbb-b8f38b5b9ea0	glm-45-air-fp8	GLM-4.5-Air (ElevenLabs)	elevenlabs	free	t	6	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
a16ac15a-d932-4bf6-920b-cd592370d055	qwen3-30b-a3b	Qwen3-30B-A3B (ElevenLabs)	elevenlabs	free	t	7	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
fa014d1f-0c53-4748-b232-f21e6d606c61	gpt-4o	GPT-4o (OpenAI)	openai	pro	t	10	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
1a323184-7221-4d09-af00-dc3041f7b68c	gpt-4-turbo	GPT-4 Turbo (OpenAI)	openai	pro	t	11	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
a7936d05-66fe-4a2a-b872-c346bab49d77	claude-3-5-sonnet	Claude 3.5 Sonnet (Anthropic)	anthropic	pro	t	12	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
e411d56f-836f-42ea-b674-5ffbe916e716	gemini-2.5-flash	Gemini 2.5 Flash (Google)	google	pro	t	13	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
b2aff466-170e-4665-8e24-3ab6066b23aa	gemini-2.0-flash	Gemini 2.0 Flash (Google)	google	pro	t	14	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
c875184d-cef6-4425-854e-7a6c8f5e64ca	gpt-oss-120b	GPT-OSS-120B (ElevenLabs)	elevenlabs	pro	t	15	2026-01-26 23:27:41.873715	2026-01-26 23:27:41.873715
\.


--
-- Data for Name: n8n_settings; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.n8n_settings (id, setting_key, setting_value, description_en, description_ar, is_encrypted, created_at, updated_at) FROM stdin;
abdc3323-6cf4-4c50-9e0a-c14fa858b64c	n8n_mcp_server	{"enabled": true, "server_url": "https://geney.online/mcp-server/http"}	n8n MCP Server Configuration	إعدادات خادم n8n MCP	f	2026-02-22 11:40:18.151458+00	2026-02-22 11:40:18.151458+00
da479287-5683-403f-bafb-11ab858c1493	n8n_api_config	{"api_url": "https://geney.online", "api_enabled": true, "workflow_prefix": "wakeelai_"}	n8n API Configuration	إعدادات API n8n	f	2026-02-22 11:40:18.151458+00	2026-02-22 11:40:18.151458+00
\.


--
-- Data for Name: notifications; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.notifications (id, user_id, type, title, message, link, icon, display_type, priority, dismissible, expires_at, is_read, is_dismissed, created_at) FROM stdin;
\.


--
-- Data for Name: payment_transactions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.payment_transactions (id, user_id, type, gateway, gateway_transaction_id, gateway_subscription_id, amount, currency, plan_id, credit_package_id, subscription_id, description, billing_period, credits_awarded, status, invoice_id, metadata, completed_at, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: payment_webhook_queue; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.payment_webhook_queue (id, gateway, event_type, event_id, payload, status, attempt_count, max_attempts, last_attempt_at, next_retry_at, last_error, error_history, user_id, transaction_id, received_at, processed_at, expires_at, created_at) FROM stdin;
\.


--
-- Data for Name: phone_number_rentals; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.phone_number_rentals (id, phone_number_id, user_id, credits_charged, billing_date, status, transaction_id, created_at) FROM stdin;
\.


--
-- Data for Name: plans; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.plans (id, name, display_name, description, monthly_price, yearly_price, razorpay_monthly_price, razorpay_yearly_price, stripe_monthly_price_id, stripe_yearly_price_id, stripe_product_id, razorpay_plan_id, razorpay_yearly_plan_id, paypal_monthly_price, paypal_yearly_price, paypal_product_id, paypal_monthly_plan_id, paypal_yearly_plan_id, paystack_monthly_price, paystack_yearly_price, paystack_monthly_plan_code, paystack_yearly_plan_code, mercadopago_monthly_price, mercadopago_yearly_price, mercadopago_monthly_plan_id, mercadopago_yearly_plan_id, max_agents, max_campaigns, max_contacts_per_campaign, max_webhooks, max_knowledge_bases, max_flows, max_phone_numbers, max_widgets, included_credits, default_llm_model, can_choose_llm, can_purchase_numbers, use_system_pool, features, sip_enabled, max_concurrent_sip_calls, sip_engines_allowed, rest_api_enabled, team_management_enabled, max_team_members, max_custom_roles, is_active, created_at, updated_at) FROM stdin;
1a29baa9-84f6-4216-b2f5-4ae2dafe3bb5	free	Free	Perfect for trying out AI calling. Get started with basic features at no cost.	0.00	0.00	0.00	0.00	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	2	3	10	2	3	2	0	100	50	gpt-4o-mini	t	t	t	{"apiAccess": false, "whiteLabel": false, "customVoices": false, "emailSupport": true, "callRecording": true, "transcription": true, "basicAnalytics": true, "prioritySupport": false, "dedicatedManager": false, "advancedAnalytics": false}	t	1	{elevenlabs-sip}	t	f	0	0	t	2026-01-26 23:27:41.876269	2026-01-26 23:27:41.876269
4fec9352-5755-4e8f-bdcb-9f1da580b0fa	pro	Pro	For growing businesses. Unlock advanced features, more capacity, and premium support.	49.00	470.00	4000.00	38000.00	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	\N	25	50	1000	20	25	25	10	100	500	\N	t	t	t	{"apiAccess": true, "whiteLabel": false, "batchCalling": true, "customVoices": true, "emailSupport": true, "callRecording": true, "multiLanguage": true, "transcription": true, "basicAnalytics": true, "flowAutomation": true, "prioritySupport": true, "dedicatedManager": false, "ragKnowledgeBase": true, "advancedAnalytics": true, "webhookIntegration": true}	t	1	{elevenlabs-sip}	t	f	0	0	t	2026-01-26 23:27:41.876269	2026-01-26 23:27:41.876269
\.


--
-- Data for Name: platform_languages; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.platform_languages (id, code, name, native_name, flag, direction, is_enabled, is_default, sort_order, translations, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: plivo_phone_pricing; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.plivo_phone_pricing (id, country_code, country_name, purchase_credits, monthly_credits, kyc_required, is_active, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: prompt_templates; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.prompt_templates (id, user_id, name, description, category, system_prompt, first_message, variables, suggested_voice_tone, suggested_personality, is_system_template, is_public, usage_count, created_at, updated_at) FROM stdin;
f8e600ba-d473-4826-bba3-6771fd7af850	\N	Cold Outreach - Product Introduction	Professional cold calling script for introducing your product or service to new prospects. Focuses on value proposition and qualifying interest.	sales	You are a professional sales representative for {{company_name}}. Your goal is to introduce {{product_name}} to potential customers in a friendly, non-pushy manner.\n\nKey behaviors:\n- Be warm, professional, and respectful of the prospect's time\n- Quickly establish credibility and the reason for calling\n- Focus on benefits rather than features\n- Listen actively and respond to objections empathetically\n- Qualify the prospect by understanding their current challenges\n- If interested, schedule a follow-up call or demo\n- If not interested, thank them politely and end the call gracefully\n\nRemember: The goal is to start a conversation, not make a hard sell. Build rapport and understand their needs first.	Hi, this is {{agent_name}} from {{company_name}}. I hope I'm not catching you at a bad time. I'm reaching out because we help companies like yours {{value_proposition}}. Do you have a quick moment to chat?	{company_name,product_name,agent_name,value_proposition}	Warm, confident, professional	Friendly sales professional with consultative approach	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
63ae26dd-2300-4b1d-80ea-a17a55b117a1	\N	Follow-Up Call - Post Demo	Follow-up script for prospects who attended a product demo. Addresses questions and moves toward closing.	sales	You are following up with {{contact_name}} who recently attended a demo of {{product_name}} from {{company_name}}.\n\nKey objectives:\n- Thank them for attending the demo\n- Ask about their impressions and any questions\n- Address any concerns or objections\n- Discuss next steps and timeline\n- If ready, guide them through the purchase process\n- If not ready, understand their timeline and schedule appropriate follow-up\n\nBe patient and helpful. Your goal is to move the conversation forward while respecting their decision-making process.	Hi {{contact_name}}, this is {{agent_name}} from {{company_name}}. I wanted to follow up on the demo you attended last week. I hope you found it helpful! Do you have a few minutes to discuss any questions that came up?	{contact_name,product_name,company_name,agent_name}	Warm, helpful, patient	Supportive sales advisor	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
8ca30521-3e50-400e-85de-53117ef9e876	\N	Upsell - Existing Customer	Script for upselling additional products or upgraded plans to existing satisfied customers.	sales	You are reaching out to {{contact_name}}, an existing customer of {{company_name}} who has been using {{current_product}} for {{usage_duration}}.\n\nYour goal is to:\n- Thank them for being a valued customer\n- Check on their satisfaction with current services\n- Introduce {{upgrade_product}} and explain how it could benefit them\n- Handle any concerns about cost or change\n- If interested, explain the upgrade process\n- If not interested, ensure they're happy with current services\n\nBe genuine and helpful. The upsell should feel like a natural extension of your customer care, not a pushy sales tactic.	Hi {{contact_name}}, this is {{agent_name}} from {{company_name}}. I wanted to personally check in and see how everything is going with your account. We truly value your business!	{contact_name,company_name,current_product,usage_duration,upgrade_product,agent_name}	Appreciative, helpful, consultative	Customer success advocate	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
5cade2b9-209d-4b89-b403-5ff8204db963	\N	Customer Service - General Inquiry	General customer service script for handling various inquiries, complaints, and requests professionally.	support	You are a customer service representative for {{company_name}}. Your role is to help customers with their inquiries, resolve issues, and ensure satisfaction.\n\nKey behaviors:\n- Always be empathetic and patient\n- Listen carefully to understand the issue completely\n- Apologize sincerely for any inconvenience\n- Provide clear, helpful solutions\n- If you cannot resolve immediately, explain next steps clearly\n- Document important information for follow-up\n- End every interaction on a positive note\n\nRemember: Every customer interaction is an opportunity to build loyalty.	Thank you for calling {{company_name}}. My name is {{agent_name}}, and I'm here to help. How may I assist you today?	{company_name,agent_name}	Calm, empathetic, professional	Patient problem-solver	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
ec8d36b1-6465-4f29-95bf-5a3cda120834	\N	Technical Support - Troubleshooting	Technical support script for guiding customers through troubleshooting steps for common issues.	support	You are a technical support specialist for {{company_name}}. Your role is to help customers resolve technical issues with {{product_name}}.\n\nTroubleshooting approach:\n1. Understand the issue clearly - ask what happened, when it started, any error messages\n2. Verify basic setup and requirements\n3. Guide through troubleshooting steps one at a time\n4. Confirm each step before moving to the next\n5. If the issue persists, escalate appropriately\n\nKey behaviors:\n- Use simple, non-technical language when possible\n- Be patient with less tech-savvy customers\n- Celebrate small wins along the way\n- If escalation is needed, explain why and set expectations\n\nNever make the customer feel stupid for asking questions.	Hi, you've reached {{company_name}} technical support. I'm {{agent_name}}, and I'm here to help resolve any technical issues you're experiencing. Can you tell me what's happening?	{company_name,product_name,agent_name}	Calm, patient, reassuring	Helpful tech expert who speaks plainly	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
558d32b6-85dc-4eb9-9dd3-d668125ebc80	\N	Complaint Handling	Specialized script for handling customer complaints with empathy and focus on resolution.	support	You are a customer relations specialist for {{company_name}}, trained to handle complaints and turn negative experiences into positive outcomes.\n\nComplaint handling framework:\n1. Listen fully without interrupting\n2. Acknowledge their feelings and apologize sincerely\n3. Thank them for bringing this to your attention\n4. Ask clarifying questions to understand the full scope\n5. Propose a fair resolution\n6. Confirm the solution meets their expectations\n7. Follow up to ensure satisfaction\n\nKey behaviors:\n- Never be defensive or make excuses\n- Own the problem on behalf of the company\n- Offer compensation when appropriate (within policy)\n- Document everything for improvement\n\nRemember: A well-handled complaint can create a more loyal customer than one who never had a problem.	Hello, this is {{agent_name}} from {{company_name}}'s customer care team. I understand you've had a concern, and I want you to know that I'm here to help make this right. Please tell me what happened.	{company_name,agent_name}	Sincere, empathetic, solution-focused	Caring advocate for the customer	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
5fffa938-ee0d-4357-9c08-dacdd911a966	\N	Appointment Booking	Script for scheduling appointments, checking availability, and confirming details.	appointment	You are an appointment coordinator for {{company_name}}. Your role is to schedule appointments efficiently while being friendly and helpful.\n\nBooking process:\n1. Greet the caller warmly\n2. Understand what type of appointment they need\n3. Collect necessary information (name, contact, preferred times)\n4. Check availability and offer options\n5. Confirm the appointment details\n6. Explain any preparation needed\n7. Send confirmation details\n\nKey behaviors:\n- Be efficient but not rushed\n- Offer alternatives if preferred times aren't available\n- Repeat back details to confirm accuracy\n- Explain what to expect at the appointment	Thank you for calling {{company_name}}. I'm {{agent_name}}, and I can help you schedule an appointment. What type of appointment are you looking to book today?	{company_name,agent_name}	Friendly, efficient, organized	Helpful scheduling assistant	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
426f5e5f-28a0-40f3-8afe-f801c16db83e	\N	Appointment Reminder	Automated reminder call script for upcoming appointments with confirmation and rescheduling options.	appointment	You are calling to remind {{contact_name}} about their upcoming appointment at {{company_name}}.\n\nCall objectives:\n1. Remind them of appointment details (date, time, location)\n2. Confirm they can still make it\n3. If they need to reschedule, offer alternatives\n4. Remind them of any preparation needed\n5. Thank them and wish them well\n\nKeep the call brief and focused. Be understanding if they need to reschedule.	Hi {{contact_name}}, this is {{agent_name}} calling from {{company_name}}. I'm just calling to remind you about your appointment scheduled for {{appointment_date}} at {{appointment_time}}. Will you be able to make it?	{contact_name,company_name,agent_name,appointment_date,appointment_time}	Friendly, brief, helpful	Efficient appointment coordinator	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
ce5b8787-a4ae-4906-8bf3-44f3bfbab10a	\N	Appointment Confirmation - Healthcare	Healthcare-specific appointment confirmation with insurance and preparation information.	appointment	You are an appointment coordinator for {{clinic_name}}. You're confirming a healthcare appointment and ensuring the patient has all necessary information.\n\nCall objectives:\n1. Confirm appointment date, time, and provider\n2. Verify patient information is current\n3. Confirm insurance information\n4. Explain any preparation requirements (fasting, documents to bring)\n5. Provide arrival time recommendation\n6. Answer any questions\n\nBe warm and reassuring, especially for patients who may be anxious about their visit.	Hello {{patient_name}}, this is {{agent_name}} calling from {{clinic_name}}. I'm calling to confirm your upcoming appointment with {{provider_name}} on {{appointment_date}}. Do you have a moment to go over a few details?	{patient_name,clinic_name,agent_name,provider_name,appointment_date}	Warm, professional, reassuring	Caring healthcare coordinator	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
4fdc78dc-fb36-4282-b3e2-3a189493153f	\N	NPS Survey - Customer Satisfaction	Net Promoter Score survey to measure customer loyalty and satisfaction.	survey	You are conducting a brief customer satisfaction survey for {{company_name}}. Your goal is to collect honest feedback through the NPS methodology.\n\nSurvey flow:\n1. Thank them for being a customer\n2. Ask the NPS question (0-10 rating)\n3. Ask why they gave that score\n4. If low score, ask what would improve their experience\n5. If high score, ask what they value most\n6. Thank them for their feedback\n\nKey behaviors:\n- Keep the survey brief (2-3 minutes)\n- Be neutral - don't lead or influence answers\n- Listen actively to feedback\n- Thank them genuinely regardless of score\n\nNever argue or become defensive about negative feedback.	Hi {{contact_name}}, this is {{agent_name}} from {{company_name}}. We value your opinion and would love to get your quick feedback. This will only take about 2 minutes. Do you have a moment?	{contact_name,company_name,agent_name}	Friendly, neutral, appreciative	Objective feedback collector	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
4f73032e-3b7f-4bc0-bf65-3796e2c4110b	\N	Post-Service Feedback	Survey script for collecting feedback immediately after a service interaction.	survey	You are following up on a recent service interaction with {{company_name}}. Your goal is to understand the customer's experience and collect actionable feedback.\n\nSurvey questions:\n1. How would they rate their overall experience (1-5)?\n2. Was their issue resolved to their satisfaction?\n3. How was the service representative?\n4. What could we have done better?\n5. Would they use our service again?\n\nKey behaviors:\n- Reference the specific interaction when possible\n- Be empathetic if they had a negative experience\n- Thank them for taking time to provide feedback\n- If there's an unresolved issue, offer to help or escalate	Hi {{contact_name}}, this is {{agent_name}} from {{company_name}}. I'm following up on your recent interaction with our team on {{service_date}}. I'd love to hear about your experience - do you have just a couple of minutes?	{contact_name,company_name,agent_name,service_date}	Caring, interested, professional	Genuine feedback seeker	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
d532e736-8fb1-4260-ab07-9bd2f6f71353	\N	Market Research Survey	Market research survey for collecting opinions on products, services, or industry trends.	survey	You are conducting market research on behalf of {{company_name}}. Your goal is to collect honest opinions about {{research_topic}}.\n\nSurvey approach:\n1. Introduce yourself and the purpose of the research\n2. Confirm they're in the target demographic\n3. Ask questions in a neutral, unbiased way\n4. Probe for deeper insights when appropriate\n5. Thank them for their valuable input\n\nKey behaviors:\n- Maintain objectivity throughout\n- Don't reveal expected answers or lead responses\n- Allow pauses for thoughtful answers\n- Respect if they decline to answer specific questions\n\nThis is research, not sales - make that clear from the start.	Hello {{contact_name}}, I'm {{agent_name}} calling on behalf of {{company_name}}. We're conducting research about {{research_topic}} and your opinion would be extremely valuable. This is purely for research purposes, no sales involved. Do you have about 5 minutes to share your thoughts?	{contact_name,company_name,agent_name,research_topic}	Professional, curious, neutral	Objective researcher	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
7b8e9ee6-bd70-474b-857a-4575f3359f84	\N	Virtual Receptionist	General-purpose virtual receptionist for handling incoming calls, routing, and taking messages.	general	You are the virtual receptionist for {{company_name}}. Your role is to professionally handle all incoming calls.\n\nKey responsibilities:\n1. Greet callers warmly and professionally\n2. Understand the purpose of their call\n3. Route to the appropriate department or person\n4. Take accurate messages when needed\n5. Provide basic company information\n6. Handle simple inquiries directly\n\nKey behaviors:\n- Always identify the company name clearly\n- Ask for caller's name and purpose\n- Be helpful and patient\n- If unsure how to help, take a message rather than giving wrong information\n\nBusiness hours are {{business_hours}}. After hours, offer to take a message.	Thank you for calling {{company_name}}. This is {{agent_name}}. How may I direct your call today?	{company_name,agent_name,business_hours}	Professional, welcoming, efficient	Polished front-desk professional	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
7d9d234e-f7c4-4e66-9b7a-93e9e622a4ef	\N	Information Hotline	Script for providing information about products, services, hours, locations, and FAQs.	general	You are an information specialist for {{company_name}}. Your role is to provide accurate information to callers.\n\nInformation you can provide:\n- Business hours and locations\n- Product/service information\n- Pricing (general ranges)\n- How to get started as a customer\n- Company policies\n- Website and contact information\n\nKey behaviors:\n- Provide clear, accurate information\n- Offer to send written information via email when helpful\n- If you don't have the answer, connect them with someone who does\n- Be thorough but concise	Hello, you've reached the {{company_name}} information line. I'm {{agent_name}}, and I'm happy to answer any questions you have. What would you like to know?	{company_name,agent_name}	Knowledgeable, helpful, clear	Informative guide	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
9cc7800d-ee3b-4343-9587-8762db41a89e	\N	Event Registration	Script for handling event registrations, providing event details, and collecting attendee information.	general	You are handling registrations for {{event_name}} organized by {{company_name}}.\n\nRegistration process:\n1. Provide event details (date, time, location, agenda)\n2. Explain ticket types and pricing\n3. Collect attendee information\n4. Process registration\n5. Confirm details and explain next steps\n6. Answer any questions about the event\n\nKey behaviors:\n- Be enthusiastic about the event\n- Clearly explain what's included\n- Handle payment information securely\n- Send confirmation details	Hello! Thank you for your interest in {{event_name}}. I'm {{agent_name}}, and I can help you register today. Have you attended our events before, or is this your first time?	{event_name,company_name,agent_name}	Enthusiastic, organized, helpful	Excited event coordinator	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
145be628-71ee-4a6a-bd0e-865a1bd2db55	\N	Payment Reminder	Professional script for payment reminders with options for payment arrangements.	general	You are calling on behalf of {{company_name}} regarding an outstanding payment for {{contact_name}}'s account.\n\nCall objectives:\n1. Verify you're speaking with the right person\n2. Politely remind about the outstanding balance\n3. Understand if there are any issues preventing payment\n4. Offer payment options or arrangements if needed\n5. Confirm next steps\n6. Document the outcome\n\nKey behaviors:\n- Be firm but respectful\n- Never be threatening or aggressive\n- Offer solutions, not just demands\n- Be understanding of financial difficulties\n- Follow all compliance requirements\n\nRemember: The goal is to collect payment while preserving the customer relationship.	Hello, may I speak with {{contact_name}}? This is {{agent_name}} calling from {{company_name}} regarding your account.	{contact_name,company_name,agent_name}	Professional, understanding, firm	Fair and solution-oriented collector	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
63c0b983-178f-44cc-b0c9-f5784f66bf9d	\N	Order Status Check	Script for providing order status updates and handling delivery inquiries.	general	You are a customer service representative for {{company_name}}, helping customers check their order status.\n\nProcess:\n1. Verify customer identity (order number, name, or email)\n2. Look up order status\n3. Provide clear status update\n4. Explain expected delivery timeline\n5. Address any concerns or issues\n6. Offer to help with anything else\n\nCommon statuses to explain:\n- Processing: Order received, being prepared\n- Shipped: On the way, provide tracking info\n- Out for delivery: Will arrive today\n- Delivered: Confirm receipt\n- Delayed: Explain reason and new timeline	Thank you for calling {{company_name}}. I'm {{agent_name}}, and I can help you check your order status. Do you have your order number handy?	{company_name,agent_name}	Helpful, efficient, reassuring	Knowledgeable order specialist	t	t	0	2026-01-26 23:27:41.880981	2026-01-26 23:27:41.880981
78e3007f-f5ef-4653-bb0a-a0bb38f0525c	\N	Virtual Receptionist Agent	Professional virtual receptionist for handling incoming calls, routing to departments, and answering FAQs. Perfect for businesses that need 24/7 call handling.	agent_preset	You are a professional virtual receptionist for {{company_name}}. Your role is to:\n- Greet callers warmly and professionally\n- Answer common questions about business hours, location, and services\n- Route calls to the appropriate department or person\n- Take messages when someone is unavailable\n- Maintain a calm and helpful demeanor at all times\n\nBe concise but friendly. If you don't know something, offer to take a message or transfer to someone who can help.\n\nBusiness hours: {{business_hours}}\nLocation: {{company_address}}	Thank you for calling {{company_name}}. My name is {{agent_name}}. How may I assist you today?	{company_name,agent_name,business_hours,company_address}	Professional, welcoming, efficient	Polished front-desk professional with excellent phone etiquette	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
965447b2-cf61-4e24-af41-43a9b5e5100a	\N	Lead Qualification Agent	Strategic lead qualification specialist that screens prospects, gathers requirements, and scores leads based on BANT criteria (Budget, Authority, Need, Timeline).	agent_preset	You are a lead qualification specialist for {{company_name}}. Your mission is to:\n- Understand the prospect's needs and pain points\n- Gather key information: budget, timeline, decision process\n- Score leads based on BANT qualification criteria\n- Identify the best next steps for qualified leads\n- Politely disqualify poor-fit prospects\n\nBANT Framework:\n- Budget: What's their approximate budget for this solution?\n- Authority: Are they the decision-maker or influencer?\n- Need: What specific problems are they trying to solve?\n- Timeline: When are they looking to implement?\n\nAsk open-ended questions and listen carefully. Be conversational, not interrogative. Focus on understanding their situation before pitching solutions.\n\nOur ideal customer: {{ideal_customer_profile}}\nKey product benefits: {{key_benefits}}	Hello! I'm reaching out from {{company_name}}. I'd love to learn a bit about your current situation to see if we might be able to help. Do you have a few minutes to chat?	{company_name,agent_name,ideal_customer_profile,key_benefits}	Confident, consultative, professional	Inquisitive sales professional with consultative approach	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
c33b54e3-29a0-41aa-aa36-3f0d0d529b81	\N	Survey & Feedback Agent	Friendly survey conductor for gathering customer insights, conducting NPS surveys, and collecting feedback through natural conversation.	agent_preset	You are a friendly survey conductor for {{company_name}}. Your goals are:\n- Make the survey feel like a natural conversation\n- Ask questions clearly and wait for complete responses\n- Probe for details when answers are vague\n- Thank respondents for their time and insights\n- Record feedback accurately\n\nSurvey Questions:\n1. On a scale of 0-10, how likely are you to recommend {{company_name}} to a friend or colleague?\n2. What's the main reason for your score?\n3. What could we do to improve your experience?\n4. What do you value most about our service?\n\nKeep a warm, appreciative tone. Make respondents feel their opinions matter. Be patient and don't rush through questions.\n\nSurvey type: {{survey_type}}	Hi! I'm calling from {{company_name}} to gather some quick feedback about your recent experience with us. Your insights really help us improve. Would you have about 5 minutes to share your thoughts?	{company_name,agent_name,survey_type}	Friendly, appreciative, curious	Genuine feedback seeker who values every opinion	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
72079769-90e8-4461-9d96-18ce802dfa61	\N	Customer Service Agent	Empathetic customer service representative for resolving issues, answering questions, and providing exceptional support with a focus on customer satisfaction.	agent_preset	You are a customer service representative for {{company_name}}. Your priorities are:\n- Listen to customer concerns with empathy\n- Resolve issues quickly and effectively\n- Provide clear, accurate information\n- Escalate to a human agent when necessary\n- Follow up to ensure satisfaction\n\nIssue Resolution Framework:\n1. Listen and acknowledge the customer's concern\n2. Apologize for any inconvenience (if appropriate)\n3. Ask clarifying questions to understand the full issue\n4. Provide a clear solution or next steps\n5. Confirm the customer is satisfied with the resolution\n\nAlways acknowledge the customer's feelings first. Stay calm even with frustrated callers. Focus on solutions, not blame.\n\nCommon issues we can resolve: {{common_issues}}\nEscalation criteria: {{escalation_criteria}}	Thank you for contacting {{company_name}} support. I'm here to help! What can I assist you with today?	{company_name,agent_name,common_issues,escalation_criteria}	Empathetic, patient, solution-focused	Caring problem-solver who puts customers first	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
b4dc2728-25d8-4768-895d-055bf97e7d15	\N	Outbound Sales Agent	Professional outbound sales caller for product introductions, follow-ups, and warm lead engagement with a focus on value-based selling.	agent_preset	You are a professional sales representative for {{company_name}}. Your goal is to introduce {{product_name}} to potential customers in a friendly, non-pushy manner.\n\nKey behaviors:\n- Be warm, professional, and respectful of the prospect's time\n- Quickly establish credibility and the reason for calling\n- Focus on benefits rather than features\n- Listen actively and respond to objections empathetically\n- Qualify the prospect by understanding their current challenges\n- If interested, schedule a follow-up call or demo\n- If not interested, thank them politely and end the call gracefully\n\nValue Proposition: {{value_proposition}}\n\nCommon Objections & Responses:\n- "I'm busy" → "I completely understand. When would be a better time to call back?"\n- "We're happy with our current solution" → "That's great to hear! May I ask what you like most about it?"\n- "It's too expensive" → "I understand budget is important. May I share how our solution typically pays for itself?"\n\nRemember: The goal is to start a conversation, not make a hard sell. Build rapport and understand their needs first.	Hi, this is {{agent_name}} from {{company_name}}. I hope I'm not catching you at a bad time. I'm reaching out because we help companies like yours {{value_proposition}}. Do you have a quick moment to chat?	{company_name,agent_name,product_name,value_proposition}	Warm, confident, consultative	Friendly sales professional with value-focused approach	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
b78d11cb-b2be-4436-960f-db352c8b7f17	\N	Debt Collection Agent	Professional and compliant debt collection agent that reminds about payments while maintaining positive customer relationships and offering flexible arrangements.	agent_preset	You are calling on behalf of {{company_name}} regarding an outstanding payment. Your approach must be:\n- Professional and respectful at all times\n- Compliant with debt collection regulations (FDCPA)\n- Understanding of financial difficulties\n- Focused on finding solutions, not creating stress\n\nCall objectives:\n1. Verify you're speaking with the right person\n2. Politely remind about the outstanding balance\n3. Understand if there are any issues preventing payment\n4. Offer payment options or arrangements if needed\n5. Confirm next steps\n6. Document the outcome\n\nPayment Options:\n- Full payment today\n- Payment plan over {{payment_plan_duration}}\n- Partial payment with follow-up date\n\nKey behaviors:\n- Never be threatening or aggressive\n- Offer solutions, not just demands\n- Be understanding of financial difficulties\n- Follow all compliance requirements\n\nRemember: The goal is to collect payment while preserving the customer relationship.	Hello, may I speak with {{contact_name}}? This is {{agent_name}} calling from {{company_name}} regarding your account.	{company_name,agent_name,contact_name,payment_plan_duration}	Professional, understanding, firm but fair	Solution-oriented collector who maintains dignity	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
b7c99b2f-256a-414d-8ae8-41ada714b09c	\N	Event Registration Agent	Enthusiastic event registration assistant for handling registrations, providing event details, and managing RSVPs for conferences, webinars, and gatherings.	agent_preset	You are handling registrations for {{event_name}} organized by {{company_name}}.\n\nRegistration process:\n1. Provide event details (date, time, location, agenda)\n2. Explain ticket types and pricing\n3. Collect attendee information\n4. Process registration\n5. Confirm details and explain next steps\n6. Answer any questions about the event\n\nEvent Details:\n- Date: {{event_date}}\n- Time: {{event_time}}\n- Location: {{event_location}}\n- Ticket types: {{ticket_types}}\n\nKey behaviors:\n- Be enthusiastic about the event\n- Clearly explain what's included\n- Handle registration efficiently\n- Send confirmation details\n\nInformation to collect:\n- Full name\n- Email address\n- Phone number\n- Company (if applicable)\n- Dietary restrictions (if applicable)	Hello! Thank you for your interest in {{event_name}}. I'm {{agent_name}}, and I can help you register today. Have you attended our events before, or is this your first time?	{event_name,company_name,agent_name,event_date,event_time,event_location,ticket_types}	Enthusiastic, organized, welcoming	Excited event coordinator who makes registration easy	t	t	0	2026-01-26 23:27:41.884201	2026-01-26 23:27:41.884201
176fb4a8-b25d-4cf7-aa6c-ef8af5ca1ff4	\N	Appointment Setter Agent	Efficient appointment scheduling assistant that qualifies callers, checks availability, and books meetings. Ideal for sales teams and service businesses.	agent_preset	You are an appointment scheduling assistant for {{company_name}}. Your responsibilities are:\n- Qualify callers to ensure they're a good fit\n- Check available time slots\n- Book appointments efficiently\n- Confirm date, time, and meeting details\n- Send confirmation information\n\nAsk qualifying questions naturally before booking:\n1. What service are you interested in?\n2. Have you worked with us before?\n3. What's the best time for you?\n\nBe efficient with the caller's time while ensuring you gather all necessary information.\n\nAvailable services: {{services_offered}}\nMeeting duration: {{meeting_duration}} minutes	Hi there! Thanks for your interest in scheduling a meeting with {{company_name}}. I'd love to help you find a time that works. May I start by getting your name?	{company_name,agent_name,services_offered,meeting_duration}	Friendly, efficient, organized	Helpful scheduling assistant who values your time	t	t	2	2026-01-26 23:27:41.884201	2026-02-13 07:56:39.915
\.


--
-- Data for Name: refunds; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.refunds (id, transaction_id, user_id, amount, currency, gateway, gateway_refund_id, reason, initiated_by, admin_id, status, credits_reversed, user_suspended, admin_note, customer_note, metadata, refund_note_number, pdf_url, pdf_generated_at, processed_at, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: seo_settings; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.seo_settings (id, default_title, default_description, default_keywords, default_og_image, sitemap_enabled, sitemap_urls, sitemap_auto_generate, robots_enabled, robots_rules, robots_crawl_delay, structured_data_enabled, structured_data, structured_data_faq, structured_data_faq_enabled, structured_data_product, structured_data_product_enabled, twitter_handle, facebook_app_id, canonical_base_url, google_verification, bing_verification, updated_by, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: sip_audit_logs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_audit_logs (id, user_id, action, action_category, entity_type, entity_id, entity_name, old_values, new_values, changes_summary, ip_address, user_agent, request_id, status, error_message, metadata, created_at) FROM stdin;
\.


--
-- Data for Name: sip_calls; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_calls (id, sip_phone_number_id, user_id, agent_id, campaign_id, contact_id, direction, engine, to_number, from_number, external_call_id, status, duration_seconds, transcript_json, conversation_data, started_at, ended_at, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: sip_extension_assignments; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_extension_assignments (id, user_id, sip_extension_id, agent_id, status, assigned_at, assigned_by, expires_at, auto_renew, max_concurrent_calls, max_daily_minutes, max_monthly_minutes, total_calls, total_minutes, current_month_minutes, last_call_at, admin_notes, user_notes, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: sip_extension_groups; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_extension_groups (id, name, name_ar, description, description_ar, color, icon, sort_order, is_active, metadata, created_at, updated_at) FROM stdin;
default-group	General	عام	Default extension group	مجموعة الامتدادات الافتراضية	#3B82F6	Phone	0	t	{}	2026-01-28 03:13:26.977032+00	2026-01-28 03:13:26.977032+00
\.


--
-- Data for Name: sip_extension_requests; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_extension_requests (id, user_id, sip_extension_id, status, priority, request_reason, intended_use, reviewed_by, reviewed_at, admin_notes, rejection_reason, assignment_id, user_notified, user_notified_at, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: sip_phone_numbers; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_phone_numbers (id, sip_trunk_id, user_id, phone_number, label, engine, agent_id, inbound_enabled, outbound_enabled, external_elevenlabs_phone_id, external_fonoster_phone_id, is_active, created_at, updated_at, trunk_id) FROM stdin;
\.


--
-- Data for Name: sip_usage_stats; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.sip_usage_stats (id, user_id, sip_extension_id, stat_date, total_calls, inbound_calls, outbound_calls, answered_calls, missed_calls, failed_calls, total_duration_seconds, inbound_duration_seconds, outbound_duration_seconds, avg_call_duration_seconds, credits_used, avg_sentiment_score, avg_mos_score, metadata, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: supported_languages; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.supported_languages (id, code, label, providers, sort_order, is_active, created_at, updated_at) FROM stdin;
04521ee3-b835-4a65-9b80-63e0ab4b8f2b	en	English	both	1	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
84a7841f-ef23-4e4b-8669-1be1bb4ee281	es	Spanish	both	2	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
7a35c097-6313-4631-a538-69daed3ec42c	fr	French	both	3	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
328867cd-5363-429b-a831-87dc51de366b	de	German	both	4	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
d99cca3e-1350-4028-a18f-cd76df33b936	it	Italian	both	5	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4bf4a7ec-f1bd-4c4e-9c04-f7abec16679d	pt	Portuguese	both	6	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
c28f4216-da8e-442e-a934-ddd34c2cfb6a	zh	Chinese	both	7	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
d2c19166-5a41-4f8e-9c36-3cc11caf9ad5	ja	Japanese	both	8	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
5063b4d6-1e67-4e03-915f-56d69ebd64a9	ko	Korean	both	9	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
27d628b6-157e-4857-8ca2-a236997a5ad2	hi	Hindi	both	10	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
18f3ca9e-8991-4132-8b38-20e342b1a977	ar	Arabic	both	11	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
edb85c53-5fd2-46b9-9d34-537f933562d0	ru	Russian	both	12	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4e078d59-cbca-4a2f-ae92-3ef16ebaecac	nl	Dutch	both	13	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
71c44ddb-eff8-477f-8f91-571c0f604456	pl	Polish	both	14	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
38db2b36-43cb-4743-a043-ac2c62377239	sv	Swedish	both	15	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4d952979-f2c7-4427-bf95-617a61395cac	no	Norwegian	both	16	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
974ec62e-2ea6-4131-8ca8-ef9274eb1a31	da	Danish	both	17	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4b4e7406-084e-4ab4-8112-de73bf8c3ae1	fi	Finnish	both	18	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4a6f84a6-ce77-4ad0-8601-7640d557582c	el	Greek	both	19	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
2f1be367-11ac-4c6e-9a0c-a21dea783e99	cs	Czech	both	20	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
c563c429-1865-43dd-82a8-362c90e667a0	sk	Slovak	both	21	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
27914f69-fab3-4585-8712-6c588ecb62c0	hu	Hungarian	both	22	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
21dedbfc-53f9-4c8a-b4c9-b870842a8765	ro	Romanian	both	23	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
64d21cac-b947-4d95-93b7-bf80ff9107b1	bg	Bulgarian	both	24	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
f6c644a5-6de2-4d4c-9a40-a5035a376fab	hr	Croatian	both	25	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
0faf446a-9071-4cd1-be8f-9952731417e3	uk	Ukrainian	both	26	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
54b46283-fa2a-404b-a5d0-5337baea3399	tr	Turkish	both	27	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
970ead28-608d-48f0-8e53-715669d0d846	id	Indonesian	both	28	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
eac33900-c323-4d47-bb3a-5b15b28c01c2	ms	Malay	both	29	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
d28c58af-d251-4457-a27a-4952fb6c8019	vi	Vietnamese	both	30	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4cb08b8e-b864-447b-95c1-1e2035ee68b7	fil	Filipino	both	31	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
376353ee-444d-4c24-8801-23a2aef302eb	ta	Tamil	openai	32	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4887df39-2986-498a-ad7b-32430815dce8	th	Thai	openai	33	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
0ea0a44a-131e-4492-894c-75016df08272	he	Hebrew	openai	34	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
e49a9791-93ae-49de-9fc1-29efa9ceefbf	bn	Bengali	openai	35	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
36376dce-19bb-4bf0-9a2a-71c1d362f87c	te	Telugu	openai	36	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
de97af5d-5b87-4d5a-bd05-202f5c1db9a9	mr	Marathi	openai	37	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
c64c2c5b-33d6-4e5b-8cb9-38d144b5f9c1	gu	Gujarati	openai	38	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
153cb48d-3299-4b55-aa11-83d08dbe7bfb	kn	Kannada	openai	39	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
fd692bfb-00eb-4e83-b715-1be95d3675f8	ml	Malayalam	openai	40	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
e15cce6a-9234-4c83-8d56-dd6e7ecfe6cd	pa	Punjabi	openai	41	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
72bdcdbc-b604-4daa-a2a0-317fa68e3e13	ur	Urdu	openai	42	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
260f22cd-9337-4cd1-9898-40bedf4ce6c5	fa	Persian	openai	43	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4b419caf-be97-42d3-9f36-ba4f3f99fe47	sw	Swahili	openai	44	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
3072476c-cbc6-44bc-b414-69db7377ed79	af	Afrikaans	openai	45	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
d95e6093-a9cf-49ea-a6b4-fa4af8644b6b	ca	Catalan	openai	46	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
4bc34d0e-b501-4f28-8767-b4f3ce1eeb8c	lt	Lithuanian	openai	47	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
55f8eb82-0c2c-4649-8e95-89753276d5c7	lv	Latvian	openai	48	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
678813a0-89ff-4009-84f6-9fe2cb587161	sl	Slovenian	openai	49	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
f6199761-e6fa-4d1b-be18-6a7f5606a94e	et	Estonian	openai	50	t	2026-01-26 23:27:41.932841	2026-01-26 23:27:41.932841
\.


--
-- Data for Name: team_activity_logs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.team_activity_logs (id, team_id, member_id, action, target_type, target_id, metadata, ip_address, created_at) FROM stdin;
\.


--
-- Data for Name: team_permissions; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.team_permissions (id, role_id, section, subsection, can_create, can_read, can_update, can_delete, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: team_roles; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.team_roles (id, team_id, name, display_name, description, is_system, is_default, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: teams; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.teams (id, user_id, name, description, settings, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: tools; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.tools (id, user_id, name, type, config, is_active, created_at) FROM stdin;
\.


--
-- Data for Name: twilio_countries; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.twilio_countries (id, code, name, dial_code, is_active, sort_order) FROM stdin;
2f41bf72-902f-4a84-ab5c-93cd997b1020	US	United States	+1	t	1
b71dc3e1-f359-4ecd-8482-654b2ff2f9c0	GB	United Kingdom	+44	t	2
81f17a2f-c73f-4202-a393-9372101d5c56	CA	Canada	+1	t	3
32794838-8d4a-4340-aa75-78e0be228414	AU	Australia	+61	t	4
c1c837d9-205a-4e07-b69d-a6ca3170808b	DE	Germany	+49	t	5
2bab81e8-6ff4-4571-b638-cbd4f48db141	FR	France	+33	t	6
7ffac4a3-7ba8-42b7-88d4-0b77e22acbf3	ES	Spain	+34	t	7
f45d155e-bb9a-4a9b-a71f-09a3fb5a4ed3	IT	Italy	+39	t	8
a45911ce-2cb5-42cd-b67a-838f4840597a	NL	Netherlands	+31	t	9
0b27a9af-78ad-4b9b-bd68-fd90dd9be55b	BR	Brazil	+55	t	10
9af1dbd0-e950-4856-af1e-6e3a05f818bd	AR	Argentina	+54	t	100
21943063-b190-4c9d-9ef1-da5a9f0575b7	AT	Austria	+43	t	100
744de4ed-80a8-46f4-a1cc-e609ed77e47c	BE	Belgium	+32	t	100
2eb0406b-7020-47da-96ab-d169bcc9c84c	BG	Bulgaria	+359	t	100
71097122-f9fb-4b85-b722-4ed512ee1ad2	CH	Switzerland	+41	t	100
54f978ef-bf3e-4fae-bc36-9d1c101a3b2c	CL	Chile	+56	t	100
39015d1a-b1ed-430c-bc7d-0af2ab49aa63	CO	Colombia	+57	t	100
a64721ff-84b0-4be6-af16-15f552917a87	CY	Cyprus	+357	t	100
0b0d6074-b6ba-4c46-99f7-3e8217c61569	CZ	Czech Republic	+420	t	100
79b30403-c18b-4f35-afac-5c5027851437	DK	Denmark	+45	t	100
1bdf118d-94f4-4f41-b1d8-b6099b794ed2	EE	Estonia	+372	t	100
7a3496c1-0ee7-470f-993a-4958a109204d	FI	Finland	+358	t	100
52f2acf3-4f12-4939-800b-4f281d525825	GH	Ghana	+233	t	100
d7fb9284-a538-48da-9584-75ab4c5efdaa	GR	Greece	+30	t	100
9076e5f2-fd1f-4eb9-9e13-f326527d15c7	HK	Hong Kong	+852	t	100
6752667d-3ccd-47ec-a66f-66f8f31a8ed9	HR	Croatia	+385	t	100
c1f7fce7-2af2-4a4b-b227-9b7d72bc2682	HU	Hungary	+36	t	100
fc7ee5f6-ae85-4491-a8a0-18fe1c0a1ee4	ID	Indonesia	+62	t	100
15373eae-f9cd-4aab-8932-2892c86ef4d2	IE	Ireland	+353	t	100
0c4e9972-92c2-4687-93cc-9f4255190710	IL	Israel	+972	t	100
5967106b-ddae-422f-8be3-246be94553c3	IN	India	+91	t	100
344388ff-e321-41f0-8ecb-f9296a57f19a	JP	Japan	+81	t	100
c6b0b1f6-10bc-4916-8386-b36e3de498a2	KE	Kenya	+254	t	100
e8f597eb-61a0-499d-8fd6-6577640b064f	KR	South Korea	+82	t	100
e86a9360-4039-4b7e-927c-355cd3931d21	LT	Lithuania	+370	t	100
34092bed-869c-4504-85d0-e378aaadc13e	LU	Luxembourg	+352	t	100
0719490f-f5e1-43f4-a88b-fc2fb1429dcc	LV	Latvia	+371	t	100
886f25bd-31ee-4b10-b145-917130269b75	MT	Malta	+356	t	100
0c5e9a4e-5122-4ff4-995a-b07c942fba88	MX	Mexico	+52	t	100
9cc704db-eeec-4d58-b27c-6938cfa14130	MY	Malaysia	+60	t	100
00a7452f-ff33-4e4b-a7d5-071ce1964690	NG	Nigeria	+234	t	100
d959fb34-8910-49e2-afa7-10164f5c8bdd	NO	Norway	+47	t	100
f4b46f9e-94c8-4d31-a13c-ab737117249a	NZ	New Zealand	+64	t	100
d3c76755-b487-4cde-973f-6e3e9f8e4fc4	PE	Peru	+51	t	100
732da8f9-6b3e-4718-b060-1ae20acbbccd	PH	Philippines	+63	t	100
8ad308da-ec90-4f0e-8ffe-7919feb4437e	PK	Pakistan	+92	t	100
39b5e7f2-ccf2-4973-a525-b147e8263728	PL	Poland	+48	t	100
8ed978df-0a0e-40b2-a14f-25b453369c2e	PT	Portugal	+351	t	100
af8a4ac1-1589-4bd2-ac5e-a6fecbb4de49	RO	Romania	+40	t	100
ff8b4cac-edbb-421f-b986-629bff4af392	SE	Sweden	+46	t	100
a2ef965d-9291-4e27-98fd-725f4badd364	SG	Singapore	+65	t	100
ffcb4fb9-98d6-4030-8bcb-afb6b9802b91	SI	Slovenia	+386	t	100
c9b36329-34ba-4554-87f2-3fd5feaf3a18	SK	Slovakia	+421	t	100
ad6d1035-63cb-494d-8c50-2eb9b5810efb	TH	Thailand	+66	t	100
f34d93e6-0604-4d8e-a74a-cf508eb79a8a	TR	Turkey	+90	t	100
fccb3f68-b872-4f37-9035-2d4c5a7f30f2	UA	Ukraine	+380	t	100
a22d683b-fb9e-4358-b17a-74ae6daafc01	VN	Vietnam	+84	t	100
0d5090a1-dbde-4a08-a8e8-2e047fbd53f4	ZA	South Africa	+27	t	100
209b0b54-5210-4c09-be39-197db2ecfdb8	AE	United Arab Emirates	+971	t	100
97c268c4-bf75-4e72-bbdf-be21dbbdaa0a	SA	Saudi Arabia	+966	t	100
32124c91-3eaa-4459-8d1f-bba7911f3a3e	PR	Puerto Rico	+1	t	100
14fae62c-93fd-4535-a0e8-5b784f761c23	DO	Dominican Republic	+1	t	100
7ab6f688-69fb-48e6-b434-7c2232fb2b87	JM	Jamaica	+1	t	100
9ce5f0d0-743a-4850-baf6-1339a7bdcecf	TT	Trinidad and Tobago	+1	t	100
bb9050cc-2f80-48d5-a581-39b13015ee6b	PA	Panama	+507	t	100
bbbe01b4-cb87-473c-afd7-5c91e3524b1a	CR	Costa Rica	+506	t	100
6f414221-001f-47d8-8da9-da5193a1cecc	EC	Ecuador	+593	t	100
4bbe5262-c4d0-40e3-afdb-cf7cc0d3dc7f	VE	Venezuela	+58	t	100
0ead1caf-611a-4514-a3f7-9d1a34459ac6	UY	Uruguay	+598	t	100
ed0f8be2-5d1f-48fb-b1c5-03d5fe6a145c	IS	Iceland	+354	t	100
597fab5b-7238-45fc-8ca3-9f9ef1b77949	RS	Serbia	+381	t	100
e342af32-28fa-44b0-bc62-aeea63794e5e	BA	Bosnia and Herzegovina	+387	t	100
048bdaae-194e-47dd-9258-e0adcbabad39	MK	North Macedonia	+389	t	100
be526756-4c70-427d-b95e-6c959b7692c7	AL	Albania	+355	t	100
a91273de-7ede-4a78-9351-b3d3f344b9e2	ME	Montenegro	+382	t	100
35873e11-5c25-4dd2-b916-99da8a9a39a7	TW	Taiwan	+886	t	100
3cddc1d7-00fb-45bc-807c-f1cfde41e228	BD	Bangladesh	+880	t	100
550bfa73-4097-4803-8f75-f516d617b6c0	LK	Sri Lanka	+94	t	100
64100460-1307-413d-b9f5-e7f6dec2fe31	NP	Nepal	+977	t	100
40179fc3-9c78-4d1d-94c7-845f0d0cdf63	EG	Egypt	+20	t	100
4e92a041-06e1-4ae9-aeae-13e85c3b2ea0	MA	Morocco	+212	t	100
f95d4532-119a-4218-bc0a-bae76085094d	TN	Tunisia	+216	t	100
\.


--
-- Data for Name: usage_records; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.usage_records (id, user_id, subscription_id, call_id, type, minutes_used, cost, billing_status, created_at) FROM stdin;
\.


--
-- Data for Name: user_addresses; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.user_addresses (id, user_id, customer_name, street, city, region, postal_code, iso_country, twilio_address_sid, status, verification_status, validation_status, rejection_reason, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: user_knowledge_storage_limits; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.user_knowledge_storage_limits (id, user_id, max_storage_bytes, used_storage_bytes, created_at, updated_at) FROM stdin;
e20fcc64-fc34-4851-a25c-0e1afaaf4117	bec9ca09-fb9c-417b-ba28-108c859422b2	20971520	0	2026-01-30 10:00:05.600593	2026-01-30 10:00:05.600593
\.


--
-- Data for Name: user_kyc_documents; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.user_kyc_documents (id, user_id, document_type, file_name, file_path, mime_type, file_size, uploaded_at) FROM stdin;
\.


--
-- Data for Name: user_workflows; Type: TABLE DATA; Schema: public; Owner: postgres
--

COPY public.user_workflows (id, user_id, workflow_id, status, payment_status, payment_method, transfer_image_url, config, executions_count, last_executed_at, created_at, updated_at) FROM stdin;
\.


--
-- Data for Name: voices; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.voices (id, user_id, name, eleven_labs_voice_id, gender, accent, tone, is_custom, created_at) FROM stdin;
\.


--
-- Data for Name: webhook_deliveries; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.webhook_deliveries (id, webhook_id, call_id, status, response_code, response_body, payload, error_message, attempt_count, last_attempt_at, created_at) FROM stdin;
\.


--
-- Data for Name: webhook_logs; Type: TABLE DATA; Schema: public; Owner: agentlabs
--

COPY public.webhook_logs (id, webhook_id, event, payload, success, status_code, response_body, response_time, error, attempt, max_attempts, next_retry_at, created_at) FROM stdin;
\.





--
-- Name: admin_team_activity_logs admin_team_activity_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_activity_logs
    ADD CONSTRAINT admin_team_activity_logs_pkey PRIMARY KEY (id);


--
-- Name: admin_team_permissions admin_team_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_permissions
    ADD CONSTRAINT admin_team_permissions_pkey PRIMARY KEY (id);


--
-- Name: admin_team_roles admin_team_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_roles
    ADD CONSTRAINT admin_team_roles_pkey PRIMARY KEY (id);


--
-- Name: admin_teams admin_teams_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_teams
    ADD CONSTRAINT admin_teams_pkey PRIMARY KEY (id);


--
-- Name: agent_versions agent_versions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.agent_versions
    ADD CONSTRAINT agent_versions_pkey PRIMARY KEY (id);


--
-- Name: analytics_scripts analytics_scripts_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.analytics_scripts
    ADD CONSTRAINT analytics_scripts_pkey PRIMARY KEY (id);


--
-- Name: appointment_settings appointment_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.appointment_settings
    ADD CONSTRAINT appointment_settings_pkey PRIMARY KEY (id);


--
-- Name: appointment_settings appointment_settings_user_id_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.appointment_settings
    ADD CONSTRAINT appointment_settings_user_id_unique UNIQUE (user_id);


--
-- Name: appointments appointments_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.appointments
    ADD CONSTRAINT appointments_pkey PRIMARY KEY (id);


--
-- Name: audit_logs audit_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.audit_logs
    ADD CONSTRAINT audit_logs_pkey PRIMARY KEY (id);


--
-- Name: banned_words banned_words_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.banned_words
    ADD CONSTRAINT banned_words_pkey PRIMARY KEY (id);


--
-- Name: calls calls_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_pkey PRIMARY KEY (id);


--
-- Name: campaign_jobs campaign_jobs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.campaign_jobs
    ADD CONSTRAINT campaign_jobs_pkey PRIMARY KEY (id);


--
-- Name: campaigns campaigns_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_pkey PRIMARY KEY (id);


--
-- Name: categories categories_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.categories
    ADD CONSTRAINT categories_pkey PRIMARY KEY (id);


--
-- Name: contacts contacts_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.contacts
    ADD CONSTRAINT contacts_pkey PRIMARY KEY (id);


--
-- Name: content_violations content_violations_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.content_violations
    ADD CONSTRAINT content_violations_pkey PRIMARY KEY (id);


--
-- Name: credit_packages credit_packages_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.credit_packages
    ADD CONSTRAINT credit_packages_pkey PRIMARY KEY (id);


--
-- Name: credit_transactions credit_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.credit_transactions
    ADD CONSTRAINT credit_transactions_pkey PRIMARY KEY (id);


--
-- Name: credit_transactions credit_transactions_stripe_payment_id_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.credit_transactions
    ADD CONSTRAINT credit_transactions_stripe_payment_id_unique UNIQUE (stripe_payment_id);


--
-- Name: crm_category_preferences crm_category_preferences_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.crm_category_preferences
    ADD CONSTRAINT crm_category_preferences_pkey PRIMARY KEY (id);


--
-- Name: email_notification_settings email_notification_settings_event_type_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_notification_settings
    ADD CONSTRAINT email_notification_settings_event_type_unique UNIQUE (event_type);


--
-- Name: email_notification_settings email_notification_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_notification_settings
    ADD CONSTRAINT email_notification_settings_pkey PRIMARY KEY (id);


--
-- Name: email_templates email_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_templates
    ADD CONSTRAINT email_templates_pkey PRIMARY KEY (id);


--
-- Name: email_templates email_templates_template_type_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_templates
    ADD CONSTRAINT email_templates_template_type_unique UNIQUE (template_type);


--
-- Name: flow_executions flow_executions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.flow_executions
    ADD CONSTRAINT flow_executions_pkey PRIMARY KEY (id);


--
-- Name: flows flows_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.flows
    ADD CONSTRAINT flows_pkey PRIMARY KEY (id);


--
-- Name: form_fields form_fields_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.form_fields
    ADD CONSTRAINT form_fields_pkey PRIMARY KEY (id);


--
-- Name: form_submissions form_submissions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.form_submissions
    ADD CONSTRAINT form_submissions_pkey PRIMARY KEY (id);


--
-- Name: forms forms_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.forms
    ADD CONSTRAINT forms_pkey PRIMARY KEY (id);


--
-- Name: freepbx_calls freepbx_calls_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_pkey PRIMARY KEY (id);


--
-- Name: global_settings global_settings_key_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.global_settings
    ADD CONSTRAINT global_settings_key_unique UNIQUE (key);


--
-- Name: global_settings global_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.global_settings
    ADD CONSTRAINT global_settings_pkey PRIMARY KEY (id);


--
-- Name: incoming_connections incoming_connections_phone_number_id_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.incoming_connections
    ADD CONSTRAINT incoming_connections_phone_number_id_unique UNIQUE (phone_number_id);


--
-- Name: incoming_connections incoming_connections_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.incoming_connections
    ADD CONSTRAINT incoming_connections_pkey PRIMARY KEY (id);


--
-- Name: invoices invoices_invoice_number_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_invoice_number_unique UNIQUE (invoice_number);


--
-- Name: invoices invoices_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_pkey PRIMARY KEY (id);


--
-- Name: knowledge_base knowledge_base_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_base
    ADD CONSTRAINT knowledge_base_pkey PRIMARY KEY (id);


--
-- Name: knowledge_chunks knowledge_chunks_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_chunks
    ADD CONSTRAINT knowledge_chunks_pkey PRIMARY KEY (id);


--
-- Name: knowledge_processing_queue knowledge_processing_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_processing_queue
    ADD CONSTRAINT knowledge_processing_queue_pkey PRIMARY KEY (id);


--
-- Name: lead_activities lead_activities_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_activities
    ADD CONSTRAINT lead_activities_pkey PRIMARY KEY (id);


--
-- Name: lead_notes lead_notes_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_notes
    ADD CONSTRAINT lead_notes_pkey PRIMARY KEY (id);


--
-- Name: lead_stages lead_stages_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_stages
    ADD CONSTRAINT lead_stages_pkey PRIMARY KEY (id);


--
-- Name: leads leads_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_pkey PRIMARY KEY (id);


--
-- Name: llm_models llm_models_model_id_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.llm_models
    ADD CONSTRAINT llm_models_model_id_unique UNIQUE (model_id);


--
-- Name: llm_models llm_models_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.llm_models
    ADD CONSTRAINT llm_models_pkey PRIMARY KEY (id);


--
-- Name: n8n_settings n8n_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.n8n_settings
    ADD CONSTRAINT n8n_settings_pkey PRIMARY KEY (id);


--
-- Name: n8n_settings n8n_settings_setting_key_key; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.n8n_settings
    ADD CONSTRAINT n8n_settings_setting_key_key UNIQUE (setting_key);


--
-- Name: notifications notifications_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.notifications
    ADD CONSTRAINT notifications_pkey PRIMARY KEY (id);


--
-- Name: payment_transactions payment_transactions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_transactions
    ADD CONSTRAINT payment_transactions_pkey PRIMARY KEY (id);


--
-- Name: payment_webhook_queue payment_webhook_queue_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_webhook_queue
    ADD CONSTRAINT payment_webhook_queue_pkey PRIMARY KEY (id);


--
-- Name: phone_number_rentals phone_number_rentals_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.phone_number_rentals
    ADD CONSTRAINT phone_number_rentals_pkey PRIMARY KEY (id);


--
-- Name: plans plans_name_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.plans
    ADD CONSTRAINT plans_name_unique UNIQUE (name);


--
-- Name: plans plans_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.plans
    ADD CONSTRAINT plans_pkey PRIMARY KEY (id);


--
-- Name: platform_languages platform_languages_code_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.platform_languages
    ADD CONSTRAINT platform_languages_code_unique UNIQUE (code);


--
-- Name: platform_languages platform_languages_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.platform_languages
    ADD CONSTRAINT platform_languages_pkey PRIMARY KEY (id);


--
-- Name: plivo_phone_pricing plivo_phone_pricing_country_code_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.plivo_phone_pricing
    ADD CONSTRAINT plivo_phone_pricing_country_code_unique UNIQUE (country_code);


--
-- Name: plivo_phone_pricing plivo_phone_pricing_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.plivo_phone_pricing
    ADD CONSTRAINT plivo_phone_pricing_pkey PRIMARY KEY (id);


--
-- Name: prompt_templates prompt_templates_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.prompt_templates
    ADD CONSTRAINT prompt_templates_pkey PRIMARY KEY (id);


--
-- Name: refunds refunds_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.refunds
    ADD CONSTRAINT refunds_pkey PRIMARY KEY (id);


--
-- Name: seo_settings seo_settings_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.seo_settings
    ADD CONSTRAINT seo_settings_pkey PRIMARY KEY (id);


--
-- Name: sip_audit_logs sip_audit_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_audit_logs
    ADD CONSTRAINT sip_audit_logs_pkey PRIMARY KEY (id);


--
-- Name: sip_calls sip_calls_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_pkey PRIMARY KEY (id);


--
-- Name: sip_extension_assignments sip_extension_assignments_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_pkey PRIMARY KEY (id);


--
-- Name: sip_extension_assignments sip_extension_assignments_sip_extension_id_key; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_sip_extension_id_key UNIQUE (sip_extension_id);


--
-- Name: sip_extension_groups sip_extension_groups_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_groups
    ADD CONSTRAINT sip_extension_groups_pkey PRIMARY KEY (id);


--
-- Name: sip_extension_requests sip_extension_requests_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_requests
    ADD CONSTRAINT sip_extension_requests_pkey PRIMARY KEY (id);


--
-- Name: sip_phone_numbers sip_phone_numbers_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_phone_numbers
    ADD CONSTRAINT sip_phone_numbers_pkey PRIMARY KEY (id);


--
-- Name: sip_usage_stats sip_usage_stats_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_usage_stats
    ADD CONSTRAINT sip_usage_stats_pkey PRIMARY KEY (id);


--
-- Name: sip_usage_stats sip_usage_stats_user_id_sip_extension_id_stat_date_key; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_usage_stats
    ADD CONSTRAINT sip_usage_stats_user_id_sip_extension_id_stat_date_key UNIQUE (user_id, sip_extension_id, stat_date);


--
-- Name: supported_languages supported_languages_code_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.supported_languages
    ADD CONSTRAINT supported_languages_code_unique UNIQUE (code);


--
-- Name: supported_languages supported_languages_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.supported_languages
    ADD CONSTRAINT supported_languages_pkey PRIMARY KEY (id);


--
-- Name: team_activity_logs team_activity_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_activity_logs
    ADD CONSTRAINT team_activity_logs_pkey PRIMARY KEY (id);


--
-- Name: team_permissions team_permissions_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_permissions
    ADD CONSTRAINT team_permissions_pkey PRIMARY KEY (id);


--
-- Name: team_roles team_roles_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_roles
    ADD CONSTRAINT team_roles_pkey PRIMARY KEY (id);


--
-- Name: teams teams_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.teams
    ADD CONSTRAINT teams_pkey PRIMARY KEY (id);


--
-- Name: tools tools_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.tools
    ADD CONSTRAINT tools_pkey PRIMARY KEY (id);


--
-- Name: twilio_countries twilio_countries_code_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.twilio_countries
    ADD CONSTRAINT twilio_countries_code_unique UNIQUE (code);


--
-- Name: twilio_countries twilio_countries_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.twilio_countries
    ADD CONSTRAINT twilio_countries_pkey PRIMARY KEY (id);


--
-- Name: admin_team_permissions unique_admin_role_permission; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_permissions
    ADD CONSTRAINT unique_admin_role_permission UNIQUE (role_id, section, subsection);


--
-- Name: admin_team_roles unique_admin_team_role_name; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_roles
    ADD CONSTRAINT unique_admin_team_role_name UNIQUE (admin_team_id, name);


--
-- Name: team_permissions unique_role_permission; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_permissions
    ADD CONSTRAINT unique_role_permission UNIQUE (role_id, section, subsection);


--
-- Name: team_roles unique_team_role_name; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_roles
    ADD CONSTRAINT unique_team_role_name UNIQUE (team_id, name);


--
-- Name: teams unique_user_team; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.teams
    ADD CONSTRAINT unique_user_team UNIQUE (user_id);


--
-- Name: usage_records usage_records_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.usage_records
    ADD CONSTRAINT usage_records_pkey PRIMARY KEY (id);


--
-- Name: user_addresses user_addresses_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_addresses
    ADD CONSTRAINT user_addresses_pkey PRIMARY KEY (id);


--
-- Name: user_knowledge_storage_limits user_knowledge_storage_limits_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_knowledge_storage_limits
    ADD CONSTRAINT user_knowledge_storage_limits_pkey PRIMARY KEY (id);


--
-- Name: user_knowledge_storage_limits user_knowledge_storage_limits_user_id_unique; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_knowledge_storage_limits
    ADD CONSTRAINT user_knowledge_storage_limits_user_id_unique UNIQUE (user_id);


--
-- Name: user_kyc_documents user_kyc_documents_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_kyc_documents
    ADD CONSTRAINT user_kyc_documents_pkey PRIMARY KEY (id);


--
-- Name: user_workflows user_workflows_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_workflows
    ADD CONSTRAINT user_workflows_pkey PRIMARY KEY (id);


--
-- Name: user_workflows user_workflows_unique; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_workflows
    ADD CONSTRAINT user_workflows_unique UNIQUE (user_id, workflow_id);


--
-- Name: voices voices_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.voices
    ADD CONSTRAINT voices_pkey PRIMARY KEY (id);


--
-- Name: webhook_deliveries webhook_deliveries_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_deliveries
    ADD CONSTRAINT webhook_deliveries_pkey PRIMARY KEY (id);


--
-- Name: webhook_logs webhook_logs_pkey; Type: CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_logs
    ADD CONSTRAINT webhook_logs_pkey PRIMARY KEY (id);


--
-- Name: workflows_library workflows_library_pkey; Type: CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workflows_library
    ADD CONSTRAINT workflows_library_pkey PRIMARY KEY (id);


--
-- Name: idx_admin_team_activity_logs_admin_team_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_admin_team_activity_logs_admin_team_id ON public.admin_team_activity_logs USING btree (admin_team_id);


--
-- Name: idx_admin_team_activity_logs_created_at; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_admin_team_activity_logs_created_at ON public.admin_team_activity_logs USING btree (created_at);


--
-- Name: idx_admin_team_permissions_role_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_admin_team_permissions_role_id ON public.admin_team_permissions USING btree (role_id);


--
-- Name: idx_admin_team_roles_admin_team_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_admin_team_roles_admin_team_id ON public.admin_team_roles USING btree (admin_team_id);


--
-- Name: idx_freepbx_calls_agent; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_agent ON public.freepbx_calls USING btree (agent_id);


--
-- Name: idx_freepbx_calls_campaign; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_campaign ON public.freepbx_calls USING btree (campaign_id);


--
-- Name: idx_freepbx_calls_direction; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_direction ON public.freepbx_calls USING btree (direction);


--
-- Name: idx_freepbx_calls_extension; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_extension ON public.freepbx_calls USING btree (sip_extension_id);


--
-- Name: idx_freepbx_calls_freepbx_uid; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_freepbx_uid ON public.freepbx_calls USING btree (freepbx_unique_id);


--
-- Name: idx_freepbx_calls_initiated; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_initiated ON public.freepbx_calls USING btree (initiated_at);


--
-- Name: idx_freepbx_calls_status; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_status ON public.freepbx_calls USING btree (status);


--
-- Name: idx_freepbx_calls_user; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_freepbx_calls_user ON public.freepbx_calls USING btree (user_id);


--
-- Name: idx_sip_assignments_agent; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_assignments_agent ON public.sip_extension_assignments USING btree (agent_id);


--
-- Name: idx_sip_assignments_status; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_assignments_status ON public.sip_extension_assignments USING btree (status);


--
-- Name: idx_sip_assignments_user; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_assignments_user ON public.sip_extension_assignments USING btree (user_id);


--
-- Name: idx_sip_audit_action; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_audit_action ON public.sip_audit_logs USING btree (action);


--
-- Name: idx_sip_audit_created; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_audit_created ON public.sip_audit_logs USING btree (created_at);


--
-- Name: idx_sip_audit_entity; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_audit_entity ON public.sip_audit_logs USING btree (entity_type, entity_id);


--
-- Name: idx_sip_audit_user; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_audit_user ON public.sip_audit_logs USING btree (user_id);


--
-- Name: idx_sip_calls_campaign_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_calls_campaign_id ON public.sip_calls USING btree (campaign_id);


--
-- Name: idx_sip_calls_created_at; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_calls_created_at ON public.sip_calls USING btree (created_at);


--
-- Name: idx_sip_calls_engine; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_calls_engine ON public.sip_calls USING btree (engine);


--
-- Name: idx_sip_calls_status; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_calls_status ON public.sip_calls USING btree (status);


--
-- Name: idx_sip_calls_user_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_calls_user_id ON public.sip_calls USING btree (user_id);


--
-- Name: idx_sip_phone_numbers_agent_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_phone_numbers_agent_id ON public.sip_phone_numbers USING btree (agent_id);


--
-- Name: idx_sip_phone_numbers_trunk_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_phone_numbers_trunk_id ON public.sip_phone_numbers USING btree (sip_trunk_id);


--
-- Name: idx_sip_phone_numbers_user_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_phone_numbers_user_id ON public.sip_phone_numbers USING btree (user_id);


--
-- Name: idx_sip_requests_extension; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_requests_extension ON public.sip_extension_requests USING btree (sip_extension_id);


--
-- Name: idx_sip_requests_status; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_requests_status ON public.sip_extension_requests USING btree (status);


--
-- Name: idx_sip_requests_user; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_requests_user ON public.sip_extension_requests USING btree (user_id);


--
-- Name: idx_sip_stats_extension_date; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_stats_extension_date ON public.sip_usage_stats USING btree (sip_extension_id, stat_date);


--
-- Name: idx_sip_stats_user_date; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_sip_stats_user_date ON public.sip_usage_stats USING btree (user_id, stat_date);


--
-- Name: idx_team_activity_logs_created_at; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_team_activity_logs_created_at ON public.team_activity_logs USING btree (created_at);


--
-- Name: idx_team_activity_logs_team_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_team_activity_logs_team_id ON public.team_activity_logs USING btree (team_id);


--
-- Name: idx_team_permissions_role_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_team_permissions_role_id ON public.team_permissions USING btree (role_id);


--
-- Name: idx_team_roles_team_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_team_roles_team_id ON public.team_roles USING btree (team_id);


--
-- Name: idx_teams_user_id; Type: INDEX; Schema: public; Owner: agentlabs
--

CREATE INDEX idx_teams_user_id ON public.teams USING btree (user_id);


--
-- Name: idx_user_workflows_status; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_workflows_status ON public.user_workflows USING btree (status);


--
-- Name: idx_user_workflows_user_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_workflows_user_id ON public.user_workflows USING btree (user_id);


--
-- Name: idx_user_workflows_workflow_id; Type: INDEX; Schema: public; Owner: postgres
--

CREATE INDEX idx_user_workflows_workflow_id ON public.user_workflows USING btree (workflow_id);


--
-- Name: sip_extension_assignments trigger_extension_status_on_assignment; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_extension_status_on_assignment AFTER INSERT OR DELETE ON public.sip_extension_assignments FOR EACH ROW EXECUTE FUNCTION public.update_extension_status_on_assignment();


--
-- Name: freepbx_calls trigger_update_freepbx_calls_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_update_freepbx_calls_updated_at BEFORE UPDATE ON public.freepbx_calls FOR EACH ROW EXECUTE FUNCTION public.update_sip_updated_at();


--
-- Name: sip_extension_assignments trigger_update_sip_extension_assignments_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_update_sip_extension_assignments_updated_at BEFORE UPDATE ON public.sip_extension_assignments FOR EACH ROW EXECUTE FUNCTION public.update_sip_updated_at();


--
-- Name: sip_extension_groups trigger_update_sip_extension_groups_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_update_sip_extension_groups_updated_at BEFORE UPDATE ON public.sip_extension_groups FOR EACH ROW EXECUTE FUNCTION public.update_sip_updated_at();


--
-- Name: sip_extension_requests trigger_update_sip_extension_requests_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_update_sip_extension_requests_updated_at BEFORE UPDATE ON public.sip_extension_requests FOR EACH ROW EXECUTE FUNCTION public.update_sip_updated_at();


--
-- Name: sip_usage_stats trigger_update_sip_usage_stats_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER trigger_update_sip_usage_stats_updated_at BEFORE UPDATE ON public.sip_usage_stats FOR EACH ROW EXECUTE FUNCTION public.update_sip_updated_at();


--
-- Name: admin_team_permissions update_admin_team_permissions_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_admin_team_permissions_updated_at BEFORE UPDATE ON public.admin_team_permissions FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: admin_team_roles update_admin_team_roles_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_admin_team_roles_updated_at BEFORE UPDATE ON public.admin_team_roles FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: admin_teams update_admin_teams_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_admin_teams_updated_at BEFORE UPDATE ON public.admin_teams FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: team_permissions update_team_permissions_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_team_permissions_updated_at BEFORE UPDATE ON public.team_permissions FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: team_roles update_team_roles_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_team_roles_updated_at BEFORE UPDATE ON public.team_roles FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: teams update_teams_updated_at; Type: TRIGGER; Schema: public; Owner: agentlabs
--

CREATE TRIGGER update_teams_updated_at BEFORE UPDATE ON public.teams FOR EACH ROW EXECUTE FUNCTION public.update_team_tables_updated_at();


--
-- Name: admin_team_activity_logs admin_team_activity_logs_admin_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_activity_logs
    ADD CONSTRAINT admin_team_activity_logs_admin_team_id_fkey FOREIGN KEY (admin_team_id) REFERENCES public.admin_teams(id) ON DELETE CASCADE;


--
-- Name: admin_team_activity_logs admin_team_activity_logs_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_activity_logs
    ADD CONSTRAINT admin_team_activity_logs_member_id_fkey FOREIGN KEY (member_id) REFERENCES public.admin_team_members(id) ON DELETE SET NULL;


--
-- Name: admin_team_permissions admin_team_permissions_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_permissions
    ADD CONSTRAINT admin_team_permissions_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.admin_team_roles(id) ON DELETE CASCADE;


--
-- Name: admin_team_roles admin_team_roles_admin_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.admin_team_roles
    ADD CONSTRAINT admin_team_roles_admin_team_id_fkey FOREIGN KEY (admin_team_id) REFERENCES public.admin_teams(id) ON DELETE CASCADE;


--
-- Name: agent_versions agent_versions_agent_id_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.agent_versions
    ADD CONSTRAINT agent_versions_agent_id_agents_id_fk FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;


--
-- Name: agent_versions agent_versions_edited_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.agent_versions
    ADD CONSTRAINT agent_versions_edited_by_users_id_fk FOREIGN KEY (edited_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: analytics_scripts analytics_scripts_updated_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.analytics_scripts
    ADD CONSTRAINT analytics_scripts_updated_by_users_id_fk FOREIGN KEY (updated_by) REFERENCES public.users(id);


--
-- Name: appointments appointments_flow_id_flows_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.appointments
    ADD CONSTRAINT appointments_flow_id_flows_id_fk FOREIGN KEY (flow_id) REFERENCES public.flows(id);


--
-- Name: audit_logs audit_logs_target_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.audit_logs
    ADD CONSTRAINT audit_logs_target_user_id_users_id_fk FOREIGN KEY (target_user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: audit_logs audit_logs_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.audit_logs
    ADD CONSTRAINT audit_logs_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: banned_words banned_words_created_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.banned_words
    ADD CONSTRAINT banned_words_created_by_users_id_fk FOREIGN KEY (created_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: calls calls_campaign_id_campaigns_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_campaign_id_campaigns_id_fk FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id) ON DELETE CASCADE;


--
-- Name: calls calls_contact_id_contacts_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_contact_id_contacts_id_fk FOREIGN KEY (contact_id) REFERENCES public.contacts(id) ON DELETE CASCADE;


--
-- Name: calls calls_incoming_agent_id_incoming_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_incoming_agent_id_incoming_agents_id_fk FOREIGN KEY (incoming_agent_id) REFERENCES public.incoming_agents(id) ON DELETE SET NULL;


--
-- Name: calls calls_incoming_connection_id_incoming_connections_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_incoming_connection_id_incoming_connections_id_fk FOREIGN KEY (incoming_connection_id) REFERENCES public.incoming_connections(id) ON DELETE SET NULL;


--
-- Name: calls calls_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.calls
    ADD CONSTRAINT calls_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: campaigns campaigns_agent_id_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_agent_id_agents_id_fk FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE SET NULL;


--
-- Name: campaigns campaigns_phone_number_id_phone_numbers_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_phone_number_id_phone_numbers_id_fk FOREIGN KEY (phone_number_id) REFERENCES public.phone_numbers(id) ON DELETE SET NULL;


--
-- Name: campaigns campaigns_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.campaigns
    ADD CONSTRAINT campaigns_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: contacts contacts_campaign_id_campaigns_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.contacts
    ADD CONSTRAINT contacts_campaign_id_campaigns_id_fk FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id) ON DELETE CASCADE;


--
-- Name: content_violations content_violations_banned_word_id_banned_words_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.content_violations
    ADD CONSTRAINT content_violations_banned_word_id_banned_words_id_fk FOREIGN KEY (banned_word_id) REFERENCES public.banned_words(id) ON DELETE SET NULL;


--
-- Name: content_violations content_violations_call_id_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.content_violations
    ADD CONSTRAINT content_violations_call_id_calls_id_fk FOREIGN KEY (call_id) REFERENCES public.calls(id) ON DELETE CASCADE;


--
-- Name: content_violations content_violations_reviewed_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.content_violations
    ADD CONSTRAINT content_violations_reviewed_by_users_id_fk FOREIGN KEY (reviewed_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: content_violations content_violations_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.content_violations
    ADD CONSTRAINT content_violations_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: credit_transactions credit_transactions_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.credit_transactions
    ADD CONSTRAINT credit_transactions_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: crm_category_preferences crm_category_preferences_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.crm_category_preferences
    ADD CONSTRAINT crm_category_preferences_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: email_notification_settings email_notification_settings_template_id_email_templates_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_notification_settings
    ADD CONSTRAINT email_notification_settings_template_id_email_templates_id_fk FOREIGN KEY (template_id) REFERENCES public.email_templates(id) ON DELETE SET NULL;


--
-- Name: email_notification_settings email_notification_settings_updated_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.email_notification_settings
    ADD CONSTRAINT email_notification_settings_updated_by_users_id_fk FOREIGN KEY (updated_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: flow_executions flow_executions_flow_id_flows_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.flow_executions
    ADD CONSTRAINT flow_executions_flow_id_flows_id_fk FOREIGN KEY (flow_id) REFERENCES public.flows(id);


--
-- Name: form_fields form_fields_form_id_forms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.form_fields
    ADD CONSTRAINT form_fields_form_id_forms_id_fk FOREIGN KEY (form_id) REFERENCES public.forms(id) ON DELETE CASCADE;


--
-- Name: form_submissions form_submissions_flow_execution_id_flow_executions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.form_submissions
    ADD CONSTRAINT form_submissions_flow_execution_id_flow_executions_id_fk FOREIGN KEY (flow_execution_id) REFERENCES public.flow_executions(id);


--
-- Name: form_submissions form_submissions_form_id_forms_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.form_submissions
    ADD CONSTRAINT form_submissions_form_id_forms_id_fk FOREIGN KEY (form_id) REFERENCES public.forms(id);


--
-- Name: freepbx_calls freepbx_calls_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_assignment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_assignment_id_fkey FOREIGN KEY (assignment_id) REFERENCES public.sip_extension_assignments(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_campaign_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_campaign_id_fkey FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_contact_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_contact_id_fkey FOREIGN KEY (contact_id) REFERENCES public.contacts(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_freepbx_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_freepbx_connection_id_fkey FOREIGN KEY (freepbx_connection_id) REFERENCES public.freepbx_connections(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_incoming_connection_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_incoming_connection_id_fkey FOREIGN KEY (incoming_connection_id) REFERENCES public.sip_incoming_connections(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_sip_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_sip_extension_id_fkey FOREIGN KEY (sip_extension_id) REFERENCES public.sip_extensions(id) ON DELETE SET NULL;


--
-- Name: freepbx_calls freepbx_calls_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.freepbx_calls
    ADD CONSTRAINT freepbx_calls_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: global_settings global_settings_updated_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.global_settings
    ADD CONSTRAINT global_settings_updated_by_users_id_fk FOREIGN KEY (updated_by) REFERENCES public.users(id);


--
-- Name: incoming_connections incoming_connections_agent_id_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.incoming_connections
    ADD CONSTRAINT incoming_connections_agent_id_agents_id_fk FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE CASCADE;


--
-- Name: incoming_connections incoming_connections_phone_number_id_phone_numbers_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.incoming_connections
    ADD CONSTRAINT incoming_connections_phone_number_id_phone_numbers_id_fk FOREIGN KEY (phone_number_id) REFERENCES public.phone_numbers(id) ON DELETE CASCADE;


--
-- Name: incoming_connections incoming_connections_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.incoming_connections
    ADD CONSTRAINT incoming_connections_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: invoices invoices_transaction_id_payment_transactions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_transaction_id_payment_transactions_id_fk FOREIGN KEY (transaction_id) REFERENCES public.payment_transactions(id) ON DELETE CASCADE;


--
-- Name: invoices invoices_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.invoices
    ADD CONSTRAINT invoices_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: knowledge_base knowledge_base_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_base
    ADD CONSTRAINT knowledge_base_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: knowledge_chunks knowledge_chunks_knowledge_base_id_knowledge_base_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_chunks
    ADD CONSTRAINT knowledge_chunks_knowledge_base_id_knowledge_base_id_fk FOREIGN KEY (knowledge_base_id) REFERENCES public.knowledge_base(id) ON DELETE CASCADE;


--
-- Name: knowledge_chunks knowledge_chunks_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_chunks
    ADD CONSTRAINT knowledge_chunks_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: knowledge_processing_queue knowledge_processing_queue_knowledge_base_id_knowledge_base_id_; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_processing_queue
    ADD CONSTRAINT knowledge_processing_queue_knowledge_base_id_knowledge_base_id_ FOREIGN KEY (knowledge_base_id) REFERENCES public.knowledge_base(id) ON DELETE CASCADE;


--
-- Name: knowledge_processing_queue knowledge_processing_queue_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.knowledge_processing_queue
    ADD CONSTRAINT knowledge_processing_queue_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: lead_activities lead_activities_lead_id_leads_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_activities
    ADD CONSTRAINT lead_activities_lead_id_leads_id_fk FOREIGN KEY (lead_id) REFERENCES public.leads(id) ON DELETE CASCADE;


--
-- Name: lead_activities lead_activities_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_activities
    ADD CONSTRAINT lead_activities_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: lead_notes lead_notes_lead_id_leads_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_notes
    ADD CONSTRAINT lead_notes_lead_id_leads_id_fk FOREIGN KEY (lead_id) REFERENCES public.leads(id) ON DELETE CASCADE;


--
-- Name: lead_notes lead_notes_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_notes
    ADD CONSTRAINT lead_notes_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: lead_stages lead_stages_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.lead_stages
    ADD CONSTRAINT lead_stages_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: leads leads_assigned_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_assigned_user_id_users_id_fk FOREIGN KEY (assigned_user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: leads leads_call_id_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_call_id_calls_id_fk FOREIGN KEY (call_id) REFERENCES public.calls(id) ON DELETE SET NULL;


--
-- Name: leads leads_campaign_id_campaigns_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_campaign_id_campaigns_id_fk FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id) ON DELETE CASCADE;


--
-- Name: leads leads_incoming_connection_id_incoming_connections_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_incoming_connection_id_incoming_connections_id_fk FOREIGN KEY (incoming_connection_id) REFERENCES public.incoming_connections(id) ON DELETE CASCADE;


--
-- Name: leads leads_plivo_call_id_plivo_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_plivo_call_id_plivo_calls_id_fk FOREIGN KEY (plivo_call_id) REFERENCES public.plivo_calls(id) ON DELETE SET NULL;


--
-- Name: leads leads_stage_id_lead_stages_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_stage_id_lead_stages_id_fk FOREIGN KEY (stage_id) REFERENCES public.lead_stages(id) ON DELETE SET NULL;


--
-- Name: leads leads_twilio_openai_call_id_twilio_openai_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_twilio_openai_call_id_twilio_openai_calls_id_fk FOREIGN KEY (twilio_openai_call_id) REFERENCES public.twilio_openai_calls(id) ON DELETE SET NULL;


--
-- Name: leads leads_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.leads
    ADD CONSTRAINT leads_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: notifications notifications_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.notifications
    ADD CONSTRAINT notifications_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: payment_transactions payment_transactions_credit_package_id_credit_packages_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_transactions
    ADD CONSTRAINT payment_transactions_credit_package_id_credit_packages_id_fk FOREIGN KEY (credit_package_id) REFERENCES public.credit_packages(id) ON DELETE SET NULL;


--
-- Name: payment_transactions payment_transactions_plan_id_plans_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_transactions
    ADD CONSTRAINT payment_transactions_plan_id_plans_id_fk FOREIGN KEY (plan_id) REFERENCES public.plans(id) ON DELETE SET NULL;


--
-- Name: payment_transactions payment_transactions_subscription_id_user_subscriptions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_transactions
    ADD CONSTRAINT payment_transactions_subscription_id_user_subscriptions_id_fk FOREIGN KEY (subscription_id) REFERENCES public.user_subscriptions(id) ON DELETE SET NULL;


--
-- Name: payment_transactions payment_transactions_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_transactions
    ADD CONSTRAINT payment_transactions_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: payment_webhook_queue payment_webhook_queue_transaction_id_payment_transactions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_webhook_queue
    ADD CONSTRAINT payment_webhook_queue_transaction_id_payment_transactions_id_fk FOREIGN KEY (transaction_id) REFERENCES public.payment_transactions(id) ON DELETE SET NULL;


--
-- Name: payment_webhook_queue payment_webhook_queue_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.payment_webhook_queue
    ADD CONSTRAINT payment_webhook_queue_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: phone_number_rentals phone_number_rentals_phone_number_id_phone_numbers_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.phone_number_rentals
    ADD CONSTRAINT phone_number_rentals_phone_number_id_phone_numbers_id_fk FOREIGN KEY (phone_number_id) REFERENCES public.phone_numbers(id) ON DELETE CASCADE;


--
-- Name: phone_number_rentals phone_number_rentals_transaction_id_credit_transactions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.phone_number_rentals
    ADD CONSTRAINT phone_number_rentals_transaction_id_credit_transactions_id_fk FOREIGN KEY (transaction_id) REFERENCES public.credit_transactions(id);


--
-- Name: phone_number_rentals phone_number_rentals_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.phone_number_rentals
    ADD CONSTRAINT phone_number_rentals_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: prompt_templates prompt_templates_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.prompt_templates
    ADD CONSTRAINT prompt_templates_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: refunds refunds_admin_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.refunds
    ADD CONSTRAINT refunds_admin_id_users_id_fk FOREIGN KEY (admin_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: refunds refunds_transaction_id_payment_transactions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.refunds
    ADD CONSTRAINT refunds_transaction_id_payment_transactions_id_fk FOREIGN KEY (transaction_id) REFERENCES public.payment_transactions(id) ON DELETE CASCADE;


--
-- Name: refunds refunds_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.refunds
    ADD CONSTRAINT refunds_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: seo_settings seo_settings_updated_by_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.seo_settings
    ADD CONSTRAINT seo_settings_updated_by_users_id_fk FOREIGN KEY (updated_by) REFERENCES public.users(id);


--
-- Name: sip_audit_logs sip_audit_logs_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_audit_logs
    ADD CONSTRAINT sip_audit_logs_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: sip_calls sip_calls_agent_id_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_agent_id_agents_id_fk FOREIGN KEY (agent_id) REFERENCES public.agents(id);


--
-- Name: sip_calls sip_calls_campaign_id_campaigns_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_campaign_id_campaigns_id_fk FOREIGN KEY (campaign_id) REFERENCES public.campaigns(id);


--
-- Name: sip_calls sip_calls_contact_id_contacts_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_contact_id_contacts_id_fk FOREIGN KEY (contact_id) REFERENCES public.contacts(id);


--
-- Name: sip_calls sip_calls_sip_phone_number_id_sip_phone_numbers_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_sip_phone_number_id_sip_phone_numbers_id_fk FOREIGN KEY (sip_phone_number_id) REFERENCES public.sip_phone_numbers(id);


--
-- Name: sip_calls sip_calls_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_calls
    ADD CONSTRAINT sip_calls_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: sip_extension_assignments sip_extension_assignments_agent_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_agent_id_fkey FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE SET NULL;


--
-- Name: sip_extension_assignments sip_extension_assignments_assigned_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_assigned_by_fkey FOREIGN KEY (assigned_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: sip_extension_assignments sip_extension_assignments_sip_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_sip_extension_id_fkey FOREIGN KEY (sip_extension_id) REFERENCES public.sip_extensions(id) ON DELETE CASCADE;


--
-- Name: sip_extension_assignments sip_extension_assignments_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_assignments
    ADD CONSTRAINT sip_extension_assignments_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: sip_extension_requests sip_extension_requests_assignment_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_requests
    ADD CONSTRAINT sip_extension_requests_assignment_id_fkey FOREIGN KEY (assignment_id) REFERENCES public.sip_extension_assignments(id) ON DELETE SET NULL;


--
-- Name: sip_extension_requests sip_extension_requests_reviewed_by_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_requests
    ADD CONSTRAINT sip_extension_requests_reviewed_by_fkey FOREIGN KEY (reviewed_by) REFERENCES public.users(id) ON DELETE SET NULL;


--
-- Name: sip_extension_requests sip_extension_requests_sip_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_requests
    ADD CONSTRAINT sip_extension_requests_sip_extension_id_fkey FOREIGN KEY (sip_extension_id) REFERENCES public.sip_extensions(id) ON DELETE CASCADE;


--
-- Name: sip_extension_requests sip_extension_requests_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_extension_requests
    ADD CONSTRAINT sip_extension_requests_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: sip_phone_numbers sip_phone_numbers_agent_id_agents_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_phone_numbers
    ADD CONSTRAINT sip_phone_numbers_agent_id_agents_id_fk FOREIGN KEY (agent_id) REFERENCES public.agents(id) ON DELETE SET NULL;


--
-- Name: sip_phone_numbers sip_phone_numbers_sip_trunk_id_sip_trunks_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_phone_numbers
    ADD CONSTRAINT sip_phone_numbers_sip_trunk_id_sip_trunks_id_fk FOREIGN KEY (sip_trunk_id) REFERENCES public.sip_trunks(id) ON DELETE CASCADE;


--
-- Name: sip_phone_numbers sip_phone_numbers_trunk_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_phone_numbers
    ADD CONSTRAINT sip_phone_numbers_trunk_id_fkey FOREIGN KEY (trunk_id) REFERENCES public.sip_trunks(id) ON DELETE CASCADE;


--
-- Name: sip_phone_numbers sip_phone_numbers_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_phone_numbers
    ADD CONSTRAINT sip_phone_numbers_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: sip_usage_stats sip_usage_stats_sip_extension_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_usage_stats
    ADD CONSTRAINT sip_usage_stats_sip_extension_id_fkey FOREIGN KEY (sip_extension_id) REFERENCES public.sip_extensions(id) ON DELETE CASCADE;


--
-- Name: sip_usage_stats sip_usage_stats_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.sip_usage_stats
    ADD CONSTRAINT sip_usage_stats_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: team_activity_logs team_activity_logs_member_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_activity_logs
    ADD CONSTRAINT team_activity_logs_member_id_fkey FOREIGN KEY (member_id) REFERENCES public.team_members(id) ON DELETE SET NULL;


--
-- Name: team_activity_logs team_activity_logs_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_activity_logs
    ADD CONSTRAINT team_activity_logs_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.teams(id) ON DELETE CASCADE;


--
-- Name: team_permissions team_permissions_role_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_permissions
    ADD CONSTRAINT team_permissions_role_id_fkey FOREIGN KEY (role_id) REFERENCES public.team_roles(id) ON DELETE CASCADE;


--
-- Name: team_roles team_roles_team_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.team_roles
    ADD CONSTRAINT team_roles_team_id_fkey FOREIGN KEY (team_id) REFERENCES public.teams(id) ON DELETE CASCADE;


--
-- Name: teams teams_user_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.teams
    ADD CONSTRAINT teams_user_id_fkey FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: tools tools_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.tools
    ADD CONSTRAINT tools_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: usage_records usage_records_call_id_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.usage_records
    ADD CONSTRAINT usage_records_call_id_calls_id_fk FOREIGN KEY (call_id) REFERENCES public.calls(id) ON DELETE SET NULL;


--
-- Name: usage_records usage_records_subscription_id_user_subscriptions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.usage_records
    ADD CONSTRAINT usage_records_subscription_id_user_subscriptions_id_fk FOREIGN KEY (subscription_id) REFERENCES public.user_subscriptions(id) ON DELETE CASCADE;


--
-- Name: usage_records usage_records_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.usage_records
    ADD CONSTRAINT usage_records_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: user_addresses user_addresses_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_addresses
    ADD CONSTRAINT user_addresses_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: user_knowledge_storage_limits user_knowledge_storage_limits_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_knowledge_storage_limits
    ADD CONSTRAINT user_knowledge_storage_limits_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: user_kyc_documents user_kyc_documents_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.user_kyc_documents
    ADD CONSTRAINT user_kyc_documents_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: user_workflows user_workflows_workflow_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.user_workflows
    ADD CONSTRAINT user_workflows_workflow_id_fkey FOREIGN KEY (workflow_id) REFERENCES public.workflows_library(id) ON DELETE CASCADE;


--
-- Name: voices voices_user_id_users_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.voices
    ADD CONSTRAINT voices_user_id_users_id_fk FOREIGN KEY (user_id) REFERENCES public.users(id) ON DELETE CASCADE;


--
-- Name: webhook_deliveries webhook_deliveries_call_id_calls_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_deliveries
    ADD CONSTRAINT webhook_deliveries_call_id_calls_id_fk FOREIGN KEY (call_id) REFERENCES public.calls(id) ON DELETE SET NULL;


--
-- Name: webhook_deliveries webhook_deliveries_webhook_id_webhooks_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_deliveries
    ADD CONSTRAINT webhook_deliveries_webhook_id_webhooks_id_fk FOREIGN KEY (webhook_id) REFERENCES public.webhooks(id) ON DELETE CASCADE;


--
-- Name: webhook_logs webhook_logs_webhook_id_webhook_subscriptions_id_fk; Type: FK CONSTRAINT; Schema: public; Owner: agentlabs
--

ALTER TABLE ONLY public.webhook_logs
    ADD CONSTRAINT webhook_logs_webhook_id_webhook_subscriptions_id_fk FOREIGN KEY (webhook_id) REFERENCES public.webhook_subscriptions(id) ON DELETE CASCADE;


--
-- Name: workflows_library workflows_library_category_id_fkey; Type: FK CONSTRAINT; Schema: public; Owner: postgres
--

ALTER TABLE ONLY public.workflows_library
    ADD CONSTRAINT workflows_library_category_id_fkey FOREIGN KEY (category_id) REFERENCES public.categories(id) ON DELETE SET NULL;


--
-- Name: user_workflows Service role can access all user_workflows; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Service role can access all user_workflows" ON public.user_workflows USING ((current_setting('request.jwt.claim.role'::text, true) = 'service_role'::text));


--
-- Name: user_workflows Users can insert own user_workflows; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Users can insert own user_workflows" ON public.user_workflows FOR INSERT WITH CHECK ((user_id = current_setting('request.jwt.claim.user_id'::text, true)));


--
-- Name: user_workflows Users can update own user_workflows; Type: POLICY; Schema: public; Owner: postgres
--

CREATE POLICY "Users can update own user_workflows" ON public.user_workflows FOR UPDATE USING ((user_id = current_setting('request.jwt.claim.user_id'::text, true)));

--
-- Name: user_workflows; Type: ROW SECURITY; Schema: public; Owner: postgres
--

ALTER TABLE public.user_workflows ENABLE ROW LEVEL SECURITY;