export type Json = | string | number | boolean | null | { [key: string]: Json | undefined } | Json[]; export type Database = { public: { Tables: { documents: { Row: { access_scope: "private" | "shared" | "public"; content: Json | null; created_at: string | null; deleted_at: string | null; deleted_by: string | null; id: string; index_status: string | null; is_public: boolean | null; is_starred: boolean | null; is_template: boolean; mindmap_data: Json | null; parent_id: string | null; raw_text: string | null; sort_order: number; title: string | null; updated_at: string | null; user_id: string; workspace_id: string; wide_layout: boolean; use_small_text: boolean; show_heading_numbers: boolean; show_toc: boolean; show_structure: boolean; protect_editing: boolean; show_word_count: boolean; word_count: number; character_count: number; block_count: number; }; Insert: { access_scope?: "private" | "shared" | "public"; content?: Json | null; created_at?: string | null; deleted_at?: string | null; deleted_by?: string | null; id?: string; index_status?: string | null; is_public?: boolean | null; is_starred?: boolean | null; is_template?: boolean; mindmap_data?: Json | null; parent_id?: string | null; raw_text?: string | null; sort_order?: number; title?: string | null; updated_at?: string | null; user_id: string; workspace_id: string; wide_layout?: boolean; use_small_text?: boolean; show_heading_numbers?: boolean; show_toc?: boolean; show_structure?: boolean; protect_editing?: boolean; show_word_count?: boolean; word_count?: number; character_count?: number; block_count?: number; }; Update: { access_scope?: "private" | "shared" | "public"; content?: Json | null; created_at?: string | null; deleted_at?: string | null; deleted_by?: string | null; id?: string; index_status?: string | null; is_public?: boolean | null; is_starred?: boolean | null; is_template?: boolean; mindmap_data?: Json | null; parent_id?: string | null; raw_text?: string | null; sort_order?: number; title?: string | null; updated_at?: string | null; user_id?: string; workspace_id?: string; wide_layout?: boolean; use_small_text?: boolean; show_heading_numbers?: boolean; show_toc?: boolean; show_structure?: boolean; protect_editing?: boolean; show_word_count?: boolean; word_count?: number; character_count?: number; block_count?: number; }; Relationships: [ { foreignKeyName: "documents_parent_id_fkey"; columns: ["parent_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, { foreignKeyName: "documents_workspace_id_fkey"; columns: ["workspace_id"]; referencedRelation: "workspaces"; referencedColumns: ["id"]; }, { foreignKeyName: "documents_deleted_by_fkey"; columns: ["deleted_by"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, ]; }; document_embeddings: { Row: { content_text: string; document_id: string | null; embedding: string | null; id: string; }; Insert: { content_text: string; document_id?: string | null; embedding?: string | null; id?: string; }; Update: { content_text?: string; document_id?: string | null; embedding?: string | null; id?: string; }; Relationships: [ { foreignKeyName: "document_embeddings_document_id_fkey"; columns: ["document_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, ]; }; entities: { Row: { document_ids: string[] | null; id: string; name: string; properties: Json | null; type: string | null; user_id: string; }; Insert: { document_ids?: string[] | null; id?: string; name: string; properties?: Json | null; type?: string | null; user_id: string; }; Update: { document_ids?: string[] | null; id?: string; name?: string; properties?: Json | null; type?: string | null; user_id?: string; }; Relationships: []; }; relationships: { Row: { document_ids: string[] | null; from_entity: string | null; id: string; to_entity: string | null; type: string | null; }; Insert: { document_ids?: string[] | null; from_entity?: string | null; id?: string; to_entity?: string | null; type?: string | null; }; Update: { document_ids?: string[] | null; from_entity?: string | null; id?: string; to_entity?: string | null; type?: string | null; }; Relationships: [ { foreignKeyName: "relationships_from_entity_fkey"; columns: ["from_entity"]; referencedRelation: "entities"; referencedColumns: ["id"]; }, { foreignKeyName: "relationships_to_entity_fkey"; columns: ["to_entity"]; referencedRelation: "entities"; referencedColumns: ["id"]; }, ]; }; page_refs: { Row: { id: string; workspace_id: string; source_page_id: string; source_block_id: string | null; target_page_id: string; alias: string | null; display_mode: string; is_previewable: boolean; created_by: string; created_at: string; updated_at: string; }; Insert: { id?: string; workspace_id: string; source_page_id: string; source_block_id?: string | null; target_page_id: string; alias?: string | null; display_mode?: string; is_previewable?: boolean; created_by: string; created_at?: string; updated_at?: string; }; Update: { id?: string; workspace_id?: string; source_page_id?: string; source_block_id?: string | null; target_page_id?: string; alias?: string | null; display_mode?: string; is_previewable?: boolean; created_by?: string; created_at?: string; updated_at?: string; }; Relationships: [ { foreignKeyName: "page_refs_workspace_id_fkey"; columns: ["workspace_id"]; referencedRelation: "workspaces"; referencedColumns: ["id"]; }, { foreignKeyName: "page_refs_source_page_id_fkey"; columns: ["source_page_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, { foreignKeyName: "page_refs_target_page_id_fkey"; columns: ["target_page_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, { foreignKeyName: "page_refs_created_by_fkey"; columns: ["created_by"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, ]; }; media_assets: { Row: { id: string; workspace_id: string; document_id: string; asset_type: string; file_url: string | null; thumbnail_url: string | null; bucket: string | null; storage_path: string | null; file_name: string | null; file_size: number | null; mime_type: string | null; ocr_payload: Json | null; ocr_strategy: string | null; ocr_text: string | null; ocr_status: string | null; created_by: string | null; created_at: string; updated_at: string; }; Insert: { id?: string; workspace_id: string; document_id: string; asset_type?: string; file_url?: string | null; thumbnail_url?: string | null; bucket?: string | null; storage_path?: string | null; file_name?: string | null; file_size?: number | null; mime_type?: string | null; ocr_payload?: Json | null; ocr_strategy?: string | null; ocr_text?: string | null; ocr_status?: string | null; created_by?: string | null; created_at?: string; updated_at?: string; }; Update: { id?: string; workspace_id?: string; document_id?: string; asset_type?: string; file_url?: string | null; thumbnail_url?: string | null; bucket?: string | null; storage_path?: string | null; file_name?: string | null; file_size?: number | null; mime_type?: string | null; ocr_payload?: Json | null; ocr_strategy?: string | null; ocr_text?: string | null; ocr_status?: string | null; created_by?: string | null; created_at?: string; updated_at?: string; }; Relationships: [ { foreignKeyName: "media_assets_workspace_id_fkey"; columns: ["workspace_id"]; referencedRelation: "workspaces"; referencedColumns: ["id"]; }, { foreignKeyName: "media_assets_document_id_fkey"; columns: ["document_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, { foreignKeyName: "media_assets_created_by_fkey"; columns: ["created_by"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, ]; }; user_recent_pages: { Row: { id: string; user_id: string; workspace_id: string; document_id: string; last_accessed_at: string; }; Insert: { id?: string; user_id: string; workspace_id: string; document_id: string; last_accessed_at?: string; }; Update: { id?: string; user_id?: string; workspace_id?: string; document_id?: string; last_accessed_at?: string; }; Relationships: [ { foreignKeyName: "user_recent_pages_document_id_fkey"; columns: ["document_id"]; referencedRelation: "documents"; referencedColumns: ["id"]; }, { foreignKeyName: "user_recent_pages_user_id_fkey"; columns: ["user_id"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, { foreignKeyName: "user_recent_pages_workspace_id_fkey"; columns: ["workspace_id"]; referencedRelation: "workspaces"; referencedColumns: ["id"]; }, ]; }; }; Views: { [_ in never]: never; }; Functions: { get_documents_tree: { Args: { request_user_id: string; }; Returns: { depth: number; id: string; parent_id: string | null; path: string[]; sort_order: number; title: string | null; }[]; }; workspaces: { Row: { created_at: string; created_by: string; icon_url: string | null; id: string; name: string; type: "personal" | "team"; updated_at: string; }; Insert: { created_at?: string; created_by: string; icon_url?: string | null; id?: string; name: string; type?: "personal" | "team"; updated_at?: string; }; Update: { created_at?: string; created_by?: string; icon_url?: string | null; id?: string; name?: string; type?: "personal" | "team"; updated_at?: string; }; Relationships: [ { foreignKeyName: "workspaces_created_by_fkey"; columns: ["created_by"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, ]; }; workspace_members: { Row: { created_at: string; id: string; is_default: boolean; role: string; user_id: string; workspace_id: string; }; Insert: { created_at?: string; id?: string; is_default?: boolean; role?: string; user_id: string; workspace_id: string; }; Update: { created_at?: string; id?: string; is_default?: boolean; role?: string; user_id?: string; workspace_id?: string; }; Relationships: [ { foreignKeyName: "workspace_members_user_id_fkey"; columns: ["user_id"]; referencedRelation: "profiles"; referencedColumns: ["id"]; }, { foreignKeyName: "workspace_members_workspace_id_fkey"; columns: ["workspace_id"]; referencedRelation: "workspaces"; referencedColumns: ["id"]; }, ]; }; record_page_ref: { Args: { p_workspace_id: string; p_source_page_id: string; p_source_block_id?: string | null; p_target_page_id: string; p_alias?: string | null; p_display_mode?: string; p_is_previewable?: boolean; p_created_by?: string; }; Returns: Database["public"]["Tables"]["page_refs"]["Row"]; }; list_backlinks: { Args: { p_workspace_id: string; p_target_page_id: string; p_limit?: number; p_offset?: number; }; Returns: Array<{ id: string; source_page_id: string; source_block_id: string | null; alias: string | null; display_mode: string; is_previewable: boolean; created_at: string; updated_at: string; source_title: string | null; workspace_id: string; }>; }; }; Enums: { [_ in never]: never; }; CompositeTypes: { [_ in never]: never; }; }; };