import * as openapi3_ts_oas30_js from 'openapi3-ts/oas30.js';
import { ZodRawShape, ZodTypeAny, z } from 'zod';
import { OAuth2Client, OAuth2Fetch } from '@badgateway/oauth2-client';
import { SupabaseClient } from '@supabase/supabase-js';

declare module 'zod' {
    interface ZodType<Output, Def extends ZodTypeDef = ZodTypeDef, Input = Output> {
        openapi(options: any): this;
    }
    interface ZodObject<T extends ZodRawShape> {
        openapi(options: any): this;
    }
    interface ZodArray<T extends ZodTypeAny> {
        openapi(options: any): this;
    }
    interface ZodOptional<T extends ZodTypeAny> {
        openapi(options: any): this;
    }
    interface ZodNullable<T extends ZodTypeAny> {
        openapi(options: any): this;
    }
    interface ZodEnum<T extends [string, ...string[]]> {
        openapi(options: any): this;
    }
}

type Json = string | number | boolean | null | {
    [key: string]: Json | undefined;
} | Json[];
type Database = {
    public: {
        Tables: {
            accounts: {
                Row: {
                    avatar_url: string | null;
                    email: string | null;
                    full_name: string | null;
                    id: string;
                    phone_number: string | null;
                    updated_at: string | null;
                };
                Insert: {
                    avatar_url?: string | null;
                    email?: string | null;
                    full_name?: string | null;
                    id: string;
                    phone_number?: string | null;
                    updated_at?: string | null;
                };
                Update: {
                    avatar_url?: string | null;
                    email?: string | null;
                    full_name?: string | null;
                    id?: string;
                    phone_number?: string | null;
                    updated_at?: string | null;
                };
                Relationships: [];
            };
            api_keys: {
                Row: {
                    created_at: string | null;
                    hash: string;
                    id: string;
                    last_used_at: string | null;
                    prefix: string;
                    scopes: string[];
                    suffix: string;
                    team: string;
                    title: string;
                };
                Insert: {
                    created_at?: string | null;
                    hash: string;
                    id?: string;
                    last_used_at?: string | null;
                    prefix: string;
                    scopes?: string[];
                    suffix: string;
                    team: string;
                    title: string;
                };
                Update: {
                    created_at?: string | null;
                    hash?: string;
                    id?: string;
                    last_used_at?: string | null;
                    prefix?: string;
                    scopes?: string[];
                    suffix?: string;
                    team?: string;
                    title?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_api_keys_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            automation_runs: {
                Row: {
                    automation: string;
                    conditions_passed: boolean | null;
                    error: string | null;
                    id: string;
                    method: string;
                    recipient_emails: string[] | null;
                    run_at: string;
                    status: string;
                    team: string;
                    webhook_sent: boolean | null;
                };
                Insert: {
                    automation: string;
                    conditions_passed?: boolean | null;
                    error?: string | null;
                    id?: string;
                    method?: string;
                    recipient_emails?: string[] | null;
                    run_at?: string;
                    status: string;
                    team: string;
                    webhook_sent?: boolean | null;
                };
                Update: {
                    automation?: string;
                    conditions_passed?: boolean | null;
                    error?: string | null;
                    id?: string;
                    method?: string;
                    recipient_emails?: string[] | null;
                    run_at?: string;
                    status?: string;
                    team?: string;
                    webhook_sent?: boolean | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "automation_runs_automation_fkey";
                        columns: ["automation"];
                        isOneToOne: false;
                        referencedRelation: "automations";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_automation_runs_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            automations: {
                Row: {
                    condition_operator: string | null;
                    conditions: Json;
                    created_at: string;
                    dashboard: string;
                    description: string | null;
                    email_body: string;
                    email_cc: string[] | null;
                    email_subject: string;
                    email_to: string | null;
                    enabled: boolean;
                    id: string;
                    last_run_at: string | null;
                    last_updated_at: string;
                    method: string;
                    next_run_at: string | null;
                    output_format: string;
                    schedule: string;
                    team: string;
                    timezone: string;
                    title: string;
                    webhook_url: string | null;
                };
                Insert: {
                    condition_operator?: string | null;
                    conditions?: Json;
                    created_at?: string;
                    dashboard: string;
                    description?: string | null;
                    email_body: string;
                    email_cc?: string[] | null;
                    email_subject: string;
                    email_to?: string | null;
                    enabled?: boolean;
                    id?: string;
                    last_run_at?: string | null;
                    last_updated_at?: string;
                    method: string;
                    next_run_at?: string | null;
                    output_format: string;
                    schedule: string;
                    team: string;
                    timezone?: string;
                    title: string;
                    webhook_url?: string | null;
                };
                Update: {
                    condition_operator?: string | null;
                    conditions?: Json;
                    created_at?: string;
                    dashboard?: string;
                    description?: string | null;
                    email_body?: string;
                    email_cc?: string[] | null;
                    email_subject?: string;
                    email_to?: string | null;
                    enabled?: boolean;
                    id?: string;
                    last_run_at?: string | null;
                    last_updated_at?: string;
                    method?: string;
                    next_run_at?: string | null;
                    output_format?: string;
                    schedule?: string;
                    team?: string;
                    timezone?: string;
                    title?: string;
                    webhook_url?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "automations_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_automations_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            dashboard_datasources: {
                Row: {
                    dashboard: string;
                    datasource: string;
                    team: string;
                };
                Insert: {
                    dashboard: string;
                    datasource: string;
                    team: string;
                };
                Update: {
                    dashboard?: string;
                    datasource?: string;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "dashboard_datasources_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "dashboard_datasources_datasource_fkey";
                        columns: ["datasource"];
                        isOneToOne: false;
                        referencedRelation: "datasources";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_dashboard_datasources_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            dashboards: {
                Row: {
                    created_at: string;
                    created_by: string | null;
                    description: string | null;
                    filters: Json;
                    id: string;
                    last_updated_at: string;
                    last_updated_by: string | null;
                    metadata: Json;
                    parent_dashboard: string | null;
                    root_dashboard: string | null;
                    settings: Json;
                    sync_settings: Json | null;
                    tabs: Json;
                    team: string;
                    thumbnail: string | null;
                    title: string;
                };
                Insert: {
                    created_at?: string;
                    created_by?: string | null;
                    description?: string | null;
                    filters?: Json;
                    id?: string;
                    last_updated_at?: string;
                    last_updated_by?: string | null;
                    metadata?: Json;
                    parent_dashboard?: string | null;
                    root_dashboard?: string | null;
                    settings?: Json;
                    sync_settings?: Json | null;
                    tabs?: Json;
                    team: string;
                    thumbnail?: string | null;
                    title: string;
                };
                Update: {
                    created_at?: string;
                    created_by?: string | null;
                    description?: string | null;
                    filters?: Json;
                    id?: string;
                    last_updated_at?: string;
                    last_updated_by?: string | null;
                    metadata?: Json;
                    parent_dashboard?: string | null;
                    root_dashboard?: string | null;
                    settings?: Json;
                    sync_settings?: Json | null;
                    tabs?: Json;
                    team?: string;
                    thumbnail?: string | null;
                    title?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "dashboards_created_by_fkey";
                        columns: ["created_by"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "dashboards_last_updated_by_fkey";
                        columns: ["last_updated_by"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "dashboards_parent_dashboard_fkey";
                        columns: ["parent_dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "dashboards_root_dashboard_fkey";
                        columns: ["root_dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_dashboards_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            datasources: {
                Row: {
                    cache_duration: number;
                    columns: Json | null;
                    config: Json | null;
                    created_at: string;
                    created_by: string | null;
                    description: string | null;
                    filters: Json;
                    id: string;
                    integration: string | null;
                    last_updated_at: string;
                    last_updated_by: string | null;
                    metadata: Json;
                    method: Database["public"]["Enums"]["Datasource method"];
                    parameters: Json | null;
                    size: number;
                    source: string;
                    team: string;
                    title: string;
                };
                Insert: {
                    cache_duration?: number;
                    columns?: Json | null;
                    config?: Json | null;
                    created_at?: string;
                    created_by?: string | null;
                    description?: string | null;
                    filters?: Json;
                    id?: string;
                    integration?: string | null;
                    last_updated_at?: string;
                    last_updated_by?: string | null;
                    metadata?: Json;
                    method?: Database["public"]["Enums"]["Datasource method"];
                    parameters?: Json | null;
                    size?: number;
                    source: string;
                    team: string;
                    title: string;
                };
                Update: {
                    cache_duration?: number;
                    columns?: Json | null;
                    config?: Json | null;
                    created_at?: string;
                    created_by?: string | null;
                    description?: string | null;
                    filters?: Json;
                    id?: string;
                    integration?: string | null;
                    last_updated_at?: string;
                    last_updated_by?: string | null;
                    metadata?: Json;
                    method?: Database["public"]["Enums"]["Datasource method"];
                    parameters?: Json | null;
                    size?: number;
                    source?: string;
                    team?: string;
                    title?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "datasources_created_by_fkey";
                        columns: ["created_by"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "datasources_integration_fkey";
                        columns: ["integration"];
                        isOneToOne: false;
                        referencedRelation: "integrations";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "datasources_last_updated_by_fkey";
                        columns: ["last_updated_by"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_datasources_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            embed_users: {
                Row: {
                    created_at: string;
                    email: string | null;
                    id: string;
                    last_updated_at: string;
                    name: string;
                    parameters: Json | null;
                    team: string;
                };
                Insert: {
                    created_at?: string;
                    email?: string | null;
                    id: string;
                    last_updated_at?: string;
                    name: string;
                    parameters?: Json | null;
                    team: string;
                };
                Update: {
                    created_at?: string;
                    email?: string | null;
                    id?: string;
                    last_updated_at?: string;
                    name?: string;
                    parameters?: Json | null;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_embed_users_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            integration_tables: {
                Row: {
                    columns: Json | null;
                    config: Json;
                    dataset: string | null;
                    datasource: string | null;
                    description: string | null;
                    errors: string | null;
                    id: string;
                    integration: string;
                    rows: number;
                    size: number;
                    team: string;
                    title: string;
                };
                Insert: {
                    columns?: Json | null;
                    config?: Json;
                    dataset?: string | null;
                    datasource?: string | null;
                    description?: string | null;
                    errors?: string | null;
                    id?: string;
                    integration?: string;
                    rows?: number;
                    size?: number;
                    team: string;
                    title: string;
                };
                Update: {
                    columns?: Json | null;
                    config?: Json;
                    dataset?: string | null;
                    datasource?: string | null;
                    description?: string | null;
                    errors?: string | null;
                    id?: string;
                    integration?: string;
                    rows?: number;
                    size?: number;
                    team?: string;
                    title?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "integration_tables_datasource_fkey";
                        columns: ["datasource"];
                        isOneToOne: false;
                        referencedRelation: "datasources";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "integration_tables_integration_fkey";
                        columns: ["integration"];
                        isOneToOne: false;
                        referencedRelation: "integrations";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "integration_tables_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            integrations: {
                Row: {
                    config: Json;
                    created_at: string;
                    id: string;
                    parameters: Json | null;
                    provider: string;
                    size: number;
                    status: string;
                    team: string;
                    title: string | null;
                };
                Insert: {
                    config?: Json;
                    created_at?: string;
                    id?: string;
                    parameters?: Json | null;
                    provider: string;
                    size?: number;
                    status?: string;
                    team: string;
                    title?: string | null;
                };
                Update: {
                    config?: Json;
                    created_at?: string;
                    id?: string;
                    parameters?: Json | null;
                    provider?: string;
                    size?: number;
                    status?: string;
                    team?: string;
                    title?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_integrations_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            invites: {
                Row: {
                    created_at: string;
                    email: string;
                    name: string;
                    team: string;
                };
                Insert: {
                    created_at?: string;
                    email: string;
                    name: string;
                    team: string;
                };
                Update: {
                    created_at?: string;
                    email?: string;
                    name?: string;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_invites_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            llm_settings: {
                Row: {
                    analyst_agent_api_key: string | null;
                    analyst_agent_api_url: string | null;
                    analyst_agent_model: string;
                    analyst_agent_prompt: string | null;
                    analyst_agent_type: Database["public"]["Enums"]["LLM hosting type"];
                    programmer_agent_api_key: string | null;
                    programmer_agent_api_url: string | null;
                    programmer_agent_model: string;
                    programmer_agent_prompt: string | null;
                    programmer_agent_type: Database["public"]["Enums"]["LLM hosting type"];
                    team: string;
                    updated: boolean;
                };
                Insert: {
                    analyst_agent_api_key?: string | null;
                    analyst_agent_api_url?: string | null;
                    analyst_agent_model?: string;
                    analyst_agent_prompt?: string | null;
                    analyst_agent_type?: Database["public"]["Enums"]["LLM hosting type"];
                    programmer_agent_api_key?: string | null;
                    programmer_agent_api_url?: string | null;
                    programmer_agent_model?: string;
                    programmer_agent_prompt?: string | null;
                    programmer_agent_type?: Database["public"]["Enums"]["LLM hosting type"];
                    team: string;
                    updated?: boolean;
                };
                Update: {
                    analyst_agent_api_key?: string | null;
                    analyst_agent_api_url?: string | null;
                    analyst_agent_model?: string;
                    analyst_agent_prompt?: string | null;
                    analyst_agent_type?: Database["public"]["Enums"]["LLM hosting type"];
                    programmer_agent_api_key?: string | null;
                    programmer_agent_api_url?: string | null;
                    programmer_agent_model?: string;
                    programmer_agent_prompt?: string | null;
                    programmer_agent_type?: Database["public"]["Enums"]["LLM hosting type"];
                    team?: string;
                    updated?: boolean;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_llm_settings_team_fkey";
                        columns: ["team"];
                        isOneToOne: true;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            logs: {
                Row: {
                    account: string | null;
                    created_at: string;
                    dashboard: string | null;
                    embed_user: string | null;
                    id: string;
                    team: string | null;
                    type: string;
                    widget: string | null;
                };
                Insert: {
                    account?: string | null;
                    created_at?: string;
                    dashboard?: string | null;
                    embed_user?: string | null;
                    id?: string;
                    team?: string | null;
                    type: string;
                    widget?: string | null;
                };
                Update: {
                    account?: string | null;
                    created_at?: string;
                    dashboard?: string | null;
                    embed_user?: string | null;
                    id?: string;
                    team?: string | null;
                    type?: string;
                    widget?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_logs_account_fkey";
                        columns: ["account"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_logs_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_logs_embed_user_team_fkey";
                        columns: ["embed_user", "team"];
                        isOneToOne: false;
                        referencedRelation: "embed_users";
                        referencedColumns: ["id", "team"];
                    },
                    {
                        foreignKeyName: "public_logs_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_logs_widget_fkey";
                        columns: ["widget"];
                        isOneToOne: false;
                        referencedRelation: "widgets";
                        referencedColumns: ["id"];
                    }
                ];
            };
            members: {
                Row: {
                    account: string;
                    team: string;
                };
                Insert: {
                    account: string;
                    team: string;
                };
                Update: {
                    account?: string;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "members_user_fkey";
                        columns: ["account"];
                        isOneToOne: false;
                        referencedRelation: "accounts";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "public_members_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            messages: {
                Row: {
                    content: string | null;
                    created_at: string;
                    dashboard: string | null;
                    id: string;
                    question: string;
                    role: string | null;
                    team: string;
                    tool_call_id: string | null;
                    tool_calls: Json | null;
                    vote: Database["public"]["Enums"]["Vote type"] | null;
                    vote_reason: string | null;
                    widget: string | null;
                };
                Insert: {
                    content?: string | null;
                    created_at?: string;
                    dashboard?: string | null;
                    id?: string;
                    question?: string;
                    role?: string | null;
                    team: string;
                    tool_call_id?: string | null;
                    tool_calls?: Json | null;
                    vote?: Database["public"]["Enums"]["Vote type"] | null;
                    vote_reason?: string | null;
                    widget?: string | null;
                };
                Update: {
                    content?: string | null;
                    created_at?: string;
                    dashboard?: string | null;
                    id?: string;
                    question?: string;
                    role?: string | null;
                    team?: string;
                    tool_call_id?: string | null;
                    tool_calls?: Json | null;
                    vote?: Database["public"]["Enums"]["Vote type"] | null;
                    vote_reason?: string | null;
                    widget?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "messages_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "messages_question_fkey";
                        columns: ["question"];
                        isOneToOne: false;
                        referencedRelation: "questions";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "messages_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "messages_widget_fkey";
                        columns: ["widget"];
                        isOneToOne: false;
                        referencedRelation: "widgets";
                        referencedColumns: ["id"];
                    }
                ];
            };
            questions: {
                Row: {
                    created_at: string;
                    dashboard: string;
                    id: string;
                    messages: Json;
                    query: string;
                    team: string | null;
                };
                Insert: {
                    created_at?: string;
                    dashboard: string;
                    id?: string;
                    messages?: Json;
                    query: string;
                    team?: string | null;
                };
                Update: {
                    created_at?: string;
                    dashboard?: string;
                    id?: string;
                    messages?: Json;
                    query?: string;
                    team?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_questions_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "questions_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    }
                ];
            };
            self_hosting_settings: {
                Row: {
                    airtable_credentials: Json;
                    data_service_endpoint: string;
                    data_service_secret: string;
                    google_sheets_credentials: Json;
                    s3_credentials: Json;
                    team: string;
                };
                Insert: {
                    airtable_credentials: Json;
                    data_service_endpoint: string;
                    data_service_secret: string;
                    google_sheets_credentials: Json;
                    s3_credentials: Json;
                    team?: string;
                };
                Update: {
                    airtable_credentials?: Json;
                    data_service_endpoint?: string;
                    data_service_secret?: string;
                    google_sheets_credentials?: Json;
                    s3_credentials?: Json;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "self_hosting_settings_team_fkey";
                        columns: ["team"];
                        isOneToOne: true;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            sessions: {
                Row: {
                    created_at: string;
                    dashboard: string;
                    embed_user: string;
                    parameters: Json;
                    team: string;
                };
                Insert: {
                    created_at?: string;
                    dashboard: string;
                    embed_user: string;
                    parameters?: Json;
                    team: string;
                };
                Update: {
                    created_at?: string;
                    dashboard?: string;
                    embed_user?: string;
                    parameters?: Json;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_sessions_embed_user_team_fkey";
                        columns: ["embed_user", "team"];
                        isOneToOne: false;
                        referencedRelation: "embed_users";
                        referencedColumns: ["id", "team"];
                    },
                    {
                        foreignKeyName: "public_sessions_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "sessions_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    }
                ];
            };
            subscription_plans: {
                Row: {
                    accounts: number | null;
                    api_keys: boolean;
                    automations: boolean;
                    connected_datasources: number;
                    copilot: boolean;
                    custom_css: boolean;
                    custom_llm: boolean;
                    embed_users: number;
                    name: string;
                    watermark: boolean;
                };
                Insert: {
                    accounts?: number | null;
                    api_keys?: boolean;
                    automations?: boolean;
                    connected_datasources?: number;
                    copilot?: boolean;
                    custom_css?: boolean;
                    custom_llm?: boolean;
                    embed_users?: number;
                    name: string;
                    watermark?: boolean;
                };
                Update: {
                    accounts?: number | null;
                    api_keys?: boolean;
                    automations?: boolean;
                    connected_datasources?: number;
                    copilot?: boolean;
                    custom_css?: boolean;
                    custom_llm?: boolean;
                    embed_users?: number;
                    name?: string;
                    watermark?: boolean;
                };
                Relationships: [];
            };
            subscriptions: {
                Row: {
                    amount: number;
                    created_at: string;
                    currency: string;
                    integrations: string[];
                    interval: string;
                    period_end: string;
                    period_start: string;
                    product_name: string;
                    stripe_customer_id: string;
                    stripe_product_id: string;
                    stripe_subscription_id: string;
                    team: string;
                };
                Insert: {
                    amount: number;
                    created_at?: string;
                    currency: string;
                    integrations?: string[];
                    interval: string;
                    period_end: string;
                    period_start?: string;
                    product_name: string;
                    stripe_customer_id: string;
                    stripe_product_id: string;
                    stripe_subscription_id: string;
                    team: string;
                };
                Update: {
                    amount?: number;
                    created_at?: string;
                    currency?: string;
                    integrations?: string[];
                    interval?: string;
                    period_end?: string;
                    period_start?: string;
                    product_name?: string;
                    stripe_customer_id?: string;
                    stripe_product_id?: string;
                    stripe_subscription_id?: string;
                    team?: string;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_subscriptions_team_fkey";
                        columns: ["team"];
                        isOneToOne: true;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "subscriptions_product_name_fkey";
                        columns: ["product_name"];
                        isOneToOne: false;
                        referencedRelation: "subscription_plans";
                        referencedColumns: ["name"];
                    }
                ];
            };
            teams: {
                Row: {
                    created_at: string | null;
                    email: string | null;
                    id: string;
                    logo: string | null;
                    name: string | null;
                    phone_number: string | null;
                    stripe_id: string | null;
                };
                Insert: {
                    created_at?: string | null;
                    email?: string | null;
                    id?: string;
                    logo?: string | null;
                    name?: string | null;
                    phone_number?: string | null;
                    stripe_id?: string | null;
                };
                Update: {
                    created_at?: string | null;
                    email?: string | null;
                    id?: string;
                    logo?: string | null;
                    name?: string | null;
                    phone_number?: string | null;
                    stripe_id?: string | null;
                };
                Relationships: [];
            };
            widget_suggestions: {
                Row: {
                    created_at: string;
                    dashboard: string | null;
                    datasource_hash: string | null;
                    description: string | null;
                    id: string;
                    team: string | null;
                    title: string | null;
                    type: string | null;
                };
                Insert: {
                    created_at?: string;
                    dashboard?: string | null;
                    datasource_hash?: string | null;
                    description?: string | null;
                    id?: string;
                    team?: string | null;
                    title?: string | null;
                    type?: string | null;
                };
                Update: {
                    created_at?: string;
                    dashboard?: string | null;
                    datasource_hash?: string | null;
                    description?: string | null;
                    id?: string;
                    team?: string | null;
                    title?: string | null;
                    type?: string | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "widget_suggestions_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "widget_suggestions_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    }
                ];
            };
            widgets: {
                Row: {
                    code: string;
                    config: Json;
                    created_at: string;
                    dashboard: string;
                    drilldown_widget: string | null;
                    engine: string;
                    error: string | null;
                    id: string;
                    layouts: Json;
                    messages: Json;
                    settings: Json;
                    tab: number;
                    team: string;
                    title: string;
                    type: string;
                    use_in_chat: boolean;
                    use_in_library: boolean | null;
                };
                Insert: {
                    code: string;
                    config?: Json;
                    created_at?: string;
                    dashboard: string;
                    drilldown_widget?: string | null;
                    engine?: string;
                    error?: string | null;
                    id?: string;
                    layouts?: Json;
                    messages?: Json;
                    settings?: Json;
                    tab?: number;
                    team: string;
                    title: string;
                    type?: string;
                    use_in_chat?: boolean;
                    use_in_library?: boolean | null;
                };
                Update: {
                    code?: string;
                    config?: Json;
                    created_at?: string;
                    dashboard?: string;
                    drilldown_widget?: string | null;
                    engine?: string;
                    error?: string | null;
                    id?: string;
                    layouts?: Json;
                    messages?: Json;
                    settings?: Json;
                    tab?: number;
                    team?: string;
                    title?: string;
                    type?: string;
                    use_in_chat?: boolean;
                    use_in_library?: boolean | null;
                };
                Relationships: [
                    {
                        foreignKeyName: "public_widgets_team_fkey";
                        columns: ["team"];
                        isOneToOne: false;
                        referencedRelation: "teams";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "widgets_dashboard_fkey";
                        columns: ["dashboard"];
                        isOneToOne: false;
                        referencedRelation: "dashboards";
                        referencedColumns: ["id"];
                    },
                    {
                        foreignKeyName: "widgets_drilldown_widget_fkey";
                        columns: ["drilldown_widget"];
                        isOneToOne: false;
                        referencedRelation: "widgets";
                        referencedColumns: ["id"];
                    }
                ];
            };
        };
        Views: {
            [_ in never]: never;
        };
        Functions: {
            check_id_in_dashboards: {
                Args: {
                    id: string;
                    json_data: Json;
                };
                Returns: boolean;
            };
            get_onboarding: {
                Args: {
                    team_id: string;
                };
                Returns: Json;
            };
            string_to_uuid_array: {
                Args: {
                    input_string: string;
                };
                Returns: string[];
            };
            stripe_can_create_automation: {
                Args: {
                    organisation: string;
                };
                Returns: boolean;
            };
            stripe_can_create_dashboard_datasource: {
                Args: {
                    dashboard_id: string;
                    organisation: string;
                };
                Returns: boolean;
            };
            stripe_can_create_embed_user: {
                Args: {
                    organisation: string;
                };
                Returns: boolean;
            };
            stripe_can_create_invite: {
                Args: {
                    organisation: string;
                };
                Returns: boolean;
            };
            stripe_can_create_llm_settings: {
                Args: {
                    organisation: string;
                };
                Returns: boolean;
            };
            stripe_can_read_dashboard: {
                Args: {
                    organisation: string;
                };
                Returns: boolean;
            };
        };
        Enums: {
            "Datasource method": "table" | "query" | "ai";
            "LLM hosting type": "default" | "custom" | "openai" | "anthropic" | "groq" | "ollama" | "gemini" | "openrouter" | "ai-gateway";
            "Vote type": "up" | "down";
        };
        CompositeTypes: {
            [_ in never]: never;
        };
    };
};
type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">;
type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">];
type Tables<DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) | {
    schema: keyof DatabaseWithoutInternals;
}, TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"]) : never = never> = DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] & DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
    Row: infer R;
} ? R : never : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] & DefaultSchema["Views"]) ? (DefaultSchema["Tables"] & DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
    Row: infer R;
} ? R : never : never;
type TablesInsert<DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] | {
    schema: keyof DatabaseWithoutInternals;
}, TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] : never = never> = DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
    Insert: infer I;
} ? I : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
    Insert: infer I;
} ? I : never : never;
type TablesUpdate<DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] | {
    schema: keyof DatabaseWithoutInternals;
}, TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] : never = never> = DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
    Update: infer U;
} ? U : never : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"] ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
    Update: infer U;
} ? U : never : never;
type Enums<DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] | {
    schema: keyof DatabaseWithoutInternals;
}, EnumName extends DefaultSchemaEnumNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"] : never = never> = DefaultSchemaEnumNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName] : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"] ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions] : never;
type CompositeTypes<PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] | {
    schema: keyof DatabaseWithoutInternals;
}, CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"] : never = never> = PublicCompositeTypeNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals;
} ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName] : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"] ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions] : never;
declare const Constants: {
    readonly public: {
        readonly Enums: {
            readonly "Datasource method": readonly ["table", "query", "ai"];
            readonly "LLM hosting type": readonly ["default", "custom", "openai", "anthropic", "groq", "ollama", "gemini", "openrouter", "ai-gateway"];
            readonly "Vote type": readonly ["up", "down"];
        };
    };
};

type AnyObject = Record<string, any>;
type DeepPartialAny<T> = {
    [P in keyof T]?: T[P] extends AnyObject ? DeepPartialAny<T[P]> : any;
};
type Modify<A, B extends DeepPartialAny<A>> = {
    [K in keyof (A & B)]: K extends keyof B ? K extends keyof A ? A[K] extends AnyObject ? B[K] extends AnyObject ? Modify<A[K], B[K] & DeepPartialAny<A[K]>> : B[K] : B[K] : B[K] : K extends keyof A ? A[K] : never;
};
interface Metadata {
    label: string;
    value: string;
    secure?: boolean;
}
declare const MetadataItemZod: z.ZodObject<{
    label: z.ZodString;
    value: z.ZodString;
    secure: z.ZodOptional<z.ZodBoolean>;
}, "strip", z.ZodTypeAny, {
    label?: string;
    value?: string;
    secure?: boolean;
}, {
    label?: string;
    value?: string;
    secure?: boolean;
}>;

type Account = Database["public"]["Tables"]["accounts"]["Row"];
declare const AccountZod: any;

declare enum Table {
    Countries = "countries",
    Invites = "invites",
    ItineraryInvites = "itinerary_invites",
    Itineraries = "itineraries",
    Members = "members",
    Teams = "teams",
    Travelers = "travelers",
    Accounts = "accounts",
    DataSources = "datasources",
    EmbedUsers = "embed_users",
    APIKeys = "api_keys",
    Widgets = "widgets",
    Dashboards = "dashboards",
    DashboardDatasources = "dashboard_datasources",
    Sessions = "sessions",
    Questions = "questions",
    Integrations = "integrations",
    IntegrationTables = "integration_tables",
    DecryptedIntegrations = "decrypted_integrations",
    DecryptedSessions = "decrypted_sessions",
    DecryptedWidgets = "decrypted_widgets",
    DecryptedDatasources = "decrypted_datasources",
    Subscriptions = "subscriptions",
    SubscriptionPlans = "subscription_plans",
    Automations = "automations",
    AutomationRuns = "automation_runs",
    Logs = "logs",
    Messages = "messages",
    WidgetSuggestions = "widget_suggestions",
    LLMSettings = "llm_settings",
    SelfHostingSettings = "self_hosting_settings"
}

interface AirtableDatasourceConfig {
    baseId: string;
    tableId: string;
}
interface GoogleSheetDatasourceConfig {
    docId: string;
    sheetId: number;
}
interface APIDatasourceConfig {
    url?: string;
    interface?: "json" | "csv" | "xml";
    method?: "GET" | "POST";
    headers?: string;
    body?: string;
    transform?: string;
}
interface SnowflakeDatasourceConfig {
    account: string;
    username: string;
    password: string;
    warehouse: string;
    database: string;
    schema: string;
    query: string;
}
interface ClickhouseDatasourceConfig {
    url: string;
    pathname: string;
    username: string;
    password: string;
    database: string;
    query: string;
}
interface BigQueryDatasourceConfig {
    credentials: string;
    projectId: string;
    location: string;
    query: string;
}
interface CSVDatasourceConfig {
    url: string;
}
interface ExcelDatasourceConfig {
    url: string;
    sheetName?: string;
}
interface FirestoreDatasourceConfig {
    type: string;
    project_id: string;
    private_key_id: string;
    private_key: string;
    client_email: string;
    client_id: string;
    auth_uri: string;
    token_uri: string;
    auth_provider_x509_cert_url: string;
    client_x509_cert_url: string;
    universe_domain: string;
    databaseURL: string;
    collection?: string;
    subcollection?: string;
}
interface MongoDBDatasourceConfig {
    url: string;
    database: string;
    collection: string;
    query: string;
}
interface MsSQLDatasourceConfig {
    server: string;
    port: string;
    user: string;
    password: string;
    database: string;
    query: string;
}
interface ExternalConfig {
    schema: string;
    serviceAccount: string;
    table: string;
    query: string;
}
interface MySQLDatasourceConfig {
    host: string;
    user: string;
    port: string;
    password: string;
    database: string;
    ssh_enabled?: boolean;
    ssh_host?: string;
    ssh_username?: string;
    ssh_port?: string;
    ssh_private_key?: string;
    query: string;
}
interface PostgreSQLDatasourceConfig {
    host: string;
    port: string;
    database: string;
    user: string;
    password: string;
    ssl_enabled: boolean;
    query: string;
}
declare const __ensureFileIsEmitted = true;

type DashboardSyncSettings = {
    metadata: {
        all: false;
        include: string[];
    };
    settings: {
        all: false;
        include: string[];
    };
    tabs: {
        all: false;
        include: string[];
    };
    datasources: {
        all: false;
        include: string[];
    };
    widgets: {
        all: false;
        include: string[];
    };
};
declare const DashboardSyncSettingsZod: any;
declare const DEFAULT_SYNC_SETTINGS: {
    metadata: {
        all: boolean;
        include: any[];
    };
    settings: {
        all: boolean;
        include: any[];
    };
    tabs: {
        all: boolean;
        include: any[];
    };
    datasources: {
        all: boolean;
        include: any[];
    };
    widgets: {
        all: boolean;
        include: any[];
    };
};
type DashboardSettings = {
    filters: boolean;
    theme: "dark" | "light" | "auto";
    font: string;
    dark_background: string;
    dark_foreground: string;
    dark_text: string;
    light_background: string;
    light_foreground: string;
    light_text: string;
    hide_header: boolean;
    grid_spacing: number;
    grid_height: number;
    widget_border_radius: number;
    widget_padding: number;
    custom_css: string;
    enable_tabs: boolean;
    disable_widget_interactions?: boolean;
    copilot_enabled: boolean;
    copilot_title: string;
    copilot_description: string;
    help_url?: string;
    enable_advanced_widget_creator?: boolean;
    enable_widget_insights?: boolean;
    can_ask_questions: boolean;
    can_edit_widgets: boolean;
    can_edit_widget_layout: boolean;
    can_edit_tabs: boolean;
    can_create_widgets: boolean;
    can_delete_widgets: boolean;
    can_schedule_reports?: boolean;
    disable_download_images: boolean;
    disable_download_reports: boolean;
    disable_download_documents: boolean;
    pdf_orientation?: "portrait" | "landscape";
};
declare const DashboardSettingsZod: any;
type DashboardFilter = {
    label: string;
    type: "text";
    options: string[];
    values: string[];
} | {
    label: string;
    type: "number";
    options: [number, number];
    values: [number, number];
} | {
    label: string;
    type: "date";
    options: [string, string];
    values: [string, string];
    max_days?: number;
};
declare const DashboardFilterZod: any;
type DashboardTab = {
    id: number;
    label: string;
    hidden?: boolean;
};
declare const DashboardTabZod: any;
interface DashboardMeta {
    created_by: Account;
    last_updated_by?: Account;
    widgets: number;
    datasources: number;
    embed_user: EmbedUser;
}
declare const DashboardMetaZod: any;
type Dashboard = Modify<Database["public"]["Tables"]["dashboards"]["Row"], {
    settings?: DashboardSettings;
    filters: DashboardFilter[];
    tabs: DashboardTab[];
    metadata?: {
        label: string;
        value: string;
        secure?: boolean;
    }[];
    root_dashboard?: string | null;
    parent_dashboard?: string | null;
}>;
declare const DashboardZod: any;

interface AutomationCondition {
    operand_id: string;
    reference_type: "static" | "dynamic";
    reference_id?: string;
    reference_value?: string;
    operator: string;
}
declare const AutomationConditionZod: any;
type Automation = Modify<Database["public"]["Tables"]["automations"]["Row"], {
    conditions: AutomationCondition[];
}>;
declare const AutomationZod: any;
type AutomationRun = Database["public"]["Tables"]["automation_runs"]["Row"];
declare const AutomationRunZod: any;

declare enum LogType {
    ViewDashboard = "view-dashboard",
    EditDashboard = "edit-dashboard",
    CreateWidget = "create-widget",
    DeleteWidget = "delete-widget",
    EditWidget = "edit-widget"
}
type WidgetSettings = {
    css_id?: string;
    css_classnames?: string;
    link?: string;
};
interface DatasourceFilter {
    column: string;
    type: "text" | "number" | "date";
    label: string;
    max_days?: number;
}
type WidgetMessage = {
    role: "user" | "assistant";
    content: string;
};
type Message = Modify<Database["public"]["Tables"]["messages"]["Row"], {
    role: "user" | "assistant" | "tool";
    content?: string;
    tool_calls?: any[];
}>;
declare const MessageZod: any;
type Invite = Database["public"]["Tables"]["invites"]["Row"];
declare const InviteZod: any;
type Member = Database["public"]["Tables"]["members"]["Row"];
declare const MemberZod: any;
type Team = Database["public"]["Tables"]["teams"]["Row"];
declare const TeamZod: any;
type DatasourceMeta = {
    dashboards: number;
    integration: {
        id: string;
        title: string;
    };
    created_by: Account;
    last_updated_by?: Account;
};
type DataSource = Modify<Database["public"]["Tables"]["datasources"]["Row"], {
    columns: {
        title: string;
        description: string;
        type?: string;
        hidden?: boolean;
    }[];
    config: any;
    parameters: {
        id: string;
        wrap?: string;
        default: string;
    }[];
    filters: DatasourceFilter[];
    metadata?: Metadata[];
}>;
declare const DataSourceZod: any;
type EmbedUser = Modify<Database["public"]["Tables"]["embed_users"]["Row"], {
    parameters: Metadata[];
}>;
declare const EmbedUserZod: any;
type Subscription = Database["public"]["Tables"]["subscriptions"]["Row"];
declare const SubscriptionZod: any;
type SubscriptionPlan = Database["public"]["Tables"]["subscription_plans"]["Row"];
declare const SubscriptionPlanZod: any;
type APIKey = Database["public"]["Tables"]["api_keys"]["Row"];
declare const APIKeyZod: any;
type Widget = Modify<Database["public"]["Tables"]["widgets"]["Row"], {
    settings?: WidgetSettings;
    messages: WidgetMessage[];
    layouts: {
        lg: {
            x: number;
            y: number;
            w: number;
            h: number;
        };
        sm?: {
            x: number;
            y: number;
            w: number;
            h: number;
        };
    };
}>;
declare const WidgetZod: any;
type WidgetSuggestion = Database["public"]["Tables"]["widget_suggestions"]["Row"];
declare const WidgetSuggestionZod: any;
type DashboardDatasource = Database["public"]["Tables"]["dashboard_datasources"]["Row"];
declare const DashboardDatasourceZod: any;
type Session = Modify<Database["public"]["Tables"]["sessions"]["Row"], {
    parameters: Metadata[];
}>;
declare const SessionZod: any;
type Question = Database["public"]["Tables"]["questions"]["Row"];
declare const QuestionZod: any;
type IntegrationMeta = {
    integration_tables: number;
    datasources: number;
};
type Integration = Modify<Database["public"]["Tables"]["integrations"]["Row"], {
    config: any;
    parameters: {
        id: string;
        wrap?: string;
        default: string;
    }[];
}>;
declare const IntegrationZod: any;
type IntegrationTable = Modify<Database["public"]["Tables"]["integration_tables"]["Row"], {
    columns: any[];
}>;
declare const IntegrationTableZod: any;
declare const LLMHostingTypeZod: z.ZodEnum<["default", "custom"]>;
type LLMSettings = Database["public"]["Tables"]["llm_settings"]["Row"];
declare const LLMSettingsZod: any;
type SelfHostingSettings = Database["public"]["Tables"]["self_hosting_settings"]["Row"];
declare const SelfHostingSettingsZod: any;
type Log = Database["public"]["Tables"]["logs"]["Row"];
declare const LogZod: any;
declare const OpenApiComponents: Pick<openapi3_ts_oas30_js.OpenAPIObject, "components">;

type OauthConfig = {
    access_token: string;
    refresh_token: string;
    access_expires_at: string;
};
declare class BaseOauthClient {
    id: string;
    provider: string;
    teamId: string;
    baseUrl: string;
    authorizationEndpoint: string;
    tokenEndpoint: string;
    scopes: string[];
    extraParams: Record<string, string>;
    authenticationMethod: string;
    clientId: string;
    clientSecret: string;
    scope: string;
    refreshToken: string;
    oauthClient: OAuth2Client;
    fetcher: OAuth2Fetch;
    supabaseClient: SupabaseClient<Database>;
    constructor(team: string, supabaseClient: SupabaseClient<Database>, id: string, credentials?: {
        clientId: string;
        clientSecret: string;
    });
    initializeOauthClient(): void;
    startAuthFlow(): Promise<{
        url: string;
        code_verifier: string;
        state: string;
    }>;
    completeAuthFlow(req: any): Promise<any>;
}

declare class AirtableOauthClient extends BaseOauthClient {
    provider: string;
    baseUrl: string;
    clientId: string;
    clientSecret: string;
    authorizationEndpoint: string;
    tokenEndpoint: string;
    scopes: string[];
    constructor(team: string, supabaseClient: any, id: string, credentials?: {
        clientId: string;
        clientSecret: string;
    });
    getRecords(baseId: string, tableId: string): Promise<any[]>;
}

declare class GoogleSheetsOauthClient extends BaseOauthClient {
    provider: string;
    baseUrl: string;
    authorizationEndpoint: string;
    tokenEndpoint: string;
    clientId: string;
    clientSecret: string;
    scopes: string[];
    extraParams: {
        access_type: string;
        prompt: string;
    };
    constructor(team: string, supabaseClient: any, id: string, credentials?: {
        clientId: string;
        clientSecret: string;
    });
    getRecords(docId: string, sheetName: string): Promise<Response>;
}

declare const OauthClients: {
    [key: string]: typeof BaseOauthClient;
};

interface JobUpdateEvent {
    job: {
        id: string;
        name: string;
        queue: string;
    };
    status: "waiting" | "progress" | "completed" | "error";
    data?: any;
    progress?: {
        total: number;
        completed: number;
    };
}
declare class OnvoBase {
    #private;
    _endpoint: string;
    /**
     * Fetches data from the API.
     * @param url - The URL to fetch data from.
     * @param method - The HTTP method to use. Defaults to "GET".
     * @param body - The data to send with the request.
     * @param isForm - Indicates if the request is a form request.
     * @returns The response from the API.
     * @throws {Error} If there is an error making the request.
     */
    _fetchBase(url: string, method?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH", body?: any, isForm?: boolean): Promise<any>;
    _fetchStreamBase(url: string, method?: "GET" | "PUT" | "POST" | "DELETE" | "PATCH", body?: any, onProgress?: (event: JobUpdateEvent) => void): Promise<any>;
    /**
     * Fetches a Blob from the API.
     * @param url - The URL to fetch data from.
     * @returns The response from the API as a Blob.
     * @throws {Error} If there is an error making the request.
     */
    _fetchBlob(url: string): Promise<Blob>;
    constructor(apiKey: string, options?: {
        endpoint: string;
    });
}

/**
 * Endpoints for managing accounts.
 */
declare class OnvoAccounts extends OnvoBase {
    /**
     * Fetches a list of accounts.
     *
     * @return {Promise<Account[]>} A promise that resolves to an array of Account objects.
     */
    list(): Promise<Account[]>;
    /**
     * Fetches a specific account by ID.
     *
     * @param {string} id - The ID of the account to fetch.
     * @return {Promise<Account>} A promise that resolves to an Account object.
     */
    get(id: string): Promise<Account>;
}

declare class OnvoTeams extends OnvoBase {
    /**
     * Retrieves a list of all teams.
     * @returns {Promise<Team[]>} A promise that resolves to an array of Team objects.
     */
    list(): Promise<Team[]>;
    /**
     * Retrieves a specific team by ID.
     * @param {string} id - The ID of the team to retrieve.
     * @returns {Promise<Team>} A promise that resolves to the Team object.
     */
    get(id: string): Promise<Team>;
    /**
     * Updates a specific team.
     * @param {string} id - The ID of the team to update.
     * @param {Partial<Team>} body - The updated team data.
     * @returns {Promise<Team>} A promise that resolves to the updated Team object.
     */
    update(id: string, body: Partial<Team>): Promise<Team>;
    /**
     * Creates a new team and associates it with an account.
     * @param {string} accountId - The ID of the account to associate with the team.
     * @param {Partial<Team>} teamData - The data for the new team.
     * @returns {Promise<Team>} A promise that resolves to the created Team object.
     * @throws Will throw an error if the request fails.
     */
    create(accountId: string, teamData: Partial<Team>): Promise<Team>;
}

declare class OnvoEmbedUsers extends OnvoBase {
    /**
     * Retrieves a list of embed users.
     * @returns {Promise<EmbedUser[]>} A promise that resolves to an array of embed users.
     */
    list(): Promise<EmbedUser[]>;
    /**
     * Retrieves an embed user by ID.
     * @param {string} id - The ID of the embed user.
     * @returns {Promise<EmbedUser>} A promise that resolves to the embed user.
     */
    get(id: string): Promise<EmbedUser>;
    /**
     * Deletes an embed user by ID.
     * @param {string} id - The ID of the embed user.
     * @returns {Promise<{ success: boolean }>} A promise that resolves to an object indicating success.
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
    /**
     * Creates or updates an embed user.
     * @param {string} userId - The ID of the embed user.
     * @param {Object} userData - The data for the embed user.
     * @param {string} userData.name - The name of the embed user.
     * @param {string} userData.email - The email of the embed user.
     * @param {Object} [userData.parameters] - Additional parameters for the embed user.
     * @returns {Promise<EmbedUser>} A promise that resolves to the created or updated embed user.
     */
    upsert(userId: string, userData: {
        name: string;
        email: string | null | undefined;
        parameters?: {
            [key: string]: any;
        };
    }): Promise<EmbedUser>;
}

declare class OnvoDatasources extends OnvoBase {
    /**
     * Lists all the datasources.
     * @returns {Promise<(DataSource & {_meta: DatasourceMeta})[]>} A promise that resolves to an array of datasources.
     */
    list(filters?: {
        dashboard?: string;
        integration?: string;
    }): Promise<(DataSource & {
        _meta: DatasourceMeta;
    })[]>;
    /**
     * Gets a datasource by ID.
     * @param {string} id - The ID of the datasource.
     * @returns {Promise<(DataSource & {_meta: DatasourceMeta})>} A promise that resolves to the datasource.
     */
    get(id: string): Promise<DataSource & {
        _meta: DatasourceMeta;
    }>;
    /**
     * Deletes a datasource by ID.
     * @param {string} id - The ID of the datasource.
     * @returns {Promise<{ success: boolean }>} A promise that resolves to an object indicating the success of the deletion.
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
    /**
     * Updates a datasource by ID.
     * @param {string} id - The ID of the datasource.
     * @param {Partial<DataSource>} body - The updated datasource object.
     * @returns {Promise<DataSource>} A promise that resolves to the updated datasource.
     */
    update(id: string, body: Partial<DataSource>): Promise<DataSource>;
    /**
     * Creates a new datasource.
     * @param {Omit<DataSource, "id" | "created_at" | "created_by" | "last_updated_at" | "last_updated_by" | "size" | "team">} body - The new datasource object.
     * @returns {Promise<DataSource>} A promise that resolves to the created datasource.
     */
    create(body: Omit<DataSource, "id" | "created_at" | "created_by" | "last_updated_at" | "last_updated_by" | "size" | "team">): Promise<DataSource>;
}

declare class OnvoAutomations extends OnvoBase {
    /**
     * Fetches all the automations
     * @returns {Promise<Automation[]>} A promise that resolves to an array of Automation objects
     */
    list(filters?: {
        dashboard: string;
    }): Promise<Automation[]>;
    /**
     * Fetches an automation by its ID
     * @param {string} id - The ID of the automation
     * @returns {Promise<Automation>} A promise that resolves to an Automation object
     */
    get(id: string): Promise<Automation>;
    /**
     * Deletes an automation by its ID
     * @param {string} id - The ID of the automation
     * @returns {Promise<{ success: boolean }>} A promise that resolves to an object with a success field
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
    /**
     * Updates an automation by its ID
     * @param {string} id - The ID of the automation
     * @param {Partial<Automation>} body - The updated automation data
     * @returns {Promise<Automation>} A promise that resolves to an Automation object
     */
    update(id: string, body: Partial<Automation>): Promise<Automation>;
    /**
     * Creates a new automation
     * @param {Partial<Automation>} body - The automation data
     * @returns {Promise<Automation>} A promise that resolves to an Automation object
     */
    create(body: Partial<Automation>): Promise<Automation>;
}

declare class OnvoDashboards extends OnvoBase {
    /**
     * Lists all the dashboards.
     *
     * @param {Object} filters - The filters to apply to the list.
     * @param {string} filters.parent_dashboard - The ID of the parent dashboard.
     * @param {string} filters.root_dashboard - The ID of the root dashboard.
     * @return {Promise<(Dashboard & {_meta: DashboardMeta})[]>} A promise that resolves to an array of dashboards.
     */
    list(filters?: {
        parent_dashboard?: string;
        root_dashboard?: string;
    }): Promise<(Dashboard & {
        _meta: DashboardMeta;
    })[]>;
    /**
     * Gets a dashboard by ID.
     *
     * @param {string} id - The ID of the dashboard.
     * @return {Promise<Dashboard>} A promise that resolves to the dashboard.
     */
    get(id: string): Promise<Dashboard & {
        _meta: DashboardMeta;
    }>;
    /**
     * Deletes a dashboard by ID.
     *
     * @param {string} id - The ID of the dashboard.
     * @return {Promise<{ success: true }>} A promise that resolves to an object indicating the success of the deletion.
     */
    delete(id: string): Promise<{
        success: true;
    }>;
    /**
     * Updates a dashboard by ID.
     *
     * @param {string} id - The ID of the dashboard.
     * @param {Partial<Dashboard>} body - The updated dashboard data.
     * @return {Promise<Dashboard>} A promise that resolves to the updated dashboard.
     */
    update(id: string, body: Partial<Dashboard>): Promise<Dashboard>;
    /**
     * Creates a new dashboard.
     *
     * @param {Omit<Dashboard, "id" | "created_at" | "created_by" | "last_updated_at" | "last_updated_by" | "thumbnail" | "team">} body - The dashboard data.
     * @return {Promise<Dashboard>} A promise that resolves to the created dashboard.
     */
    create(body: Omit<Dashboard, "id" | "created_at" | "created_by" | "last_updated_at" | "last_updated_by" | "thumbnail" | "team">): Promise<Dashboard>;
}

declare class OnvoDashboardDatasources extends OnvoBase {
    #private;
    constructor(dashboardId: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Unlinks a datasource from a dashboard.
     *
     * @param {string} datasourceId - The ID of the datasource to unlink.
     * @return {Promise<{ success: boolean }>} A promise that resolves to an object indicating the success of the unlink operation.
     */
    unlink(datasourceId: string): Promise<{
        success: boolean;
    }>;
    /**
     * Links a datasource to a dashboard.
     *
     * @param {string} datasourceId - The ID of the datasource to link.
     * @return {Promise<DashboardDatasource>} A promise that resolves to the linked dashboard datasource.
     */
    link(datasourceId: string): Promise<DashboardDatasource>;
    /**
     * Links a datasource to a dashboard.
     *
     * @param {array} datasourceIds - The IDs of the datasources to link.
     * @return {Promise<DashboardDatasource>} A promise that resolves to the linked dashboard datasource.
     */
    linkMultiple(datasourceIds: string[]): Promise<DashboardDatasource>;
}

declare class OnvoWidgetSuggestions extends OnvoBase {
    #private;
    constructor(dashboardId: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Links a datasource to a dashboard.
     *
     * @return {Promise<WidgetSuggestion[]>} A promise that resolves to the linked dashboard datasource.
     */
    list(): Promise<WidgetSuggestion[]>;
    /**
     * Links a datasource to a dashboard.
     *
     * @param {string} id - The ID of the widget suggestion to delete.
     * @return {Promise<{ success: boolean }>} A promise that resolves to the linked dashboard datasource.
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
}

declare class OnvoDashboard extends OnvoBase {
    #private;
    datasources: OnvoDashboardDatasources;
    widgetSuggestions: OnvoWidgetSuggestions;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Updates the widget cache for the dashboard.
     *
     * @return {Promise<{success: boolean, id: string}>} A promise that resolves to an object containing the success and id of the widget.
     */
    updateCache(callback?: (event: JobUpdateEvent) => void, options?: {
        rejectCache?: boolean;
        rejectFilterCache?: boolean;
    }): Promise<Dashboard & {
        _meta: {
            status: string;
            url: string;
            total?: number;
            completed?: number;
        };
    }>;
    /**
     * Exports the dashboard in the specified format.
     *
     * @param {("csv" | "xlsx" | "pdf" | "png" | "jpeg")} format - The format to export the dashboard in.
     * @return {Promise<Blob>} A promise that resolves to a Blob representing the exported dashboard.
     */
    export(format: "csv" | "xlsx" | "pdf" | "png" | "jpeg" | "pptx", theme?: "light" | "dark", tab?: number, onProgress?: (event: JobUpdateEvent) => void): Promise<any>;
    /**
   * Duplicates the dashboard.
   *
   * @return {Promise<{id: string}>} A promise that resolves to an object containing the id of the duplicated dashboard.
   */
    duplicate(): Promise<{
        id: string;
    }>;
    /**
     * Summarizes the dashboard using the provided prompt.
     *
     * @param {string} prompt - The prompt to use for summarizing the dashboard.
     * @return {Promise<{title: string, description: string}>} A promise that resolves to an object containing the title and description of the summarized dashboard.
     */
    summarize(prompt: string): Promise<{
        title: string;
        description: string;
    }>;
    /**
     * Synchronizes the dashboard with the latest data and settings.
     *
     * @return {Promise<any>} A promise that resolves with the sync result
     */
    sync(): Promise<any>;
    generateWidgetSuggestions(): Promise<WidgetSuggestion[]>;
}

declare class OnvoEmbedUser extends OnvoBase {
    #private;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Retrieves an access token for the embed user.
     *
     * @return {Promise<{ user: string; token: string }>} A promise that resolves to an object containing the user ID and the access token.
     */
    getAccessToken(): Promise<{
        user: string;
        token: string;
    }>;
}

declare class OnvoDatasource extends OnvoBase {
    #private;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Initializes the data source.
     * @returns {Promise<{ success: boolean }>} A promise that resolves to an object with a success property.
     */
    initialize(callback?: (event: JobUpdateEvent) => void): Promise<{
        success: boolean;
    }>;
    /**
     * Initializes the data source query.
     * @param {string} prompt - The prompt for the data source query.
     * @returns {Promise<{ query: string }>} A promise that resolves to an object with a success property.
     */
    generateQuery(prompt: string, callback?: (event: JobUpdateEvent) => void): Promise<{
        query: string;
    }>;
    /**
     * Uploads a file to the data source.
     * @param {File} file - The file to upload.
     * @returns {Promise<DataSource>} A promise that resolves to the data source object.
     */
    uploadFile(file: File): Promise<DataSource>;
    /**
     * Retrieves the sample data from the data source.
     * @returns {Promise<any[]>} A promise that resolves to an array of sample data.
     */
    sample(): Promise<any[]>;
    /**
   * Retrieves the export data from the data source.
   * @returns {Promise<{url:string}>} A promise that resolves to an object with a url property.
   */
    export(callback?: (event: JobUpdateEvent) => void): Promise<{
        url: string;
    }>;
    /**
  * Retrieves the dashboards connected to the data source.
  * @returns {Promise<(Dashboard & { _meta: DashboardMeta })[]>} A promise that resolves to an array of dashboards.
  */
    dashboards(): Promise<(Dashboard & {
        _meta: DashboardMeta;
    })[]>;
}

declare class OnvoQuestions extends OnvoBase {
    /**
     * Lists all questions for a given dashboard.
     *
     * @param {Object} filters - The filters to apply to the question list.
     * @param {string} filters.dashboard - The ID of the dashboard to list questions for.
     * @returns {Promise<Question[]>} A promise that resolves to an array of questions.
     */
    list(filters: {
        dashboard: string;
    }): Promise<Question[]>;
    /**
     * Creates a new question.
     *
     * @param {Object} payload - The payload for the question creation.
     * @param {string} payload.query - The query string for the question.
     * @param {string} payload.dashboard - The ID of the dashboard to create the question in.
     * @returns {Promise<Question & { _meta: {status: string, url: string} }>} A promise that resolves to the created question.
     */
    create(payload: {
        query: string;
        dashboard: string;
    }): Promise<Question & {
        _meta: {
            status: string;
            url: string;
        };
    }>;
    /**
     * Deletes a question.
     *
     * @param {string} id - The ID of the question to delete.
     * @returns {Promise<{ success: boolean }>} A promise that resolves to an object indicating success.
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
    /**
     * Updates a question.
     *
     * @param {string} id - The ID of the question to update.
     * @param {Partial<Question>} body - The updated question data.
     * @returns {Promise<Question>} A promise that resolves to the updated question.
     */
    update(id: string, body: Partial<Question>): Promise<Question>;
}

declare class OnvoAutomation extends OnvoBase {
    #private;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Fetches all the runs of the automation
     * @returns {Promise<AutomationRun[]>} A promise that resolves to an array of AutomationRun objects
     */
    getRuns(): Promise<AutomationRun[]>;
    /**
     * Tests the automation to see if it runs successfully
     * @returns {Promise<{success: boolean}>} A promise that resolves to a status of successful or not
     */
    test(onProgress?: (event: JobUpdateEvent) => void): Promise<{
        success: boolean;
    }>;
}

interface WidgetCacheResponse {
    data: any;
    pagination: {
        page: number;
        pageSize: number;
        totalPages: number;
        totalRows: number;
    };
}
declare class OnvoWidget extends OnvoBase {
    #private;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Exports the widget in the specified format.
     *
     * @param {("svg" | "csv" | "xlsx" | "png" | "jpeg")} format - The format to export the widget in.
     * @return {Promise<Blob>} A promise that resolves to a Blob representing the exported widget.
     */
    export(format: "svg" | "csv" | "xlsx" | "png" | "jpeg", theme?: "light" | "dark", callback?: (event: JobUpdateEvent) => void): Promise<Blob>;
    /**
     * Returns the cached widget data.
     *
     * @param {Object} [props] - Configuration options
     * @param {boolean} [props.raw] - Whether to return raw data
     * @param {number} [props.page] - Page number for pagination
     * @param {number} [props.pageSize] - Number of items per page
     * @param {string} [props.sortField] - Field to sort by
     * @param {'asc'|'desc'} [props.sortDirection] - Sort direction
     * @return {Promise<WidgetCacheResponse>} A promise that resolves to the cached widget data with pagination information.
     */
    cache(props?: {
        raw?: boolean;
        page?: number;
        pageSize?: number;
        sortField?: string;
        sortDirection?: 'asc' | 'desc';
    }): Promise<WidgetCacheResponse>;
    /**
     * Updates the prompts for the widget.
     *
     * @param {Array<{ role: "user" | "assistant"; content: String }>} messages - The new prompts for the widget.
     * @return {Promise<Widget>} A promise that resolves to the updated widget.
     */
    updatePrompts(messages: {
        role: "user" | "assistant";
        content: String;
    }[], callback?: (event: JobUpdateEvent) => void): Promise<Widget>;
    /**
     * Executes the given code in the widget.
     *
     * @return {Promise<Widget & { _meta: { status: string, url: string, total?: number, completed?: number } }>} A promise that resolves to the result of executing the code.
     */
    updateCache(callback?: (event: JobUpdateEvent) => void): Promise<Widget & {
        _meta: {
            status: string;
            url: string;
            total?: number;
            completed?: number;
        };
    }>;
    /**
     * Annotates the code of the widget.
     *
     * @return {Promise<Widget & { _meta: { status: string, url: string, total?: number, completed?: number } }>} A promise that resolves to the result of annotating the code.
     */
    annotateCode(callback?: (event: JobUpdateEvent) => void): Promise<{
        insights: string;
    } & {
        _meta: {
            status: string;
            url: string;
            total?: number;
            completed?: number;
        };
    }>;
}

declare class OnvoSessions extends OnvoBase {
    /**
     * Lists all sessions for a given dashboard
     * @param filters - Object containing the parent_dashboard field
     * @returns Promise of an array of Session objects
     */
    list(filters: {
        parent_dashboard?: string;
        embed_user?: string;
    }): Promise<(Session & {
        dashboard: Dashboard;
        embed_user: EmbedUser;
    })[]>;
    /**
     * Gets a specific session by its dashboard id
     * @param filters - Object containing the dashboard field
     * @returns Promise of a Session object
     */
    get(filters: {
        dashboard: string;
    }): Promise<Session & {
        embed_user: EmbedUser;
        dashboard: Dashboard;
    }>;
    /**
     * Revokes a session by its dashboard id
     * @param filters - Object containing the dashboard field
     * @returns Promise of an object with a success field
     */
    revoke(filters: {
        dashboard: string;
    }): Promise<{
        success: true;
    }>;
    /**
     * Revokes all sessions for a given dashboard
     * @param filters - Object containing the parent_dashboard field
     * @returns Promise of an object with a success field
     */
    revokeAll(filters: {
        parent_dashboard: string;
    }): Promise<{
        success: true;
    }>;
    /**
     * Creates or updates a session for a given embed_user
     * @param filters - Object containing the embed_user, parent_dashboard and parameters fields
     * @returns Promise of a Session object with additional url and token fields
     */
    upsert({ embed_user, parent_dashboard, parameters, }: {
        embed_user: string;
        parent_dashboard: string;
        parameters?: {
            [key: string]: any;
        };
    }): Promise<Session & {
        url: string;
        token: string;
    }>;
}

declare class OnvoWidgets extends OnvoBase {
    /**
     * Retrieves a list of widgets for a given dashboard.
     *
     * @param {Object} filters - Filters for the widgets.
     * @param {string} filters.dashboard - The ID of the dashboard to retrieve widgets for.
     * @return {Promise<Widget[]>} A promise that resolves to an array of widgets.
     */
    list(filters: {
        dashboard: string;
        use_in_library?: boolean;
    }): Promise<Widget[]>;
    /**
     * Retrieves a specific widget by its ID.
     *
     * @param {string} id - The ID of the widget to retrieve.
     * @return {Promise<Widget>} A promise that resolves to the widget.
     */
    get(id: string): Promise<Widget>;
    /**
     * Deletes a widget by its ID.
     *
     * @param {string} id - The ID of the widget to delete.
     * @return {Promise<{success: boolean}>} A promise that resolves to an object indicating success.
     */
    delete(id: string): Promise<{
        success: boolean;
    }>;
    /**
     * Updates a widget by its ID.
     *
     * @param {string} id - The ID of the widget to update.
     * @param {Partial<Widget>} body - The updated widget data.
     * @return {Promise<Widget>} A promise that resolves to the updated widget.
     */
    update(id: string, body: Partial<Widget>): Promise<Widget>;
    /**
     * Creates a new widget.
     *
     * @param {Omit<Widget, "id" | "created_at">} body - The widget data to create, excluding the ID and creation timestamp.
     * @param {any} [cache] - Optional cache data to include with the request.
     * @return {Promise<Widget>} A promise that resolves to the newly created widget.
     */
    create(body: Omit<Widget, "id" | "created_at">, cache?: any): Promise<Widget>;
}

declare class OnvoQuestion extends OnvoBase {
    #private;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Retrieves the messages for the question.
     *
     * @return {Promise<Message[]>} A promise that resolves to an array of messages.
     */
    getMessages(): Promise<Message[]>;
    /**
     * Updates the messages for the question.
     *
     * @param {string} content - The text content to update.
     * @return {Promise<Message & { _meta: {status: string, url: string} }>} A promise that resolves to the updated message.
     */
    completion(content: string, onEvent?: (event: JobUpdateEvent) => void): Promise<Message & {
        _meta: {
            status: string;
            url: string;
        };
    }>;
    /**
     * Updates a message for the question.
     *
     * @param {string} messageId - The id of the message to update.
     * @param {string} content - The content of the message to update.
     * @return {Promise<Message & { _meta: {status: string, url: string} }>} A promise that resolves to the updated message.
     */
    updateMessage(messageId: string, content: string, onEvent?: (event: JobUpdateEvent) => void): Promise<Message & {
        _meta: {
            status: string;
            url: string;
        };
    }>;
    /**
     * Votes on a message.
     *
     * @param {string} messageId - The id of the message to vote on.
     * @param {('up' | 'down')} vote - The vote to cast.
     * @param {string} [reason] - The reason for the vote.
     * @returns {Promise<Message>} A promise that resolves to the updated message.
     */
    voteMessage(messageId: string, vote: 'up' | 'down', reason?: string): Promise<Message>;
}

declare class OnvoUtils extends OnvoBase {
    /**
     * Uploads a file to a given bucket
     *
     * @param {Object} filters - The filters to apply to the question list.
     * @param {string} filters.dashboard - The ID of the dashboard to list questions for.
     * @returns {Promise<Question[]>} A promise that resolves to an array of questions.
     */
    uploadFile(file: File): Promise<{
        url: string;
    }>;
    /**
     * Triggers the agent test and waits for completion via WebSocket.
     * If the server responds 202 with socket info, this method connects automatically
     * and resolves when 'job.completed' is received, or rejects on 'job.error'.
     */
    testAgent(agent: "programmer" | "analyst", onProgress?: (event: any) => void): Promise<any>;
}

declare class OnvoLogs extends OnvoBase {
    /**
     * Lists all logs for a given dashboard.
     *
     * @returns {Promise<Log[]>} A promise that resolves to an array of logs.
     */
    list(): Promise<Log[]>;
    /**
     * Creates a new log.
     *
     * @param {Object} payload - The payload for the log creation.
     * @param {string} payload.type - The type of log to create.
     * @param {string} payload.dashboard - The ID of the dashboard to create the log for.
     * @param {string} payload.widget - The ID of the widget to create the log for.
     * @returns {Promise<Log>} A promise that resolves to the created log.
     */
    create(payload: {
        type: LogType;
        dashboard: string;
        widget?: string;
    }): Promise<Log>;
}

/**
 * Class representing operations related to integrations.
 * Extends the base Onvo class to provide integration-specific functionality.
 */
declare class OnvoIntegrations extends OnvoBase {
    /**
     * Lists all available integrations.
     * @returns {Promise<(Integration & {_meta: IntegrationMeta})[]>} A promise that resolves to an array of integration objects.
     */
    list(): Promise<(Integration & {
        _meta: IntegrationMeta;
    })[]>;
    /**
     * Retrieves a specific integration by ID.
     * @param {string} id - The ID of the integration to retrieve.
     * @returns {Promise<(Integration & {_meta: IntegrationMeta})>} A promise that resolves to the integration object.
     */
    get(id: string): Promise<(Integration & {
        _meta: IntegrationMeta;
    })>;
    /**
     * Creates a new integration.
     * @param {Integration} data - The data for the new integration.
     * @returns {Promise<Integration>} A promise that resolves to the created integration object.
     */
    create(data: Omit<Integration, "id" | "team" | "created_at" | "updated_at">): Promise<Integration>;
    /**
     * Updates an existing integration.
     * @param {string} id - The ID of the integration to update.
     * @param {Integration} data - The updated integration data.
     * @returns {Promise<Integration>} A promise that resolves to the updated integration object.
     */
    update(id: string, data: Integration): Promise<Integration>;
    /**
     * Deletes an integration.
     * @param {string} id - The ID of the integration to delete.
     * @returns {Promise<void>} A promise that resolves when the integration is deleted.
     */
    delete(id: string): Promise<void>;
}

declare class OnvoIntegrationTables extends OnvoBase {
    #private;
    constructor(integrationId: string, apiKey: string, options?: {
        endpoint: string;
    });
    list(): Promise<IntegrationTable[]>;
    update(id: string, body: Partial<IntegrationTable>): Promise<IntegrationTable>;
}

declare class OnvoIntegration extends OnvoBase {
    #private;
    tables: OnvoIntegrationTables;
    constructor(id: string, apiKey: string, options?: {
        endpoint: string;
    });
    /**
     * Initializes the integration.
     *
     * @return {Promise<{success: boolean, id: string}>} A promise that resolves to an object containing the success and id of the integration.
     */
    initialize(callback?: (event: JobUpdateEvent) => void): Promise<{
        success: boolean;
        id: string;
    }>;
}

declare class Onvo extends OnvoBase {
    accounts: OnvoAccounts;
    teams: OnvoTeams;
    embed_users: OnvoEmbedUsers;
    datasources: OnvoDatasources;
    automations: OnvoAutomations;
    dashboards: OnvoDashboards;
    questions: OnvoQuestions;
    widgets: OnvoWidgets;
    sessions: OnvoSessions;
    utils: OnvoUtils;
    logs: OnvoLogs;
    integrations: OnvoIntegrations;
    automation: (automationId: string) => OnvoAutomation;
    dashboard: (dashboardId: string) => OnvoDashboard;
    embed_user: (embedUserId: string) => OnvoEmbedUser;
    datasource: (datasourceId: string) => OnvoDatasource;
    widget: (widgetId: string) => OnvoWidget;
    question: (questionId: string) => OnvoQuestion;
    integration: (integrationId: string) => OnvoIntegration;
    constructor(apiKey: string, options?: {
        endpoint: string;
    });
}

export { type APIDatasourceConfig, type APIKey, APIKeyZod, type Account, AccountZod, type AirtableDatasourceConfig, AirtableOauthClient, type Automation, type AutomationCondition, AutomationConditionZod, type AutomationRun, AutomationRunZod, AutomationZod, BaseOauthClient, type BigQueryDatasourceConfig, type CSVDatasourceConfig, type ClickhouseDatasourceConfig, type CompositeTypes, Constants, DEFAULT_SYNC_SETTINGS, type Dashboard, type DashboardDatasource, DashboardDatasourceZod, type DashboardFilter, DashboardFilterZod, type DashboardMeta, DashboardMetaZod, type DashboardSettings, DashboardSettingsZod, type DashboardSyncSettings, DashboardSyncSettingsZod, type DashboardTab, DashboardTabZod, DashboardZod, type DataSource, DataSourceZod, type Database, type DatasourceFilter, type DatasourceMeta, type EmbedUser, EmbedUserZod, type Enums, type ExcelDatasourceConfig, type ExternalConfig, type FirestoreDatasourceConfig, type GoogleSheetDatasourceConfig, GoogleSheetsOauthClient, type Integration, type IntegrationMeta, type IntegrationTable, IntegrationTableZod, IntegrationZod, type Invite, InviteZod, type Json, LLMHostingTypeZod, type LLMSettings, LLMSettingsZod, type Log, LogType, LogZod, type Member, MemberZod, type Message, MessageZod, type Metadata, MetadataItemZod, type Modify, type MongoDBDatasourceConfig, type MsSQLDatasourceConfig, type MySQLDatasourceConfig, OauthClients, type OauthConfig, Onvo, OpenApiComponents, type PostgreSQLDatasourceConfig, type Question, QuestionZod, type SelfHostingSettings, SelfHostingSettingsZod, type Session, SessionZod, type SnowflakeDatasourceConfig, type Subscription, type SubscriptionPlan, SubscriptionPlanZod, SubscriptionZod, Table, type Tables, type TablesInsert, type TablesUpdate, type Team, TeamZod, type Widget, type WidgetMessage, type WidgetSettings, type WidgetSuggestion, WidgetSuggestionZod, WidgetZod, __ensureFileIsEmitted };
