export type Json =
  | string
  | number
  | boolean
  | null
  | { [key: string]: Json | undefined }
  | Json[]

export type Database = {
  audit: {
    Tables: {
      cart_entries: {
        Row: {
          account_id: string
          cart_id: string
          changed_by: string
          comment: string | null
          created_at: string
          id: number
          operation: string
          variant_id: string | null
        }
        Insert: {
          account_id: string
          cart_id: string
          changed_by: string
          comment?: string | null
          created_at?: string
          id?: number
          operation: string
          variant_id?: string | null
        }
        Update: {
          account_id?: string
          cart_id?: string
          changed_by?: string
          comment?: string | null
          created_at?: string
          id?: number
          operation?: string
          variant_id?: string | null
        }
        Relationships: []
      }
      doctor_page_views: {
        Row: {
          action: Database["audit"]["Enums"]["doctor_page_view_action"]
          created_at: string
          data_owner_user_id: string | null
          id: number
          viewed_record_key: string | null
          viewer_user_id: string
        }
        Insert: {
          action: Database["audit"]["Enums"]["doctor_page_view_action"]
          created_at?: string
          data_owner_user_id?: string | null
          id?: number
          viewed_record_key?: string | null
          viewer_user_id: string
        }
        Update: {
          action?: Database["audit"]["Enums"]["doctor_page_view_action"]
          created_at?: string
          data_owner_user_id?: string | null
          id?: number
          viewed_record_key?: string | null
          viewer_user_id?: string
        }
        Relationships: []
      }
      log_entries: {
        Row: {
          changed_at: string
          changed_by: string | null
          changed_by_role: string | null
          changed_data: Json | null
          id: number
          operation: string
          record_key: string | null
          row_data: Json | null
          schema_name: string
          table_name: string
        }
        Insert: {
          changed_at?: string
          changed_by?: string | null
          changed_by_role?: string | null
          changed_data?: Json | null
          id?: number
          operation: string
          record_key?: string | null
          row_data?: Json | null
          schema_name: string
          table_name: string
        }
        Update: {
          changed_at?: string
          changed_by?: string | null
          changed_by_role?: string | null
          changed_data?: Json | null
          id?: number
          operation?: string
          record_key?: string | null
          row_data?: Json | null
          schema_name?: string
          table_name?: string
        }
        Relationships: []
      }
      medipost_dispatch: {
        Row: {
          changed_by: string | null
          created_at: string
          error_message: string | null
          id: number
          is_medipost_error: boolean
          is_success: boolean
          medusa_order_id: string
        }
        Insert: {
          changed_by?: string | null
          created_at?: string
          error_message?: string | null
          id?: number
          is_medipost_error: boolean
          is_success: boolean
          medusa_order_id: string
        }
        Update: {
          changed_by?: string | null
          created_at?: string
          error_message?: string | null
          id?: number
          is_medipost_error?: boolean
          is_success?: boolean
          medusa_order_id?: string
        }
        Relationships: []
      }
      medusa_action: {
        Row: {
          action: string
          created_at: string
          id: number
          medusa_user_id: string
          page: string | null
          user_email: string
        }
        Insert: {
          action: string
          created_at?: string
          id?: number
          medusa_user_id: string
          page?: string | null
          user_email: string
        }
        Update: {
          action?: string
          created_at?: string
          id?: number
          medusa_user_id?: string
          page?: string | null
          user_email?: string
        }
        Relationships: []
      }
      notification_entries: {
        Row: {
          action: string
          comment: string | null
          created_at: string
          id: number
          related_record_key: string | null
          status: Database["audit"]["Enums"]["action_status"]
        }
        Insert: {
          action: string
          comment?: string | null
          created_at?: string
          id?: number
          related_record_key?: string | null
          status: Database["audit"]["Enums"]["action_status"]
        }
        Update: {
          action?: string
          comment?: string | null
          created_at?: string
          id?: number
          related_record_key?: string | null
          status?: Database["audit"]["Enums"]["action_status"]
        }
        Relationships: []
      }
      page_views: {
        Row: {
          account_id: string
          action: string
          changed_by: string
          created_at: string
          extra_data: Json | null
          id: number
        }
        Insert: {
          account_id: string
          action: string
          changed_by: string
          created_at?: string
          extra_data?: Json | null
          id?: number
        }
        Update: {
          account_id?: string
          action?: string
          changed_by?: string
          created_at?: string
          extra_data?: Json | null
          id?: number
        }
        Relationships: []
      }
      request_entries: {
        Row: {
          comment: string | null
          created_at: string
          id: number
          request_api: string
          request_api_method: string
          requested_end_date: string | null
          requested_start_date: string | null
          service_id: number | null
          service_provider_id: number | null
          status: Database["audit"]["Enums"]["request_status"]
          user_id: string | null
        }
        Insert: {
          comment?: string | null
          created_at?: string
          id?: number
          request_api: string
          request_api_method: string
          requested_end_date?: string | null
          requested_start_date?: string | null
          service_id?: number | null
          service_provider_id?: number | null
          status: Database["audit"]["Enums"]["request_status"]
          user_id?: string | null
        }
        Update: {
          comment?: string | null
          created_at?: string
          id?: number
          request_api?: string
          request_api_method?: string
          requested_end_date?: string | null
          requested_start_date?: string | null
          service_id?: number | null
          service_provider_id?: number | null
          status?: Database["audit"]["Enums"]["request_status"]
          user_id?: string | null
        }
        Relationships: []
      }
      sync_entries: {
        Row: {
          changed_by_role: string
          comment: string | null
          created_at: string
          id: number
          operation: string
          status: string
        }
        Insert: {
          changed_by_role: string
          comment?: string | null
          created_at?: string
          id?: number
          operation: string
          status: string
        }
        Update: {
          changed_by_role?: string
          comment?: string | null
          created_at?: string
          id?: number
          operation?: string
          status?: string
        }
        Relationships: []
      }
    }
    Views: {
      [_ in never]: never
    }
    Functions: {
      [_ in never]: never
    }
    Enums: {
      action_status: "SUCCESS" | "FAIL"
      doctor_page_view_action:
        | "VIEW_ANALYSIS_RESULTS"
        | "VIEW_DASHBOARD"
        | "VIEW_OPEN_JOBS"
        | "VIEW_OWN_JOBS"
        | "VIEW_DONE_JOBS"
      request_status: "SUCCESS" | "FAIL"
      sync_status: "SUCCESS" | "FAIL"
    }
    CompositeTypes: {
      [_ in never]: never
    }
  }
  graphql_public: {
    Tables: {
      [_ in never]: never
    }
    Views: {
      [_ in never]: never
    }
    Functions: {
      graphql: {
        Args: {
          extensions?: Json
          operationName?: string
          query?: string
          variables?: Json
        }
        Returns: Json
      }
    }
    Enums: {
      [_ in never]: never
    }
    CompositeTypes: {
      [_ in never]: never
    }
  }
  medreport: {
    Tables: {
      account_balance_entries: {
        Row: {
          account_id: string
          amount: number
          created_at: string
          created_by: string | null
          description: string | null
          entry_type: string
          expires_at: string | null
          id: string
          is_active: boolean
          is_analysis_order: boolean
          is_analysis_package_order: boolean
          reference_id: string | null
          source_company_id: string | null
        }
        Insert: {
          account_id: string
          amount: number
          created_at?: string
          created_by?: string | null
          description?: string | null
          entry_type: string
          expires_at?: string | null
          id?: string
          is_active?: boolean
          is_analysis_order?: boolean
          is_analysis_package_order?: boolean
          reference_id?: string | null
          source_company_id?: string | null
        }
        Update: {
          account_id?: string
          amount?: number
          created_at?: string
          created_by?: string | null
          description?: string | null
          entry_type?: string
          expires_at?: string | null
          id?: string
          is_active?: boolean
          is_analysis_order?: boolean
          is_analysis_package_order?: boolean
          reference_id?: string | null
          source_company_id?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "account_balance_entries_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_balance_entries_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_balance_entries_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_balance_entries_source_company_id_fkey"
            columns: ["source_company_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_balance_entries_source_company_id_fkey"
            columns: ["source_company_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_balance_entries_source_company_id_fkey"
            columns: ["source_company_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      account_params: {
        Row: {
          account_id: string
          height: number | null
          id: string
          is_smoker: boolean | null
          recorded_at: string
          weight: number | null
        }
        Insert: {
          account_id?: string
          height?: number | null
          id?: string
          is_smoker?: boolean | null
          recorded_at?: string
          weight?: number | null
        }
        Update: {
          account_id?: string
          height?: number | null
          id?: string
          is_smoker?: boolean | null
          recorded_at?: string
          weight?: number | null
        }
        Relationships: [
          {
            foreignKeyName: "account_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: true
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: true
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "account_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: true
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      accounts: {
        Row: {
          application_role: Database["medreport"]["Enums"]["application_role"]
          city: string | null
          created_at: string | null
          created_by: string | null
          email: string | null
          has_consent_anonymized_company_statistics: boolean | null
          has_consent_personal_data: boolean | null
          id: string
          is_personal_account: boolean
          last_name: string | null
          medusa_account_id: string | null
          name: string
          personal_code: string | null
          phone: string | null
          picture_url: string | null
          preferred_locale: Database["medreport"]["Enums"]["locale"] | null
          primary_owner_user_id: string
          slug: string | null
          updated_at: string | null
          updated_by: string | null
        }
        Insert: {
          application_role?: Database["medreport"]["Enums"]["application_role"]
          city?: string | null
          created_at?: string | null
          created_by?: string | null
          email?: string | null
          has_consent_anonymized_company_statistics?: boolean | null
          has_consent_personal_data?: boolean | null
          id?: string
          is_personal_account?: boolean
          last_name?: string | null
          medusa_account_id?: string | null
          name: string
          personal_code?: string | null
          phone?: string | null
          picture_url?: string | null
          preferred_locale?: Database["medreport"]["Enums"]["locale"] | null
          primary_owner_user_id?: string
          slug?: string | null
          updated_at?: string | null
          updated_by?: string | null
        }
        Update: {
          application_role?: Database["medreport"]["Enums"]["application_role"]
          city?: string | null
          created_at?: string | null
          created_by?: string | null
          email?: string | null
          has_consent_anonymized_company_statistics?: boolean | null
          has_consent_personal_data?: boolean | null
          id?: string
          is_personal_account?: boolean
          last_name?: string | null
          medusa_account_id?: string | null
          name?: string
          personal_code?: string | null
          phone?: string | null
          picture_url?: string | null
          preferred_locale?: Database["medreport"]["Enums"]["locale"] | null
          primary_owner_user_id?: string
          slug?: string | null
          updated_at?: string | null
          updated_by?: string | null
        }
        Relationships: []
      }
      accounts_memberships: {
        Row: {
          account_id: string
          account_role: string
          created_at: string
          created_by: string | null
          has_seen_confirmation: boolean
          id: string
          updated_at: string
          updated_by: string | null
          user_id: string
        }
        Insert: {
          account_id: string
          account_role: string
          created_at?: string
          created_by?: string | null
          has_seen_confirmation?: boolean
          id?: string
          updated_at?: string
          updated_by?: string | null
          user_id: string
        }
        Update: {
          account_id?: string
          account_role?: string
          created_at?: string
          created_by?: string | null
          has_seen_confirmation?: boolean
          id?: string
          updated_at?: string
          updated_by?: string | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "accounts_memberships_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "accounts_memberships_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "accounts_memberships_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "accounts_memberships_account_role_fkey"
            columns: ["account_role"]
            isOneToOne: false
            referencedRelation: "roles"
            referencedColumns: ["name"]
          },
        ]
      }
      ai_responses: {
        Row: {
          account_id: string
          created_at: string
          id: string
          input: Json
          latest_data_change: string
          prompt_id: string
          prompt_name: string
          response: Json
        }
        Insert: {
          account_id: string
          created_at?: string
          id?: string
          input: Json
          latest_data_change: string
          prompt_id: string
          prompt_name: string
          response: Json
        }
        Update: {
          account_id?: string
          created_at?: string
          id?: string
          input?: Json
          latest_data_change?: string
          prompt_id?: string
          prompt_name?: string
          response?: Json
        }
        Relationships: [
          {
            foreignKeyName: "ai_responses_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "ai_responses_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "ai_responses_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      analyses: {
        Row: {
          analysis_id_oid: string
          analysis_id_original: string
          analysis_name_lab: string | null
          created_at: string
          id: number
          order: number
          parent_analysis_element_id: number
          tehik_loinc_name: string | null
          tehik_short_loinc: string | null
          updated_at: string | null
        }
        Insert: {
          analysis_id_oid: string
          analysis_id_original: string
          analysis_name_lab?: string | null
          created_at?: string
          id?: number
          order: number
          parent_analysis_element_id: number
          tehik_loinc_name?: string | null
          tehik_short_loinc?: string | null
          updated_at?: string | null
        }
        Update: {
          analysis_id_oid?: string
          analysis_id_original?: string
          analysis_name_lab?: string | null
          created_at?: string
          id?: number
          order?: number
          parent_analysis_element_id?: number
          tehik_loinc_name?: string | null
          tehik_short_loinc?: string | null
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "analyses_parent_analysis_element_id_fkey"
            columns: ["parent_analysis_element_id"]
            isOneToOne: false
            referencedRelation: "analysis_elements"
            referencedColumns: ["id"]
          },
        ]
      }
      analysis_elements: {
        Row: {
          analysis_id_oid: string
          analysis_id_original: string
          analysis_name_lab: string | null
          created_at: string
          id: number
          material_groups: Json[] | null
          order: number
          parent_analysis_group_id: number
          tehik_loinc_name: string
          tehik_short_loinc: string
          updated_at: string | null
        }
        Insert: {
          analysis_id_oid: string
          analysis_id_original: string
          analysis_name_lab?: string | null
          created_at?: string
          id?: number
          material_groups?: Json[] | null
          order: number
          parent_analysis_group_id: number
          tehik_loinc_name: string
          tehik_short_loinc: string
          updated_at?: string | null
        }
        Update: {
          analysis_id_oid?: string
          analysis_id_original?: string
          analysis_name_lab?: string | null
          created_at?: string
          id?: number
          material_groups?: Json[] | null
          order?: number
          parent_analysis_group_id?: number
          tehik_loinc_name?: string
          tehik_short_loinc?: string
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "analysis_elements_parent_analysis_group_id_fkey"
            columns: ["parent_analysis_group_id"]
            isOneToOne: false
            referencedRelation: "analysis_groups"
            referencedColumns: ["id"]
          },
        ]
      }
      analysis_groups: {
        Row: {
          created_at: string
          id: number
          name: string
          order: number
          original_id: string
          updated_at: string | null
        }
        Insert: {
          created_at?: string
          id?: number
          name: string
          order: number
          original_id: string
          updated_at?: string | null
        }
        Update: {
          created_at?: string
          id?: number
          name?: string
          order?: number
          original_id?: string
          updated_at?: string | null
        }
        Relationships: []
      }
      analysis_orders: {
        Row: {
          analysis_element_ids: number[] | null
          analysis_ids: number[] | null
          created_at: string
          id: number
          medusa_order_id: string
          status: Database["medreport"]["Enums"]["analysis_order_status"]
          user_id: string
        }
        Insert: {
          analysis_element_ids?: number[] | null
          analysis_ids?: number[] | null
          created_at?: string
          id?: number
          medusa_order_id: string
          status: Database["medreport"]["Enums"]["analysis_order_status"]
          user_id: string
        }
        Update: {
          analysis_element_ids?: number[] | null
          analysis_ids?: number[] | null
          created_at?: string
          id?: number
          medusa_order_id?: string
          status?: Database["medreport"]["Enums"]["analysis_order_status"]
          user_id?: string
        }
        Relationships: []
      }
      analysis_response_elements: {
        Row: {
          analysis_element_original_id: string
          analysis_name: string | null
          analysis_response_id: number
          comment: string | null
          created_at: string
          id: number
          norm_lower: number | null
          norm_lower_included: boolean | null
          norm_status: number | null
          norm_upper: number | null
          norm_upper_included: boolean | null
          original_response_element: Json
          response_time: string | null
          response_value: number | null
          response_value_is_negative: boolean | null
          response_value_is_within_norm: boolean | null
          status: string | null
          unit: string | null
          updated_at: string | null
        }
        Insert: {
          analysis_element_original_id: string
          analysis_name?: string | null
          analysis_response_id: number
          comment?: string | null
          created_at?: string
          id?: number
          norm_lower?: number | null
          norm_lower_included?: boolean | null
          norm_status?: number | null
          norm_upper?: number | null
          norm_upper_included?: boolean | null
          original_response_element: Json
          response_time?: string | null
          response_value?: number | null
          response_value_is_negative?: boolean | null
          response_value_is_within_norm?: boolean | null
          status?: string | null
          unit?: string | null
          updated_at?: string | null
        }
        Update: {
          analysis_element_original_id?: string
          analysis_name?: string | null
          analysis_response_id?: number
          comment?: string | null
          created_at?: string
          id?: number
          norm_lower?: number | null
          norm_lower_included?: boolean | null
          norm_status?: number | null
          norm_upper?: number | null
          norm_upper_included?: boolean | null
          original_response_element?: Json
          response_time?: string | null
          response_value?: number | null
          response_value_is_negative?: boolean | null
          response_value_is_within_norm?: boolean | null
          status?: string | null
          unit?: string | null
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "analysis_response_element_analysis_response_id_fkey"
            columns: ["analysis_response_id"]
            isOneToOne: false
            referencedRelation: "analysis_responses"
            referencedColumns: ["id"]
          },
        ]
      }
      analysis_responses: {
        Row: {
          analysis_order_id: number
          created_at: string
          id: number
          order_number: string
          order_status: Database["medreport"]["Enums"]["analysis_order_status"]
          updated_at: string | null
          user_id: string
        }
        Insert: {
          analysis_order_id: number
          created_at?: string
          id?: number
          order_number: string
          order_status: Database["medreport"]["Enums"]["analysis_order_status"]
          updated_at?: string | null
          user_id: string
        }
        Update: {
          analysis_order_id?: number
          created_at?: string
          id?: number
          order_number?: string
          order_status?: Database["medreport"]["Enums"]["analysis_order_status"]
          updated_at?: string | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "analysis_responses_analysis_order_id_fkey"
            columns: ["analysis_order_id"]
            isOneToOne: false
            referencedRelation: "analysis_orders"
            referencedColumns: ["id"]
          },
        ]
      }
      benefit_distribution_schedule: {
        Row: {
          benefit_amount: number
          benefit_occurrence: string
          company_id: string
          created_at: string
          id: string
          is_active: boolean
          last_distributed_at: string | null
          next_distribution_at: string
          updated_at: string
        }
        Insert: {
          benefit_amount: number
          benefit_occurrence: string
          company_id: string
          created_at?: string
          id?: string
          is_active?: boolean
          last_distributed_at?: string | null
          next_distribution_at: string
          updated_at?: string
        }
        Update: {
          benefit_amount?: number
          benefit_occurrence?: string
          company_id?: string
          created_at?: string
          id?: string
          is_active?: boolean
          last_distributed_at?: string | null
          next_distribution_at?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "benefit_distribution_schedule_company_id_fkey"
            columns: ["company_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "benefit_distribution_schedule_company_id_fkey"
            columns: ["company_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "benefit_distribution_schedule_company_id_fkey"
            columns: ["company_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      billing_customers: {
        Row: {
          account_id: string
          customer_id: string
          email: string | null
          id: number
          provider: Database["medreport"]["Enums"]["billing_provider"]
        }
        Insert: {
          account_id: string
          customer_id: string
          email?: string | null
          id?: number
          provider: Database["medreport"]["Enums"]["billing_provider"]
        }
        Update: {
          account_id?: string
          customer_id?: string
          email?: string | null
          id?: number
          provider?: Database["medreport"]["Enums"]["billing_provider"]
        }
        Relationships: [
          {
            foreignKeyName: "billing_customers_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "billing_customers_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "billing_customers_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      bmi_thresholds: {
        Row: {
          age_max: number | null
          age_min: number
          id: number
          normal_max: number
          normal_min: number
          obesity_min: number
          overweight_min: number
          strong_min: number
          underweight_max: number
        }
        Insert: {
          age_max?: number | null
          age_min: number
          id?: number
          normal_max: number
          normal_min: number
          obesity_min: number
          overweight_min: number
          strong_min: number
          underweight_max: number
        }
        Update: {
          age_max?: number | null
          age_min?: number
          id?: number
          normal_max?: number
          normal_min?: number
          obesity_min?: number
          overweight_min?: number
          strong_min?: number
          underweight_max?: number
        }
        Relationships: []
      }
      codes: {
        Row: {
          analysis_element_id: number | null
          analysis_group_id: number | null
          analysis_id: number | null
          coefficient: number
          created_at: string
          hk_code: string
          hk_code_multiplier: number
          id: number
          price: number
          updated_at: string | null
        }
        Insert: {
          analysis_element_id?: number | null
          analysis_group_id?: number | null
          analysis_id?: number | null
          coefficient: number
          created_at?: string
          hk_code: string
          hk_code_multiplier: number
          id?: number
          price: number
          updated_at?: string | null
        }
        Update: {
          analysis_element_id?: number | null
          analysis_group_id?: number | null
          analysis_id?: number | null
          coefficient?: number
          created_at?: string
          hk_code?: string
          hk_code_multiplier?: number
          id?: number
          price?: number
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "codes_analysis_element_id_fkey"
            columns: ["analysis_element_id"]
            isOneToOne: false
            referencedRelation: "analysis_elements"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "codes_analysis_group_id_fkey"
            columns: ["analysis_group_id"]
            isOneToOne: false
            referencedRelation: "analysis_groups"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "codes_analysis_id_fkey"
            columns: ["analysis_id"]
            isOneToOne: false
            referencedRelation: "analyses"
            referencedColumns: ["id"]
          },
        ]
      }
      company_params: {
        Row: {
          account_id: string | null
          benefit_amount: number | null
          benefit_occurance: string | null
          created_at: string | null
          id: string
          slug: string | null
          updated_at: string | null
        }
        Insert: {
          account_id?: string | null
          benefit_amount?: number | null
          benefit_occurance?: string | null
          created_at?: string | null
          id?: string
          slug?: string | null
          updated_at?: string | null
        }
        Update: {
          account_id?: string | null
          benefit_amount?: number | null
          benefit_occurance?: string | null
          created_at?: string | null
          id?: string
          slug?: string | null
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "company_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "company_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "company_params_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      config: {
        Row: {
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          enable_account_billing: boolean
          enable_team_account_billing: boolean
          enable_team_accounts: boolean
        }
        Insert: {
          billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
          enable_account_billing?: boolean
          enable_team_account_billing?: boolean
          enable_team_accounts?: boolean
        }
        Update: {
          billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
          enable_account_billing?: boolean
          enable_team_account_billing?: boolean
          enable_team_accounts?: boolean
        }
        Relationships: []
      }
      connected_online_locations: {
        Row: {
          address: string | null
          clinic_id: number
          created_at: string
          id: number
          name: string
          sync_id: number
          updated_at: string | null
        }
        Insert: {
          address?: string | null
          clinic_id: number
          created_at?: string
          id?: number
          name: string
          sync_id: number
          updated_at?: string | null
        }
        Update: {
          address?: string | null
          clinic_id?: number
          created_at?: string
          id?: number
          name?: string
          sync_id?: number
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "connected_online_locations_clinic_id_fkey"
            columns: ["clinic_id"]
            isOneToOne: false
            referencedRelation: "connected_online_providers"
            referencedColumns: ["id"]
          },
        ]
      }
      connected_online_providers: {
        Row: {
          address: string
          can_select_worker: boolean
          created_at: string
          email: string | null
          id: number
          key: string
          name: string
          personal_code_required: boolean
          phone_number: string | null
          updated_at: string | null
        }
        Insert: {
          address?: string
          can_select_worker: boolean
          created_at?: string
          email?: string | null
          id: number
          key: string
          name: string
          personal_code_required: boolean
          phone_number?: string | null
          updated_at?: string | null
        }
        Update: {
          address?: string
          can_select_worker?: boolean
          created_at?: string
          email?: string | null
          id?: number
          key?: string
          name?: string
          personal_code_required?: boolean
          phone_number?: string | null
          updated_at?: string | null
        }
        Relationships: []
      }
      connected_online_reservation: {
        Row: {
          booking_code: string | null
          clinic_id: number
          comments: string | null
          created_at: string
          discount_code: string | null
          id: number
          lang: string
          location_sync_id: number | null
          medusa_cart_line_item_id: string | null
          requires_payment: boolean | null
          service_id: number
          service_user_id: number
          start_time: string
          status: Database["medreport"]["Enums"]["connected_online_order_status"]
          sync_user_id: number
          updated_at: string | null
          user_id: string
        }
        Insert: {
          booking_code?: string | null
          clinic_id: number
          comments?: string | null
          created_at?: string
          discount_code?: string | null
          id?: number
          lang: string
          location_sync_id?: number | null
          medusa_cart_line_item_id?: string | null
          requires_payment?: boolean | null
          service_id: number
          service_user_id: number
          start_time: string
          status: Database["medreport"]["Enums"]["connected_online_order_status"]
          sync_user_id: number
          updated_at?: string | null
          user_id: string
        }
        Update: {
          booking_code?: string | null
          clinic_id?: number
          comments?: string | null
          created_at?: string
          discount_code?: string | null
          id?: number
          lang?: string
          location_sync_id?: number | null
          medusa_cart_line_item_id?: string | null
          requires_payment?: boolean | null
          service_id?: number
          service_user_id?: number
          start_time?: string
          status?: Database["medreport"]["Enums"]["connected_online_order_status"]
          sync_user_id?: number
          updated_at?: string | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "fk_reservation_clinic"
            columns: ["clinic_id"]
            isOneToOne: false
            referencedRelation: "connected_online_providers"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "fk_reservation_service"
            columns: ["service_id"]
            isOneToOne: false
            referencedRelation: "connected_online_services"
            referencedColumns: ["id"]
          },
        ]
      }
      connected_online_service_providers: {
        Row: {
          clinic_id: number
          created_at: string
          id: number
          is_deleted: boolean | null
          job_title_en: string | null
          job_title_et: string | null
          job_title_id: number | null
          job_title_ru: string | null
          name: string
          prefix: string | null
          spoken_languages: string[] | null
          updated_at: string | null
        }
        Insert: {
          clinic_id: number
          created_at?: string
          id: number
          is_deleted?: boolean | null
          job_title_en?: string | null
          job_title_et?: string | null
          job_title_id?: number | null
          job_title_ru?: string | null
          name: string
          prefix?: string | null
          spoken_languages?: string[] | null
          updated_at?: string | null
        }
        Update: {
          clinic_id?: number
          created_at?: string
          id?: number
          is_deleted?: boolean | null
          job_title_en?: string | null
          job_title_et?: string | null
          job_title_id?: number | null
          job_title_ru?: string | null
          name?: string
          prefix?: string | null
          spoken_languages?: string[] | null
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "connected_online_service_providers_clinic_id_fkey"
            columns: ["clinic_id"]
            isOneToOne: false
            referencedRelation: "connected_online_providers"
            referencedColumns: ["id"]
          },
        ]
      }
      connected_online_services: {
        Row: {
          clinic_id: number
          code: string
          created_at: string
          description: string | null
          display: string | null
          duration: number
          has_free_codes: boolean
          id: number
          name: string
          neto_duration: number | null
          online_hide_duration: number | null
          online_hide_price: number | null
          price: number
          price_periods: string | null
          requires_payment: boolean
          sync_id: number
          updated_at: string | null
        }
        Insert: {
          clinic_id: number
          code: string
          created_at?: string
          description?: string | null
          display?: string | null
          duration: number
          has_free_codes: boolean
          id: number
          name: string
          neto_duration?: number | null
          online_hide_duration?: number | null
          online_hide_price?: number | null
          price: number
          price_periods?: string | null
          requires_payment: boolean
          sync_id: number
          updated_at?: string | null
        }
        Update: {
          clinic_id?: number
          code?: string
          created_at?: string
          description?: string | null
          display?: string | null
          duration?: number
          has_free_codes?: boolean
          id?: number
          name?: string
          neto_duration?: number | null
          online_hide_duration?: number | null
          online_hide_price?: number | null
          price?: number
          price_periods?: string | null
          requires_payment?: boolean
          sync_id?: number
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "connected_online_services_clinic_id_fkey"
            columns: ["clinic_id"]
            isOneToOne: false
            referencedRelation: "connected_online_providers"
            referencedColumns: ["id"]
          },
        ]
      }
      doctor_analysis_feedback: {
        Row: {
          analysis_order_id: number
          created_at: string
          created_by: string
          doctor_user_id: string | null
          id: number
          status: Database["medreport"]["Enums"]["analysis_feedback_status"]
          updated_at: string | null
          updated_by: string | null
          user_id: string
          value: string | null
        }
        Insert: {
          analysis_order_id: number
          created_at?: string
          created_by?: string
          doctor_user_id?: string | null
          id?: number
          status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
          updated_at?: string | null
          updated_by?: string | null
          user_id: string
          value?: string | null
        }
        Update: {
          analysis_order_id?: number
          created_at?: string
          created_by?: string
          doctor_user_id?: string | null
          id?: number
          status?: Database["medreport"]["Enums"]["analysis_feedback_status"]
          updated_at?: string | null
          updated_by?: string | null
          user_id?: string
          value?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "doctor_analysis_feedback_analysis_order_id_fkey"
            columns: ["analysis_order_id"]
            isOneToOne: false
            referencedRelation: "analysis_orders"
            referencedColumns: ["id"]
          },
        ]
      }
      invitations: {
        Row: {
          account_id: string
          created_at: string
          email: string
          expires_at: string
          id: number
          invite_token: string
          invited_by: string
          personal_code: string | null
          role: string
          updated_at: string
        }
        Insert: {
          account_id: string
          created_at?: string
          email: string
          expires_at?: string
          id?: number
          invite_token: string
          invited_by: string
          personal_code?: string | null
          role: string
          updated_at?: string
        }
        Update: {
          account_id?: string
          created_at?: string
          email?: string
          expires_at?: string
          id?: number
          invite_token?: string
          invited_by?: string
          personal_code?: string | null
          role?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "invitations_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "invitations_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "invitations_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "invitations_role_fkey"
            columns: ["role"]
            isOneToOne: false
            referencedRelation: "roles"
            referencedColumns: ["name"]
          },
        ]
      }
      medipost_actions: {
        Row: {
          action: string
          created_at: string | null
          has_analysis_results: boolean
          has_error: boolean
          id: string
          medipost_external_order_id: string | null
          medipost_private_message_id: string | null
          medusa_order_id: string | null
          response_xml: string | null
          updated_at: string | null
          xml: string | null
        }
        Insert: {
          action: string
          created_at?: string | null
          has_analysis_results?: boolean
          has_error?: boolean
          id?: string
          medipost_external_order_id?: string | null
          medipost_private_message_id?: string | null
          medusa_order_id?: string | null
          response_xml?: string | null
          updated_at?: string | null
          xml?: string | null
        }
        Update: {
          action?: string
          created_at?: string | null
          has_analysis_results?: boolean
          has_error?: boolean
          id?: string
          medipost_external_order_id?: string | null
          medipost_private_message_id?: string | null
          medusa_order_id?: string | null
          response_xml?: string | null
          updated_at?: string | null
          xml?: string | null
        }
        Relationships: []
      }
      medreport_product_groups: {
        Row: {
          created_at: string
          id: number
          name: string
          updated_at: string | null
        }
        Insert: {
          created_at?: string
          id?: number
          name: string
          updated_at?: string | null
        }
        Update: {
          created_at?: string
          id?: number
          name?: string
          updated_at?: string | null
        }
        Relationships: []
      }
      medreport_products: {
        Row: {
          created_at: string
          id: number
          name: string
          product_group_id: number | null
          updated_at: string | null
        }
        Insert: {
          created_at?: string
          id?: number
          name: string
          product_group_id?: number | null
          updated_at?: string | null
        }
        Update: {
          created_at?: string
          id?: number
          name?: string
          product_group_id?: number | null
          updated_at?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "medreport_products_product_groups_id_fkey"
            columns: ["product_group_id"]
            isOneToOne: false
            referencedRelation: "medreport_product_groups"
            referencedColumns: ["id"]
          },
        ]
      }
      medreport_products_analyses_relations: {
        Row: {
          analysis_element_id: number | null
          analysis_id: number | null
          product_id: number
        }
        Insert: {
          analysis_element_id?: number | null
          analysis_id?: number | null
          product_id: number
        }
        Update: {
          analysis_element_id?: number | null
          analysis_id?: number | null
          product_id?: number
        }
        Relationships: [
          {
            foreignKeyName: "medreport_products_analyses_analysis_element_id_fkey"
            columns: ["analysis_element_id"]
            isOneToOne: true
            referencedRelation: "analysis_elements"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "medreport_products_analyses_analysis_id_fkey"
            columns: ["analysis_id"]
            isOneToOne: true
            referencedRelation: "analyses"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "medreport_products_analyses_product_id_fkey"
            columns: ["product_id"]
            isOneToOne: true
            referencedRelation: "medreport_products"
            referencedColumns: ["id"]
          },
        ]
      }
      medreport_products_external_services_relations: {
        Row: {
          connected_online_service_id: number
          product_id: number
        }
        Insert: {
          connected_online_service_id: number
          product_id: number
        }
        Update: {
          connected_online_service_id?: number
          product_id?: number
        }
        Relationships: [
          {
            foreignKeyName: "medreport_products_connected_online_services_id_fkey"
            columns: ["connected_online_service_id"]
            isOneToOne: true
            referencedRelation: "connected_online_services"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "medreport_products_connected_online_services_product_id_fkey"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "medreport_products"
            referencedColumns: ["id"]
          },
        ]
      }
      nonces: {
        Row: {
          client_token: string
          created_at: string
          expires_at: string
          id: string
          last_verification_at: string | null
          last_verification_ip: unknown | null
          last_verification_user_agent: string | null
          metadata: Json | null
          nonce: string
          purpose: string
          revoked: boolean
          revoked_reason: string | null
          scopes: string[] | null
          used_at: string | null
          user_id: string | null
          verification_attempts: number
        }
        Insert: {
          client_token: string
          created_at?: string
          expires_at: string
          id?: string
          last_verification_at?: string | null
          last_verification_ip?: unknown | null
          last_verification_user_agent?: string | null
          metadata?: Json | null
          nonce: string
          purpose: string
          revoked?: boolean
          revoked_reason?: string | null
          scopes?: string[] | null
          used_at?: string | null
          user_id?: string | null
          verification_attempts?: number
        }
        Update: {
          client_token?: string
          created_at?: string
          expires_at?: string
          id?: string
          last_verification_at?: string | null
          last_verification_ip?: unknown | null
          last_verification_user_agent?: string | null
          metadata?: Json | null
          nonce?: string
          purpose?: string
          revoked?: boolean
          revoked_reason?: string | null
          scopes?: string[] | null
          used_at?: string | null
          user_id?: string | null
          verification_attempts?: number
        }
        Relationships: []
      }
      notifications: {
        Row: {
          account_id: string
          body: string
          channel: Database["medreport"]["Enums"]["notification_channel"]
          created_at: string
          dismissed: boolean
          expires_at: string | null
          id: number
          link: string | null
          type: Database["medreport"]["Enums"]["notification_type"]
        }
        Insert: {
          account_id: string
          body: string
          channel?: Database["medreport"]["Enums"]["notification_channel"]
          created_at?: string
          dismissed?: boolean
          expires_at?: string | null
          id?: never
          link?: string | null
          type?: Database["medreport"]["Enums"]["notification_type"]
        }
        Update: {
          account_id?: string
          body?: string
          channel?: Database["medreport"]["Enums"]["notification_channel"]
          created_at?: string
          dismissed?: boolean
          expires_at?: string | null
          id?: never
          link?: string | null
          type?: Database["medreport"]["Enums"]["notification_type"]
        }
        Relationships: [
          {
            foreignKeyName: "notifications_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "notifications_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "notifications_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
        ]
      }
      order_items: {
        Row: {
          created_at: string
          id: string
          order_id: string
          price_amount: number | null
          product_id: string
          quantity: number
          updated_at: string
          variant_id: string
        }
        Insert: {
          created_at?: string
          id: string
          order_id: string
          price_amount?: number | null
          product_id: string
          quantity?: number
          updated_at?: string
          variant_id: string
        }
        Update: {
          created_at?: string
          id?: string
          order_id?: string
          price_amount?: number | null
          product_id?: string
          quantity?: number
          updated_at?: string
          variant_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_items_order_id_fkey"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "orders"
            referencedColumns: ["id"]
          },
        ]
      }
      orders: {
        Row: {
          account_id: string
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          created_at: string
          currency: string
          id: string
          status: Database["medreport"]["Enums"]["payment_status"]
          total_amount: number
          updated_at: string
        }
        Insert: {
          account_id: string
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          created_at?: string
          currency: string
          id: string
          status: Database["medreport"]["Enums"]["payment_status"]
          total_amount: number
          updated_at?: string
        }
        Update: {
          account_id?: string
          billing_customer_id?: number
          billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
          created_at?: string
          currency?: string
          id?: string
          status?: Database["medreport"]["Enums"]["payment_status"]
          total_amount?: number
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "orders_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "orders_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "orders_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "orders_billing_customer_id_fkey"
            columns: ["billing_customer_id"]
            isOneToOne: false
            referencedRelation: "billing_customers"
            referencedColumns: ["id"]
          },
        ]
      }
      role_permissions: {
        Row: {
          id: number
          permission: Database["medreport"]["Enums"]["app_permissions"]
          role: string
        }
        Insert: {
          id?: number
          permission: Database["medreport"]["Enums"]["app_permissions"]
          role: string
        }
        Update: {
          id?: number
          permission?: Database["medreport"]["Enums"]["app_permissions"]
          role?: string
        }
        Relationships: [
          {
            foreignKeyName: "role_permissions_role_fkey"
            columns: ["role"]
            isOneToOne: false
            referencedRelation: "roles"
            referencedColumns: ["name"]
          },
        ]
      }
      roles: {
        Row: {
          hierarchy_level: number
          name: string
        }
        Insert: {
          hierarchy_level: number
          name: string
        }
        Update: {
          hierarchy_level?: number
          name?: string
        }
        Relationships: []
      }
      subscription_items: {
        Row: {
          created_at: string
          id: string
          interval: string
          interval_count: number
          price_amount: number | null
          product_id: string
          quantity: number
          subscription_id: string
          type: Database["medreport"]["Enums"]["subscription_item_type"]
          updated_at: string
          variant_id: string
        }
        Insert: {
          created_at?: string
          id: string
          interval: string
          interval_count: number
          price_amount?: number | null
          product_id: string
          quantity?: number
          subscription_id: string
          type: Database["medreport"]["Enums"]["subscription_item_type"]
          updated_at?: string
          variant_id: string
        }
        Update: {
          created_at?: string
          id?: string
          interval?: string
          interval_count?: number
          price_amount?: number | null
          product_id?: string
          quantity?: number
          subscription_id?: string
          type?: Database["medreport"]["Enums"]["subscription_item_type"]
          updated_at?: string
          variant_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "subscription_items_subscription_id_fkey"
            columns: ["subscription_id"]
            isOneToOne: false
            referencedRelation: "subscriptions"
            referencedColumns: ["id"]
          },
        ]
      }
      subscriptions: {
        Row: {
          account_id: string
          active: boolean
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          cancel_at_period_end: boolean
          created_at: string
          currency: string
          id: string
          period_ends_at: string
          period_starts_at: string
          status: Database["medreport"]["Enums"]["subscription_status"]
          trial_ends_at: string | null
          trial_starts_at: string | null
          updated_at: string
        }
        Insert: {
          account_id: string
          active: boolean
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          cancel_at_period_end: boolean
          created_at?: string
          currency: string
          id: string
          period_ends_at: string
          period_starts_at: string
          status: Database["medreport"]["Enums"]["subscription_status"]
          trial_ends_at?: string | null
          trial_starts_at?: string | null
          updated_at?: string
        }
        Update: {
          account_id?: string
          active?: boolean
          billing_customer_id?: number
          billing_provider?: Database["medreport"]["Enums"]["billing_provider"]
          cancel_at_period_end?: boolean
          created_at?: string
          currency?: string
          id?: string
          period_ends_at?: string
          period_starts_at?: string
          status?: Database["medreport"]["Enums"]["subscription_status"]
          trial_ends_at?: string | null
          trial_starts_at?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "subscriptions_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "subscriptions_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_account_workspace"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "subscriptions_account_id_fkey"
            columns: ["account_id"]
            isOneToOne: false
            referencedRelation: "user_accounts"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "subscriptions_billing_customer_id_fkey"
            columns: ["billing_customer_id"]
            isOneToOne: false
            referencedRelation: "billing_customers"
            referencedColumns: ["id"]
          },
        ]
      }
    }
    Views: {
      user_account_workspace: {
        Row: {
          application_role:
            | Database["medreport"]["Enums"]["application_role"]
            | null
          id: string | null
          name: string | null
          picture_url: string | null
          subscription_status:
            | Database["medreport"]["Enums"]["subscription_status"]
            | null
        }
        Relationships: []
      }
      user_accounts: {
        Row: {
          application_role:
            | Database["medreport"]["Enums"]["application_role"]
            | null
          id: string | null
          name: string | null
          picture_url: string | null
          role: string | null
          slug: string | null
        }
        Relationships: [
          {
            foreignKeyName: "accounts_memberships_account_role_fkey"
            columns: ["role"]
            isOneToOne: false
            referencedRelation: "roles"
            referencedColumns: ["name"]
          },
        ]
      }
    }
    Functions: {
      accept_invitation: {
        Args: { token: string; user_id: string }
        Returns: string
      }
      add_invitations_to_account: {
        Args: {
          account_slug: string
          invitations: Database["medreport"]["CompositeTypes"]["invitation"][]
        }
        Returns: Database["medreport"]["Tables"]["invitations"]["Row"][]
      }
      calculate_next_distribution_date: {
        Args: { p_current_date?: string; p_occurrence: string }
        Returns: string
      }
      can_action_account_member: {
        Args: { target_team_account_id: string; target_user_id: string }
        Returns: boolean
      }
      consume_account_balance: {
        Args: {
          p_account_id: string
          p_amount: number
          p_description: string
          p_reference_id?: string
        }
        Returns: boolean
      }
      create_invitation: {
        Args: { account_id: string; email: string; role: string }
        Returns: {
          account_id: string
          created_at: string
          email: string
          expires_at: string
          id: number
          invite_token: string
          invited_by: string
          personal_code: string | null
          role: string
          updated_at: string
        }
      }
      create_nonce: {
        Args: {
          p_expires_in_seconds?: number
          p_metadata?: Json
          p_purpose?: string
          p_revoke_previous?: boolean
          p_scopes?: string[]
          p_user_id?: string
        }
        Returns: Json
      }
      create_team_account: {
        Args:
          | { account_name: string }
          | { account_name: string; new_personal_code: string }
        Returns: {
          application_role: Database["medreport"]["Enums"]["application_role"]
          city: string | null
          created_at: string | null
          created_by: string | null
          email: string | null
          has_consent_anonymized_company_statistics: boolean | null
          has_consent_personal_data: boolean | null
          id: string
          is_personal_account: boolean
          last_name: string | null
          medusa_account_id: string | null
          name: string
          personal_code: string | null
          phone: string | null
          picture_url: string | null
          preferred_locale: Database["medreport"]["Enums"]["locale"] | null
          primary_owner_user_id: string
          slug: string | null
          updated_at: string | null
          updated_by: string | null
        }
      }
      distribute_health_benefits: {
        Args: {
          p_benefit_amount: number
          p_benefit_occurrence?: string
          p_company_id: string
        }
        Returns: undefined
      }
      get_account_balance: {
        Args: { p_account_id: string }
        Returns: number
      }
      get_account_invitations: {
        Args: { account_slug: string }
        Returns: {
          account_id: string
          created_at: string
          email: string
          expires_at: string
          id: number
          invited_by: string
          inviter_email: string
          inviter_name: string
          personal_code: string
          role: string
          updated_at: string
        }[]
      }
      get_account_members: {
        Args: { account_slug: string }
        Returns: {
          account_id: string
          created_at: string
          email: string
          id: string
          name: string
          personal_code: string
          picture_url: string
          primary_owner_user_id: string
          role: string
          role_hierarchy_level: number
          updated_at: string
          user_id: string
        }[]
      }
      get_benefits_usages_for_company_members: {
        Args: {
          p_account_id: string
        }
        Returns: {
          personal_account_id: string
          benefit_amount: number
          benefit_unused_amount: number
        }
      }
      get_config: {
        Args: Record<PropertyKey, never>
        Returns: Json
      }
      get_invitations_with_account_ids: {
        Args: { company_id: string; personal_codes: string[] }
        Returns: {
          account_id: string
          invite_token: string
          personal_code: string
        }[]
      }
      get_latest_analysis_response_elements_for_current_user: {
        Args: { p_user_id: string }
        Returns: {
          analysis_name: string
          analysis_name_lab: string
          norm_lower: number
          norm_status: number
          norm_upper: number
          response_time: string
          response_value: number
        }[]
      }
      get_latest_medipost_dispatch_state_for_order: {
        Args: { medusa_order_id: string }
        Returns: {
          action_date: string
          has_success: boolean
        }[]
      }
      get_medipost_dispatch_tries: {
        Args: { p_medusa_order_id: string }
        Returns: number
      }
      get_nonce_status: {
        Args: { p_id: string }
        Returns: Json
      }
      get_order_possible_actions: {
        Args: { p_medusa_order_id: string }
        Returns: Json
      }
      get_upper_system_role: {
        Args: Record<PropertyKey, never>
        Returns: string
      }
      has_active_subscription: {
        Args: { target_account_id: string }
        Returns: boolean
      }
      has_consent_personal_data: {
        Args: { account_id: string }
        Returns: boolean
      }
      has_more_elevated_role: {
        Args: {
          role_name: string
          target_account_id: string
          target_user_id: string
        }
        Returns: boolean
      }
      has_permission: {
        Args: {
          account_id: string
          permission_name: Database["medreport"]["Enums"]["app_permissions"]
          user_id: string
        }
        Returns: boolean
      }
      has_role_on_account: {
        Args: { account_id: string; account_role?: string }
        Returns: boolean
      }
      has_same_role_hierarchy_level: {
        Args: {
          role_name: string
          target_account_id: string
          target_user_id: string
        }
        Returns: boolean
      }
      has_unseen_membership_confirmation: {
        Args: { p_user_id?: string }
        Returns: boolean
      }
      is_aal2: {
        Args: Record<PropertyKey, never>
        Returns: boolean
      }
      is_account_owner: {
        Args: { account_id: string }
        Returns: boolean
      }
      is_account_team_member: {
        Args: { target_account_id: string }
        Returns: boolean
      }
      is_company_admin: {
        Args: { account_slug: string }
        Returns: boolean
      }
      is_doctor: {
        Args: Record<PropertyKey, never>
        Returns: boolean
      }
      is_mfa_compliant: {
        Args: Record<PropertyKey, never>
        Returns: boolean
      }
      is_set: {
        Args: { field_name: string }
        Returns: boolean
      }
      is_super_admin: {
        Args: Record<PropertyKey, never>
        Returns: boolean
      }
      is_team_member: {
        Args: { account_id: string; user_id: string }
        Returns: boolean
      }
      order_has_medipost_dispatch_error: {
        Args: { medusa_order_id: string }
        Returns: boolean
      }
      process_periodic_benefit_distributions: {
        Args: Record<PropertyKey, never>
        Returns: undefined
      }
      revoke_nonce: {
        Args: { p_id: string; p_reason?: string }
        Returns: boolean
      }
      team_account_workspace: {
        Args: { account_slug: string }
        Returns: {
          account_role: string
          application_role: Database["medreport"]["Enums"]["application_role"]
          id: string
          name: string
          permissions: Database["medreport"]["Enums"]["app_permissions"][]
          picture_url: string
          primary_owner_user_id: string
          role: string
          role_hierarchy_level: number
          slug: string
          subscription_status: Database["medreport"]["Enums"]["subscription_status"]
        }[]
      }
      transfer_team_account_ownership: {
        Args: { new_owner_id: string; target_account_id: string }
        Returns: undefined
      }
      trigger_benefit_distribution: {
        Args: { p_company_id: string }
        Returns: undefined
      }
      update_account: {
        Args:
          | {
              p_city: string
              p_email: string
              p_has_consent_personal_data: boolean
              p_last_name: string
              p_name: string
              p_personal_code: string
              p_phone: string
              p_uid: string
            }
          | {
              p_city: string
              p_has_consent_personal_data: boolean
              p_last_name: string
              p_name: string
              p_personal_code: string
              p_phone: string
              p_uid: string
            }
        Returns: undefined
      }
      update_analysis_order_status: {
        Args: {
          medusa_order_id_param: string
          order_id: number
          status_param: Database["medreport"]["Enums"]["analysis_order_status"]
        }
        Returns: {
          analysis_element_ids: number[] | null
          analysis_ids: number[] | null
          created_at: string
          id: number
          medusa_order_id: string
          status: Database["medreport"]["Enums"]["analysis_order_status"]
          user_id: string
        }
      }
      upsert_benefit_distribution_schedule: {
        Args: {
          p_benefit_amount: number
          p_benefit_occurrence: string
          p_company_id: string
        }
        Returns: undefined
      }
      upsert_order: {
        Args: {
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          currency: string
          line_items: Json
          status: Database["medreport"]["Enums"]["payment_status"]
          target_account_id: string
          target_customer_id: string
          target_order_id: string
          total_amount: number
        }
        Returns: {
          account_id: string
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          created_at: string
          currency: string
          id: string
          status: Database["medreport"]["Enums"]["payment_status"]
          total_amount: number
          updated_at: string
        }
      }
      upsert_subscription: {
        Args: {
          active: boolean
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          cancel_at_period_end: boolean
          currency: string
          line_items: Json
          period_ends_at: string
          period_starts_at: string
          status: Database["medreport"]["Enums"]["subscription_status"]
          target_account_id: string
          target_customer_id: string
          target_subscription_id: string
          trial_ends_at?: string
          trial_starts_at?: string
        }
        Returns: {
          account_id: string
          active: boolean
          billing_customer_id: number
          billing_provider: Database["medreport"]["Enums"]["billing_provider"]
          cancel_at_period_end: boolean
          created_at: string
          currency: string
          id: string
          period_ends_at: string
          period_starts_at: string
          status: Database["medreport"]["Enums"]["subscription_status"]
          trial_ends_at: string | null
          trial_starts_at: string | null
          updated_at: string
        }
      }
      verify_nonce: {
        Args: {
          p_ip?: unknown
          p_max_verification_attempts?: number
          p_purpose: string
          p_required_scopes?: string[]
          p_token: string
          p_user_agent?: string
          p_user_id?: string
        }
        Returns: Json
      }
    }
    Enums: {
      analysis_feedback_status: "STARTED" | "DRAFT" | "COMPLETED"
      analysis_order_status:
        | "QUEUED"
        | "ON_HOLD"
        | "PROCESSING"
        | "COMPLETED"
        | "REJECTED"
        | "CANCELLED"
        | "PARTIAL_ANALYSIS_RESPONSE"
        | "FULL_ANALYSIS_RESPONSE"
        | "WAITING_FOR_DOCTOR_RESPONSE"
      app_permissions:
        | "roles.manage"
        | "billing.manage"
        | "settings.manage"
        | "members.manage"
        | "invites.manage"
      application_role: "user" | "doctor" | "super_admin"
      billing_provider: "stripe" | "lemon-squeezy" | "paddle" | "montonio"
      connected_online_order_status:
        | "PENDING"
        | "CONFIRMED"
        | "REJECTED"
        | "CANCELLED"
      locale: "en" | "et" | "ru"
      notification_channel: "in_app" | "email"
      notification_type: "info" | "warning" | "error"
      payment_status: "pending" | "succeeded" | "failed"
      subscription_item_type: "flat" | "per_seat" | "metered"
      subscription_status:
        | "active"
        | "trialing"
        | "past_due"
        | "canceled"
        | "unpaid"
        | "incomplete"
        | "incomplete_expired"
        | "paused"
    }
    CompositeTypes: {
      invitation: {
        email: string | null
        role: string | null
        personal_code: string | null
      }
    }
  }
  public: {
    Tables: {
      account_holder: {
        Row: {
          created_at: string
          data: Json
          deleted_at: string | null
          email: string | null
          external_id: string
          id: string
          metadata: Json | null
          provider_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          data?: Json
          deleted_at?: string | null
          email?: string | null
          external_id: string
          id: string
          metadata?: Json | null
          provider_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          data?: Json
          deleted_at?: string | null
          email?: string | null
          external_id?: string
          id?: string
          metadata?: Json | null
          provider_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      api_key: {
        Row: {
          created_at: string
          created_by: string
          deleted_at: string | null
          id: string
          last_used_at: string | null
          redacted: string
          revoked_at: string | null
          revoked_by: string | null
          salt: string
          title: string
          token: string
          type: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          created_by: string
          deleted_at?: string | null
          id: string
          last_used_at?: string | null
          redacted: string
          revoked_at?: string | null
          revoked_by?: string | null
          salt: string
          title: string
          token: string
          type: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          created_by?: string
          deleted_at?: string | null
          id?: string
          last_used_at?: string | null
          redacted?: string
          revoked_at?: string | null
          revoked_by?: string | null
          salt?: string
          title?: string
          token?: string
          type?: string
          updated_at?: string
        }
        Relationships: []
      }
      application_method_buy_rules: {
        Row: {
          application_method_id: string
          promotion_rule_id: string
        }
        Insert: {
          application_method_id: string
          promotion_rule_id: string
        }
        Update: {
          application_method_id?: string
          promotion_rule_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "application_method_buy_rules_application_method_id_foreign"
            columns: ["application_method_id"]
            isOneToOne: false
            referencedRelation: "promotion_application_method"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "application_method_buy_rules_promotion_rule_id_foreign"
            columns: ["promotion_rule_id"]
            isOneToOne: false
            referencedRelation: "promotion_rule"
            referencedColumns: ["id"]
          },
        ]
      }
      application_method_target_rules: {
        Row: {
          application_method_id: string
          promotion_rule_id: string
        }
        Insert: {
          application_method_id: string
          promotion_rule_id: string
        }
        Update: {
          application_method_id?: string
          promotion_rule_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "application_method_target_rules_application_method_id_foreign"
            columns: ["application_method_id"]
            isOneToOne: false
            referencedRelation: "promotion_application_method"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "application_method_target_rules_promotion_rule_id_foreign"
            columns: ["promotion_rule_id"]
            isOneToOne: false
            referencedRelation: "promotion_rule"
            referencedColumns: ["id"]
          },
        ]
      }
      auth_identity: {
        Row: {
          app_metadata: Json | null
          created_at: string
          deleted_at: string | null
          id: string
          updated_at: string
        }
        Insert: {
          app_metadata?: Json | null
          created_at?: string
          deleted_at?: string | null
          id: string
          updated_at?: string
        }
        Update: {
          app_metadata?: Json | null
          created_at?: string
          deleted_at?: string | null
          id?: string
          updated_at?: string
        }
        Relationships: []
      }
      capture: {
        Row: {
          amount: number
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          payment_id: string
          raw_amount: Json
          updated_at: string
        }
        Insert: {
          amount: number
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          payment_id: string
          raw_amount: Json
          updated_at?: string
        }
        Update: {
          amount?: number
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          payment_id?: string
          raw_amount?: Json
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "capture_payment_id_foreign"
            columns: ["payment_id"]
            isOneToOne: false
            referencedRelation: "payment"
            referencedColumns: ["id"]
          },
        ]
      }
      cart: {
        Row: {
          billing_address_id: string | null
          completed_at: string | null
          created_at: string
          currency_code: string
          customer_id: string | null
          deleted_at: string | null
          email: string | null
          id: string
          metadata: Json | null
          region_id: string | null
          sales_channel_id: string | null
          shipping_address_id: string | null
          updated_at: string
        }
        Insert: {
          billing_address_id?: string | null
          completed_at?: string | null
          created_at?: string
          currency_code: string
          customer_id?: string | null
          deleted_at?: string | null
          email?: string | null
          id: string
          metadata?: Json | null
          region_id?: string | null
          sales_channel_id?: string | null
          shipping_address_id?: string | null
          updated_at?: string
        }
        Update: {
          billing_address_id?: string | null
          completed_at?: string | null
          created_at?: string
          currency_code?: string
          customer_id?: string | null
          deleted_at?: string | null
          email?: string | null
          id?: string
          metadata?: Json | null
          region_id?: string | null
          sales_channel_id?: string | null
          shipping_address_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_billing_address_id_foreign"
            columns: ["billing_address_id"]
            isOneToOne: false
            referencedRelation: "cart_address"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "cart_shipping_address_id_foreign"
            columns: ["shipping_address_id"]
            isOneToOne: false
            referencedRelation: "cart_address"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_address: {
        Row: {
          address_1: string | null
          address_2: string | null
          city: string | null
          company: string | null
          country_code: string | null
          created_at: string
          customer_id: string | null
          deleted_at: string | null
          first_name: string | null
          id: string
          last_name: string | null
          metadata: Json | null
          phone: string | null
          postal_code: string | null
          province: string | null
          updated_at: string
        }
        Insert: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id?: string | null
          deleted_at?: string | null
          first_name?: string | null
          id: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Update: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id?: string | null
          deleted_at?: string | null
          first_name?: string | null
          id?: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      cart_line_item: {
        Row: {
          cart_id: string
          compare_at_unit_price: number | null
          created_at: string
          deleted_at: string | null
          id: string
          is_custom_price: boolean
          is_discountable: boolean
          is_giftcard: boolean
          is_tax_inclusive: boolean
          metadata: Json | null
          product_collection: string | null
          product_description: string | null
          product_handle: string | null
          product_id: string | null
          product_subtitle: string | null
          product_title: string | null
          product_type: string | null
          product_type_id: string | null
          quantity: number
          raw_compare_at_unit_price: Json | null
          raw_unit_price: Json
          requires_shipping: boolean
          subtitle: string | null
          thumbnail: string | null
          title: string
          unit_price: number
          updated_at: string
          variant_barcode: string | null
          variant_id: string | null
          variant_option_values: Json | null
          variant_sku: string | null
          variant_title: string | null
        }
        Insert: {
          cart_id: string
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          id: string
          is_custom_price?: boolean
          is_discountable?: boolean
          is_giftcard?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          product_collection?: string | null
          product_description?: string | null
          product_handle?: string | null
          product_id?: string | null
          product_subtitle?: string | null
          product_title?: string | null
          product_type?: string | null
          product_type_id?: string | null
          quantity: number
          raw_compare_at_unit_price?: Json | null
          raw_unit_price: Json
          requires_shipping?: boolean
          subtitle?: string | null
          thumbnail?: string | null
          title: string
          unit_price: number
          updated_at?: string
          variant_barcode?: string | null
          variant_id?: string | null
          variant_option_values?: Json | null
          variant_sku?: string | null
          variant_title?: string | null
        }
        Update: {
          cart_id?: string
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_custom_price?: boolean
          is_discountable?: boolean
          is_giftcard?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          product_collection?: string | null
          product_description?: string | null
          product_handle?: string | null
          product_id?: string | null
          product_subtitle?: string | null
          product_title?: string | null
          product_type?: string | null
          product_type_id?: string | null
          quantity?: number
          raw_compare_at_unit_price?: Json | null
          raw_unit_price?: Json
          requires_shipping?: boolean
          subtitle?: string | null
          thumbnail?: string | null
          title?: string
          unit_price?: number
          updated_at?: string
          variant_barcode?: string | null
          variant_id?: string | null
          variant_option_values?: Json | null
          variant_sku?: string | null
          variant_title?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "cart_line_item_cart_id_foreign"
            columns: ["cart_id"]
            isOneToOne: false
            referencedRelation: "cart"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_line_item_adjustment: {
        Row: {
          amount: number
          code: string | null
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          is_tax_inclusive: boolean
          item_id: string | null
          metadata: Json | null
          promotion_id: string | null
          provider_id: string | null
          raw_amount: Json
          updated_at: string
        }
        Insert: {
          amount: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          is_tax_inclusive?: boolean
          item_id?: string | null
          metadata?: Json | null
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount: Json
          updated_at?: string
        }
        Update: {
          amount?: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          is_tax_inclusive?: boolean
          item_id?: string | null
          metadata?: Json | null
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount?: Json
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_line_item_adjustment_item_id_foreign"
            columns: ["item_id"]
            isOneToOne: false
            referencedRelation: "cart_line_item"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_line_item_tax_line: {
        Row: {
          code: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          item_id: string | null
          metadata: Json | null
          provider_id: string | null
          rate: number
          tax_rate_id: string | null
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          item_id?: string | null
          metadata?: Json | null
          provider_id?: string | null
          rate: number
          tax_rate_id?: string | null
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          item_id?: string | null
          metadata?: Json | null
          provider_id?: string | null
          rate?: number
          tax_rate_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_line_item_tax_line_item_id_foreign"
            columns: ["item_id"]
            isOneToOne: false
            referencedRelation: "cart_line_item"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_payment_collection: {
        Row: {
          cart_id: string
          created_at: string
          deleted_at: string | null
          id: string
          payment_collection_id: string
          updated_at: string
        }
        Insert: {
          cart_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          payment_collection_id: string
          updated_at?: string
        }
        Update: {
          cart_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          payment_collection_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      cart_promotion: {
        Row: {
          cart_id: string
          created_at: string
          deleted_at: string | null
          id: string
          promotion_id: string
          updated_at: string
        }
        Insert: {
          cart_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          promotion_id: string
          updated_at?: string
        }
        Update: {
          cart_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          promotion_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      cart_shipping_method: {
        Row: {
          amount: number
          cart_id: string
          created_at: string
          data: Json | null
          deleted_at: string | null
          description: Json | null
          id: string
          is_tax_inclusive: boolean
          metadata: Json | null
          name: string
          raw_amount: Json
          shipping_option_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          cart_id: string
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          description?: Json | null
          id: string
          is_tax_inclusive?: boolean
          metadata?: Json | null
          name: string
          raw_amount: Json
          shipping_option_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          cart_id?: string
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          description?: Json | null
          id?: string
          is_tax_inclusive?: boolean
          metadata?: Json | null
          name?: string
          raw_amount?: Json
          shipping_option_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_shipping_method_cart_id_foreign"
            columns: ["cart_id"]
            isOneToOne: false
            referencedRelation: "cart"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_shipping_method_adjustment: {
        Row: {
          amount: number
          code: string | null
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          metadata: Json | null
          promotion_id: string | null
          provider_id: string | null
          raw_amount: Json
          shipping_method_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          metadata?: Json | null
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount: Json
          shipping_method_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          metadata?: Json | null
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount?: Json
          shipping_method_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_shipping_method_adjustment_shipping_method_id_foreign"
            columns: ["shipping_method_id"]
            isOneToOne: false
            referencedRelation: "cart_shipping_method"
            referencedColumns: ["id"]
          },
        ]
      }
      cart_shipping_method_tax_line: {
        Row: {
          code: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          metadata: Json | null
          provider_id: string | null
          rate: number
          shipping_method_id: string | null
          tax_rate_id: string | null
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          metadata?: Json | null
          provider_id?: string | null
          rate: number
          shipping_method_id?: string | null
          tax_rate_id?: string | null
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          metadata?: Json | null
          provider_id?: string | null
          rate?: number
          shipping_method_id?: string | null
          tax_rate_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "cart_shipping_method_tax_line_shipping_method_id_foreign"
            columns: ["shipping_method_id"]
            isOneToOne: false
            referencedRelation: "cart_shipping_method"
            referencedColumns: ["id"]
          },
        ]
      }
      credit_line: {
        Row: {
          amount: number
          cart_id: string
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          raw_amount: Json
          reference: string | null
          reference_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          cart_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          raw_amount: Json
          reference?: string | null
          reference_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          cart_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          raw_amount?: Json
          reference?: string | null
          reference_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "credit_line_cart_id_foreign"
            columns: ["cart_id"]
            isOneToOne: false
            referencedRelation: "cart"
            referencedColumns: ["id"]
          },
        ]
      }
      currency: {
        Row: {
          code: string
          created_at: string
          decimal_digits: number
          deleted_at: string | null
          name: string
          raw_rounding: Json
          rounding: number
          symbol: string
          symbol_native: string
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          decimal_digits?: number
          deleted_at?: string | null
          name: string
          raw_rounding: Json
          rounding?: number
          symbol: string
          symbol_native: string
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          decimal_digits?: number
          deleted_at?: string | null
          name?: string
          raw_rounding?: Json
          rounding?: number
          symbol?: string
          symbol_native?: string
          updated_at?: string
        }
        Relationships: []
      }
      customer: {
        Row: {
          company_name: string | null
          created_at: string
          created_by: string | null
          deleted_at: string | null
          email: string | null
          first_name: string | null
          has_account: boolean
          id: string
          last_name: string | null
          metadata: Json | null
          phone: string | null
          updated_at: string
        }
        Insert: {
          company_name?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          email?: string | null
          first_name?: string | null
          has_account?: boolean
          id: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          updated_at?: string
        }
        Update: {
          company_name?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          email?: string | null
          first_name?: string | null
          has_account?: boolean
          id?: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      customer_account_holder: {
        Row: {
          account_holder_id: string
          created_at: string
          customer_id: string
          deleted_at: string | null
          id: string
          updated_at: string
        }
        Insert: {
          account_holder_id: string
          created_at?: string
          customer_id: string
          deleted_at?: string | null
          id: string
          updated_at?: string
        }
        Update: {
          account_holder_id?: string
          created_at?: string
          customer_id?: string
          deleted_at?: string | null
          id?: string
          updated_at?: string
        }
        Relationships: []
      }
      customer_address: {
        Row: {
          address_1: string | null
          address_2: string | null
          address_name: string | null
          city: string | null
          company: string | null
          country_code: string | null
          created_at: string
          customer_id: string
          deleted_at: string | null
          first_name: string | null
          id: string
          is_default_billing: boolean
          is_default_shipping: boolean
          last_name: string | null
          metadata: Json | null
          phone: string | null
          postal_code: string | null
          province: string | null
          updated_at: string
        }
        Insert: {
          address_1?: string | null
          address_2?: string | null
          address_name?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id: string
          deleted_at?: string | null
          first_name?: string | null
          id: string
          is_default_billing?: boolean
          is_default_shipping?: boolean
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Update: {
          address_1?: string | null
          address_2?: string | null
          address_name?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id?: string
          deleted_at?: string | null
          first_name?: string | null
          id?: string
          is_default_billing?: boolean
          is_default_shipping?: boolean
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "customer_address_customer_id_foreign"
            columns: ["customer_id"]
            isOneToOne: false
            referencedRelation: "customer"
            referencedColumns: ["id"]
          },
        ]
      }
      customer_group: {
        Row: {
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: []
      }
      customer_group_customer: {
        Row: {
          created_at: string
          created_by: string | null
          customer_group_id: string
          customer_id: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          updated_at: string
        }
        Insert: {
          created_at?: string
          created_by?: string | null
          customer_group_id: string
          customer_id: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          updated_at?: string
        }
        Update: {
          created_at?: string
          created_by?: string | null
          customer_group_id?: string
          customer_id?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "customer_group_customer_customer_group_id_foreign"
            columns: ["customer_group_id"]
            isOneToOne: false
            referencedRelation: "customer_group"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "customer_group_customer_customer_id_foreign"
            columns: ["customer_id"]
            isOneToOne: false
            referencedRelation: "customer"
            referencedColumns: ["id"]
          },
        ]
      }
      fulfillment: {
        Row: {
          canceled_at: string | null
          created_at: string
          created_by: string | null
          data: Json | null
          deleted_at: string | null
          delivered_at: string | null
          delivery_address_id: string | null
          id: string
          location_id: string
          marked_shipped_by: string | null
          metadata: Json | null
          packed_at: string | null
          provider_id: string | null
          requires_shipping: boolean
          shipped_at: string | null
          shipping_option_id: string | null
          updated_at: string
        }
        Insert: {
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          data?: Json | null
          deleted_at?: string | null
          delivered_at?: string | null
          delivery_address_id?: string | null
          id: string
          location_id: string
          marked_shipped_by?: string | null
          metadata?: Json | null
          packed_at?: string | null
          provider_id?: string | null
          requires_shipping?: boolean
          shipped_at?: string | null
          shipping_option_id?: string | null
          updated_at?: string
        }
        Update: {
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          data?: Json | null
          deleted_at?: string | null
          delivered_at?: string | null
          delivery_address_id?: string | null
          id?: string
          location_id?: string
          marked_shipped_by?: string | null
          metadata?: Json | null
          packed_at?: string | null
          provider_id?: string | null
          requires_shipping?: boolean
          shipped_at?: string | null
          shipping_option_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "fulfillment_delivery_address_id_foreign"
            columns: ["delivery_address_id"]
            isOneToOne: false
            referencedRelation: "fulfillment_address"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "fulfillment_provider_id_foreign"
            columns: ["provider_id"]
            isOneToOne: false
            referencedRelation: "fulfillment_provider"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "fulfillment_shipping_option_id_foreign"
            columns: ["shipping_option_id"]
            isOneToOne: false
            referencedRelation: "shipping_option"
            referencedColumns: ["id"]
          },
        ]
      }
      fulfillment_address: {
        Row: {
          address_1: string | null
          address_2: string | null
          city: string | null
          company: string | null
          country_code: string | null
          created_at: string
          deleted_at: string | null
          first_name: string | null
          id: string
          last_name: string | null
          metadata: Json | null
          phone: string | null
          postal_code: string | null
          province: string | null
          updated_at: string
        }
        Insert: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          deleted_at?: string | null
          first_name?: string | null
          id: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Update: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          deleted_at?: string | null
          first_name?: string | null
          id?: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      fulfillment_item: {
        Row: {
          barcode: string
          created_at: string
          deleted_at: string | null
          fulfillment_id: string
          id: string
          inventory_item_id: string | null
          line_item_id: string | null
          quantity: number
          raw_quantity: Json
          sku: string
          title: string
          updated_at: string
        }
        Insert: {
          barcode: string
          created_at?: string
          deleted_at?: string | null
          fulfillment_id: string
          id: string
          inventory_item_id?: string | null
          line_item_id?: string | null
          quantity: number
          raw_quantity: Json
          sku: string
          title: string
          updated_at?: string
        }
        Update: {
          barcode?: string
          created_at?: string
          deleted_at?: string | null
          fulfillment_id?: string
          id?: string
          inventory_item_id?: string | null
          line_item_id?: string | null
          quantity?: number
          raw_quantity?: Json
          sku?: string
          title?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "fulfillment_item_fulfillment_id_foreign"
            columns: ["fulfillment_id"]
            isOneToOne: false
            referencedRelation: "fulfillment"
            referencedColumns: ["id"]
          },
        ]
      }
      fulfillment_label: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_id: string
          id: string
          label_url: string
          tracking_number: string
          tracking_url: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id: string
          id: string
          label_url: string
          tracking_number: string
          tracking_url: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id?: string
          id?: string
          label_url?: string
          tracking_number?: string
          tracking_url?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "fulfillment_label_fulfillment_id_foreign"
            columns: ["fulfillment_id"]
            isOneToOne: false
            referencedRelation: "fulfillment"
            referencedColumns: ["id"]
          },
        ]
      }
      fulfillment_provider: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          is_enabled: boolean
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          is_enabled?: boolean
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_enabled?: boolean
          updated_at?: string
        }
        Relationships: []
      }
      fulfillment_set: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          type: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          type: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          type?: string
          updated_at?: string
        }
        Relationships: []
      }
      geo_zone: {
        Row: {
          city: string | null
          country_code: string
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          postal_expression: Json | null
          province_code: string | null
          service_zone_id: string
          type: string
          updated_at: string
        }
        Insert: {
          city?: string | null
          country_code: string
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          postal_expression?: Json | null
          province_code?: string | null
          service_zone_id: string
          type?: string
          updated_at?: string
        }
        Update: {
          city?: string | null
          country_code?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          postal_expression?: Json | null
          province_code?: string | null
          service_zone_id?: string
          type?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "geo_zone_service_zone_id_foreign"
            columns: ["service_zone_id"]
            isOneToOne: false
            referencedRelation: "service_zone"
            referencedColumns: ["id"]
          },
        ]
      }
      image: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          product_id: string
          rank: number
          updated_at: string
          url: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          product_id: string
          rank?: number
          updated_at?: string
          url: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          product_id?: string
          rank?: number
          updated_at?: string
          url?: string
        }
        Relationships: [
          {
            foreignKeyName: "image_product_id_foreign"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "product"
            referencedColumns: ["id"]
          },
        ]
      }
      inventory_item: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string | null
          height: number | null
          hs_code: string | null
          id: string
          length: number | null
          material: string | null
          metadata: Json | null
          mid_code: string | null
          origin_country: string | null
          requires_shipping: boolean
          sku: string | null
          thumbnail: string | null
          title: string | null
          updated_at: string
          weight: number | null
          width: number | null
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          height?: number | null
          hs_code?: string | null
          id: string
          length?: number | null
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          requires_shipping?: boolean
          sku?: string | null
          thumbnail?: string | null
          title?: string | null
          updated_at?: string
          weight?: number | null
          width?: number | null
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          height?: number | null
          hs_code?: string | null
          id?: string
          length?: number | null
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          requires_shipping?: boolean
          sku?: string | null
          thumbnail?: string | null
          title?: string | null
          updated_at?: string
          weight?: number | null
          width?: number | null
        }
        Relationships: []
      }
      inventory_level: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          incoming_quantity: number
          inventory_item_id: string
          location_id: string
          metadata: Json | null
          raw_incoming_quantity: Json | null
          raw_reserved_quantity: Json | null
          raw_stocked_quantity: Json | null
          reserved_quantity: number
          stocked_quantity: number
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          incoming_quantity?: number
          inventory_item_id: string
          location_id: string
          metadata?: Json | null
          raw_incoming_quantity?: Json | null
          raw_reserved_quantity?: Json | null
          raw_stocked_quantity?: Json | null
          reserved_quantity?: number
          stocked_quantity?: number
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          incoming_quantity?: number
          inventory_item_id?: string
          location_id?: string
          metadata?: Json | null
          raw_incoming_quantity?: Json | null
          raw_reserved_quantity?: Json | null
          raw_stocked_quantity?: Json | null
          reserved_quantity?: number
          stocked_quantity?: number
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "inventory_level_inventory_item_id_foreign"
            columns: ["inventory_item_id"]
            isOneToOne: false
            referencedRelation: "inventory_item"
            referencedColumns: ["id"]
          },
        ]
      }
      invite: {
        Row: {
          accepted: boolean
          created_at: string
          deleted_at: string | null
          email: string
          expires_at: string
          id: string
          metadata: Json | null
          token: string
          updated_at: string
        }
        Insert: {
          accepted?: boolean
          created_at?: string
          deleted_at?: string | null
          email: string
          expires_at: string
          id: string
          metadata?: Json | null
          token: string
          updated_at?: string
        }
        Update: {
          accepted?: boolean
          created_at?: string
          deleted_at?: string | null
          email?: string
          expires_at?: string
          id?: string
          metadata?: Json | null
          token?: string
          updated_at?: string
        }
        Relationships: []
      }
      link_module_migrations: {
        Row: {
          created_at: string | null
          id: number
          link_descriptor: Json
          table_name: string
        }
        Insert: {
          created_at?: string | null
          id?: number
          link_descriptor?: Json
          table_name: string
        }
        Update: {
          created_at?: string | null
          id?: number
          link_descriptor?: Json
          table_name?: string
        }
        Relationships: []
      }
      location_fulfillment_provider: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_provider_id: string
          id: string
          stock_location_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_provider_id: string
          id: string
          stock_location_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_provider_id?: string
          id?: string
          stock_location_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      location_fulfillment_set: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_set_id: string
          id: string
          stock_location_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_set_id: string
          id: string
          stock_location_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_set_id?: string
          id?: string
          stock_location_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      mikro_orm_migrations: {
        Row: {
          executed_at: string | null
          id: number
          name: string | null
        }
        Insert: {
          executed_at?: string | null
          id?: number
          name?: string | null
        }
        Update: {
          executed_at?: string | null
          id?: number
          name?: string | null
        }
        Relationships: []
      }
      notification: {
        Row: {
          channel: string
          created_at: string
          data: Json | null
          deleted_at: string | null
          external_id: string | null
          id: string
          idempotency_key: string | null
          original_notification_id: string | null
          provider_id: string | null
          receiver_id: string | null
          resource_id: string | null
          resource_type: string | null
          status: string
          template: string
          to: string
          trigger_type: string | null
          updated_at: string
        }
        Insert: {
          channel: string
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          external_id?: string | null
          id: string
          idempotency_key?: string | null
          original_notification_id?: string | null
          provider_id?: string | null
          receiver_id?: string | null
          resource_id?: string | null
          resource_type?: string | null
          status?: string
          template: string
          to: string
          trigger_type?: string | null
          updated_at?: string
        }
        Update: {
          channel?: string
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          external_id?: string | null
          id?: string
          idempotency_key?: string | null
          original_notification_id?: string | null
          provider_id?: string | null
          receiver_id?: string | null
          resource_id?: string | null
          resource_type?: string | null
          status?: string
          template?: string
          to?: string
          trigger_type?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "notification_provider_id_foreign"
            columns: ["provider_id"]
            isOneToOne: false
            referencedRelation: "notification_provider"
            referencedColumns: ["id"]
          },
        ]
      }
      notification_provider: {
        Row: {
          channels: string[]
          created_at: string
          deleted_at: string | null
          handle: string
          id: string
          is_enabled: boolean
          name: string
          updated_at: string
        }
        Insert: {
          channels?: string[]
          created_at?: string
          deleted_at?: string | null
          handle: string
          id: string
          is_enabled?: boolean
          name: string
          updated_at?: string
        }
        Update: {
          channels?: string[]
          created_at?: string
          deleted_at?: string | null
          handle?: string
          id?: string
          is_enabled?: boolean
          name?: string
          updated_at?: string
        }
        Relationships: []
      }
      order: {
        Row: {
          billing_address_id: string | null
          canceled_at: string | null
          created_at: string
          currency_code: string
          customer_id: string | null
          deleted_at: string | null
          display_id: number | null
          email: string | null
          id: string
          is_draft_order: boolean
          metadata: Json | null
          no_notification: boolean | null
          region_id: string | null
          sales_channel_id: string | null
          shipping_address_id: string | null
          status: Database["public"]["Enums"]["order_status_enum"]
          updated_at: string
          version: number
        }
        Insert: {
          billing_address_id?: string | null
          canceled_at?: string | null
          created_at?: string
          currency_code: string
          customer_id?: string | null
          deleted_at?: string | null
          display_id?: number | null
          email?: string | null
          id: string
          is_draft_order?: boolean
          metadata?: Json | null
          no_notification?: boolean | null
          region_id?: string | null
          sales_channel_id?: string | null
          shipping_address_id?: string | null
          status?: Database["public"]["Enums"]["order_status_enum"]
          updated_at?: string
          version?: number
        }
        Update: {
          billing_address_id?: string | null
          canceled_at?: string | null
          created_at?: string
          currency_code?: string
          customer_id?: string | null
          deleted_at?: string | null
          display_id?: number | null
          email?: string | null
          id?: string
          is_draft_order?: boolean
          metadata?: Json | null
          no_notification?: boolean | null
          region_id?: string | null
          sales_channel_id?: string | null
          shipping_address_id?: string | null
          status?: Database["public"]["Enums"]["order_status_enum"]
          updated_at?: string
          version?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_billing_address_id_foreign"
            columns: ["billing_address_id"]
            isOneToOne: false
            referencedRelation: "order_address"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "order_shipping_address_id_foreign"
            columns: ["shipping_address_id"]
            isOneToOne: false
            referencedRelation: "order_address"
            referencedColumns: ["id"]
          },
        ]
      }
      order_address: {
        Row: {
          address_1: string | null
          address_2: string | null
          city: string | null
          company: string | null
          country_code: string | null
          created_at: string
          customer_id: string | null
          deleted_at: string | null
          first_name: string | null
          id: string
          last_name: string | null
          metadata: Json | null
          phone: string | null
          postal_code: string | null
          province: string | null
          updated_at: string
        }
        Insert: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id?: string | null
          deleted_at?: string | null
          first_name?: string | null
          id: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Update: {
          address_1?: string | null
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string | null
          created_at?: string
          customer_id?: string | null
          deleted_at?: string | null
          first_name?: string | null
          id?: string
          last_name?: string | null
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      order_cart: {
        Row: {
          cart_id: string
          created_at: string
          deleted_at: string | null
          id: string
          order_id: string
          updated_at: string
        }
        Insert: {
          cart_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          order_id: string
          updated_at?: string
        }
        Update: {
          cart_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          order_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      order_change: {
        Row: {
          canceled_at: string | null
          canceled_by: string | null
          change_type: string | null
          claim_id: string | null
          confirmed_at: string | null
          confirmed_by: string | null
          created_at: string
          created_by: string | null
          declined_at: string | null
          declined_by: string | null
          declined_reason: string | null
          deleted_at: string | null
          description: string | null
          exchange_id: string | null
          id: string
          internal_note: string | null
          metadata: Json | null
          order_id: string
          requested_at: string | null
          requested_by: string | null
          return_id: string | null
          status: string
          updated_at: string
          version: number
        }
        Insert: {
          canceled_at?: string | null
          canceled_by?: string | null
          change_type?: string | null
          claim_id?: string | null
          confirmed_at?: string | null
          confirmed_by?: string | null
          created_at?: string
          created_by?: string | null
          declined_at?: string | null
          declined_by?: string | null
          declined_reason?: string | null
          deleted_at?: string | null
          description?: string | null
          exchange_id?: string | null
          id: string
          internal_note?: string | null
          metadata?: Json | null
          order_id: string
          requested_at?: string | null
          requested_by?: string | null
          return_id?: string | null
          status?: string
          updated_at?: string
          version: number
        }
        Update: {
          canceled_at?: string | null
          canceled_by?: string | null
          change_type?: string | null
          claim_id?: string | null
          confirmed_at?: string | null
          confirmed_by?: string | null
          created_at?: string
          created_by?: string | null
          declined_at?: string | null
          declined_by?: string | null
          declined_reason?: string | null
          deleted_at?: string | null
          description?: string | null
          exchange_id?: string | null
          id?: string
          internal_note?: string | null
          metadata?: Json | null
          order_id?: string
          requested_at?: string | null
          requested_by?: string | null
          return_id?: string | null
          status?: string
          updated_at?: string
          version?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_change_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      order_change_action: {
        Row: {
          action: string
          amount: number | null
          applied: boolean
          claim_id: string | null
          created_at: string
          deleted_at: string | null
          details: Json | null
          exchange_id: string | null
          id: string
          internal_note: string | null
          order_change_id: string | null
          order_id: string | null
          ordering: number
          raw_amount: Json | null
          reference: string | null
          reference_id: string | null
          return_id: string | null
          updated_at: string
          version: number | null
        }
        Insert: {
          action: string
          amount?: number | null
          applied?: boolean
          claim_id?: string | null
          created_at?: string
          deleted_at?: string | null
          details?: Json | null
          exchange_id?: string | null
          id: string
          internal_note?: string | null
          order_change_id?: string | null
          order_id?: string | null
          ordering?: number
          raw_amount?: Json | null
          reference?: string | null
          reference_id?: string | null
          return_id?: string | null
          updated_at?: string
          version?: number | null
        }
        Update: {
          action?: string
          amount?: number | null
          applied?: boolean
          claim_id?: string | null
          created_at?: string
          deleted_at?: string | null
          details?: Json | null
          exchange_id?: string | null
          id?: string
          internal_note?: string | null
          order_change_id?: string | null
          order_id?: string | null
          ordering?: number
          raw_amount?: Json | null
          reference?: string | null
          reference_id?: string | null
          return_id?: string | null
          updated_at?: string
          version?: number | null
        }
        Relationships: [
          {
            foreignKeyName: "order_change_action_order_change_id_foreign"
            columns: ["order_change_id"]
            isOneToOne: false
            referencedRelation: "order_change"
            referencedColumns: ["id"]
          },
        ]
      }
      order_claim: {
        Row: {
          canceled_at: string | null
          created_at: string
          created_by: string | null
          deleted_at: string | null
          display_id: number
          id: string
          metadata: Json | null
          no_notification: boolean | null
          order_id: string
          order_version: number
          raw_refund_amount: Json | null
          refund_amount: number | null
          return_id: string | null
          type: Database["public"]["Enums"]["order_claim_type_enum"]
          updated_at: string
        }
        Insert: {
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          display_id?: number
          id: string
          metadata?: Json | null
          no_notification?: boolean | null
          order_id: string
          order_version: number
          raw_refund_amount?: Json | null
          refund_amount?: number | null
          return_id?: string | null
          type: Database["public"]["Enums"]["order_claim_type_enum"]
          updated_at?: string
        }
        Update: {
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          display_id?: number
          id?: string
          metadata?: Json | null
          no_notification?: boolean | null
          order_id?: string
          order_version?: number
          raw_refund_amount?: Json | null
          refund_amount?: number | null
          return_id?: string | null
          type?: Database["public"]["Enums"]["order_claim_type_enum"]
          updated_at?: string
        }
        Relationships: []
      }
      order_claim_item: {
        Row: {
          claim_id: string
          created_at: string
          deleted_at: string | null
          id: string
          is_additional_item: boolean
          item_id: string
          metadata: Json | null
          note: string | null
          quantity: number
          raw_quantity: Json
          reason: Database["public"]["Enums"]["claim_reason_enum"] | null
          updated_at: string
        }
        Insert: {
          claim_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          is_additional_item?: boolean
          item_id: string
          metadata?: Json | null
          note?: string | null
          quantity: number
          raw_quantity: Json
          reason?: Database["public"]["Enums"]["claim_reason_enum"] | null
          updated_at?: string
        }
        Update: {
          claim_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_additional_item?: boolean
          item_id?: string
          metadata?: Json | null
          note?: string | null
          quantity?: number
          raw_quantity?: Json
          reason?: Database["public"]["Enums"]["claim_reason_enum"] | null
          updated_at?: string
        }
        Relationships: []
      }
      order_claim_item_image: {
        Row: {
          claim_item_id: string
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          updated_at: string
          url: string
        }
        Insert: {
          claim_item_id: string
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          updated_at?: string
          url: string
        }
        Update: {
          claim_item_id?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          updated_at?: string
          url?: string
        }
        Relationships: []
      }
      order_credit_line: {
        Row: {
          amount: number
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          order_id: string
          raw_amount: Json
          reference: string | null
          reference_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          order_id: string
          raw_amount: Json
          reference?: string | null
          reference_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          order_id?: string
          raw_amount?: Json
          reference?: string | null
          reference_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_credit_line_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      order_exchange: {
        Row: {
          allow_backorder: boolean
          canceled_at: string | null
          created_at: string
          created_by: string | null
          deleted_at: string | null
          difference_due: number | null
          display_id: number
          id: string
          metadata: Json | null
          no_notification: boolean | null
          order_id: string
          order_version: number
          raw_difference_due: Json | null
          return_id: string | null
          updated_at: string
        }
        Insert: {
          allow_backorder?: boolean
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          difference_due?: number | null
          display_id?: number
          id: string
          metadata?: Json | null
          no_notification?: boolean | null
          order_id: string
          order_version: number
          raw_difference_due?: Json | null
          return_id?: string | null
          updated_at?: string
        }
        Update: {
          allow_backorder?: boolean
          canceled_at?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          difference_due?: number | null
          display_id?: number
          id?: string
          metadata?: Json | null
          no_notification?: boolean | null
          order_id?: string
          order_version?: number
          raw_difference_due?: Json | null
          return_id?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      order_exchange_item: {
        Row: {
          created_at: string
          deleted_at: string | null
          exchange_id: string
          id: string
          item_id: string
          metadata: Json | null
          note: string | null
          quantity: number
          raw_quantity: Json
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          exchange_id: string
          id: string
          item_id: string
          metadata?: Json | null
          note?: string | null
          quantity: number
          raw_quantity: Json
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          exchange_id?: string
          id?: string
          item_id?: string
          metadata?: Json | null
          note?: string | null
          quantity?: number
          raw_quantity?: Json
          updated_at?: string
        }
        Relationships: []
      }
      order_fulfillment: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_id: string
          id: string
          order_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id: string
          id: string
          order_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id?: string
          id?: string
          order_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      order_item: {
        Row: {
          compare_at_unit_price: number | null
          created_at: string
          deleted_at: string | null
          delivered_quantity: number
          fulfilled_quantity: number
          id: string
          item_id: string
          metadata: Json | null
          order_id: string
          quantity: number
          raw_compare_at_unit_price: Json | null
          raw_delivered_quantity: Json
          raw_fulfilled_quantity: Json
          raw_quantity: Json
          raw_return_dismissed_quantity: Json
          raw_return_received_quantity: Json
          raw_return_requested_quantity: Json
          raw_shipped_quantity: Json
          raw_unit_price: Json | null
          raw_written_off_quantity: Json
          return_dismissed_quantity: number
          return_received_quantity: number
          return_requested_quantity: number
          shipped_quantity: number
          unit_price: number | null
          updated_at: string
          version: number
          written_off_quantity: number
        }
        Insert: {
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          delivered_quantity?: number
          fulfilled_quantity: number
          id: string
          item_id: string
          metadata?: Json | null
          order_id: string
          quantity: number
          raw_compare_at_unit_price?: Json | null
          raw_delivered_quantity: Json
          raw_fulfilled_quantity: Json
          raw_quantity: Json
          raw_return_dismissed_quantity: Json
          raw_return_received_quantity: Json
          raw_return_requested_quantity: Json
          raw_shipped_quantity: Json
          raw_unit_price?: Json | null
          raw_written_off_quantity: Json
          return_dismissed_quantity: number
          return_received_quantity: number
          return_requested_quantity: number
          shipped_quantity: number
          unit_price?: number | null
          updated_at?: string
          version: number
          written_off_quantity: number
        }
        Update: {
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          delivered_quantity?: number
          fulfilled_quantity?: number
          id?: string
          item_id?: string
          metadata?: Json | null
          order_id?: string
          quantity?: number
          raw_compare_at_unit_price?: Json | null
          raw_delivered_quantity?: Json
          raw_fulfilled_quantity?: Json
          raw_quantity?: Json
          raw_return_dismissed_quantity?: Json
          raw_return_received_quantity?: Json
          raw_return_requested_quantity?: Json
          raw_shipped_quantity?: Json
          raw_unit_price?: Json | null
          raw_written_off_quantity?: Json
          return_dismissed_quantity?: number
          return_received_quantity?: number
          return_requested_quantity?: number
          shipped_quantity?: number
          unit_price?: number | null
          updated_at?: string
          version?: number
          written_off_quantity?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_item_item_id_foreign"
            columns: ["item_id"]
            isOneToOne: false
            referencedRelation: "order_line_item"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "order_item_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      order_line_item: {
        Row: {
          compare_at_unit_price: number | null
          created_at: string
          deleted_at: string | null
          id: string
          is_custom_price: boolean
          is_discountable: boolean
          is_giftcard: boolean
          is_tax_inclusive: boolean
          metadata: Json | null
          product_collection: string | null
          product_description: string | null
          product_handle: string | null
          product_id: string | null
          product_subtitle: string | null
          product_title: string | null
          product_type: string | null
          product_type_id: string | null
          raw_compare_at_unit_price: Json | null
          raw_unit_price: Json
          requires_shipping: boolean
          subtitle: string | null
          thumbnail: string | null
          title: string
          totals_id: string | null
          unit_price: number
          updated_at: string
          variant_barcode: string | null
          variant_id: string | null
          variant_option_values: Json | null
          variant_sku: string | null
          variant_title: string | null
        }
        Insert: {
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          id: string
          is_custom_price?: boolean
          is_discountable?: boolean
          is_giftcard?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          product_collection?: string | null
          product_description?: string | null
          product_handle?: string | null
          product_id?: string | null
          product_subtitle?: string | null
          product_title?: string | null
          product_type?: string | null
          product_type_id?: string | null
          raw_compare_at_unit_price?: Json | null
          raw_unit_price: Json
          requires_shipping?: boolean
          subtitle?: string | null
          thumbnail?: string | null
          title: string
          totals_id?: string | null
          unit_price: number
          updated_at?: string
          variant_barcode?: string | null
          variant_id?: string | null
          variant_option_values?: Json | null
          variant_sku?: string | null
          variant_title?: string | null
        }
        Update: {
          compare_at_unit_price?: number | null
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_custom_price?: boolean
          is_discountable?: boolean
          is_giftcard?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          product_collection?: string | null
          product_description?: string | null
          product_handle?: string | null
          product_id?: string | null
          product_subtitle?: string | null
          product_title?: string | null
          product_type?: string | null
          product_type_id?: string | null
          raw_compare_at_unit_price?: Json | null
          raw_unit_price?: Json
          requires_shipping?: boolean
          subtitle?: string | null
          thumbnail?: string | null
          title?: string
          totals_id?: string | null
          unit_price?: number
          updated_at?: string
          variant_barcode?: string | null
          variant_id?: string | null
          variant_option_values?: Json | null
          variant_sku?: string | null
          variant_title?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "order_line_item_totals_id_foreign"
            columns: ["totals_id"]
            isOneToOne: false
            referencedRelation: "order_item"
            referencedColumns: ["id"]
          },
        ]
      }
      order_line_item_adjustment: {
        Row: {
          amount: number
          code: string | null
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          item_id: string
          promotion_id: string | null
          provider_id: string | null
          raw_amount: Json
          updated_at: string
        }
        Insert: {
          amount: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          item_id: string
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount: Json
          updated_at?: string
        }
        Update: {
          amount?: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          item_id?: string
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount?: Json
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_line_item_adjustment_item_id_foreign"
            columns: ["item_id"]
            isOneToOne: false
            referencedRelation: "order_line_item"
            referencedColumns: ["id"]
          },
        ]
      }
      order_line_item_tax_line: {
        Row: {
          code: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          item_id: string
          provider_id: string | null
          rate: number
          raw_rate: Json
          tax_rate_id: string | null
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          item_id: string
          provider_id?: string | null
          rate: number
          raw_rate: Json
          tax_rate_id?: string | null
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          item_id?: string
          provider_id?: string | null
          rate?: number
          raw_rate?: Json
          tax_rate_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_line_item_tax_line_item_id_foreign"
            columns: ["item_id"]
            isOneToOne: false
            referencedRelation: "order_line_item"
            referencedColumns: ["id"]
          },
        ]
      }
      order_payment_collection: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          order_id: string
          payment_collection_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          order_id: string
          payment_collection_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          order_id?: string
          payment_collection_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      order_promotion: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          order_id: string
          promotion_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          order_id: string
          promotion_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          order_id?: string
          promotion_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      order_shipping: {
        Row: {
          claim_id: string | null
          created_at: string
          deleted_at: string | null
          exchange_id: string | null
          id: string
          order_id: string
          return_id: string | null
          shipping_method_id: string
          updated_at: string
          version: number
        }
        Insert: {
          claim_id?: string | null
          created_at?: string
          deleted_at?: string | null
          exchange_id?: string | null
          id: string
          order_id: string
          return_id?: string | null
          shipping_method_id: string
          updated_at?: string
          version: number
        }
        Update: {
          claim_id?: string | null
          created_at?: string
          deleted_at?: string | null
          exchange_id?: string | null
          id?: string
          order_id?: string
          return_id?: string | null
          shipping_method_id?: string
          updated_at?: string
          version?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_shipping_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      order_shipping_method: {
        Row: {
          amount: number
          created_at: string
          data: Json | null
          deleted_at: string | null
          description: Json | null
          id: string
          is_custom_amount: boolean
          is_tax_inclusive: boolean
          metadata: Json | null
          name: string
          raw_amount: Json
          shipping_option_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          description?: Json | null
          id: string
          is_custom_amount?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          name: string
          raw_amount: Json
          shipping_option_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          description?: Json | null
          id?: string
          is_custom_amount?: boolean
          is_tax_inclusive?: boolean
          metadata?: Json | null
          name?: string
          raw_amount?: Json
          shipping_option_id?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      order_shipping_method_adjustment: {
        Row: {
          amount: number
          code: string | null
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          promotion_id: string | null
          provider_id: string | null
          raw_amount: Json
          shipping_method_id: string
          updated_at: string
        }
        Insert: {
          amount: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount: Json
          shipping_method_id: string
          updated_at?: string
        }
        Update: {
          amount?: number
          code?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          promotion_id?: string | null
          provider_id?: string | null
          raw_amount?: Json
          shipping_method_id?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_shipping_method_adjustment_shipping_method_id_foreign"
            columns: ["shipping_method_id"]
            isOneToOne: false
            referencedRelation: "order_shipping_method"
            referencedColumns: ["id"]
          },
        ]
      }
      order_shipping_method_tax_line: {
        Row: {
          code: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          provider_id: string | null
          rate: number
          raw_rate: Json
          shipping_method_id: string
          tax_rate_id: string | null
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          provider_id?: string | null
          rate: number
          raw_rate: Json
          shipping_method_id: string
          tax_rate_id?: string | null
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          provider_id?: string | null
          rate?: number
          raw_rate?: Json
          shipping_method_id?: string
          tax_rate_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_shipping_method_tax_line_shipping_method_id_foreign"
            columns: ["shipping_method_id"]
            isOneToOne: false
            referencedRelation: "order_shipping_method"
            referencedColumns: ["id"]
          },
        ]
      }
      order_summary: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          order_id: string
          totals: Json | null
          updated_at: string
          version: number
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          order_id: string
          totals?: Json | null
          updated_at?: string
          version?: number
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          order_id?: string
          totals?: Json | null
          updated_at?: string
          version?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_summary_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      order_transaction: {
        Row: {
          amount: number
          claim_id: string | null
          created_at: string
          currency_code: string
          deleted_at: string | null
          exchange_id: string | null
          id: string
          order_id: string
          raw_amount: Json
          reference: string | null
          reference_id: string | null
          return_id: string | null
          updated_at: string
          version: number
        }
        Insert: {
          amount: number
          claim_id?: string | null
          created_at?: string
          currency_code: string
          deleted_at?: string | null
          exchange_id?: string | null
          id: string
          order_id: string
          raw_amount: Json
          reference?: string | null
          reference_id?: string | null
          return_id?: string | null
          updated_at?: string
          version?: number
        }
        Update: {
          amount?: number
          claim_id?: string | null
          created_at?: string
          currency_code?: string
          deleted_at?: string | null
          exchange_id?: string | null
          id?: string
          order_id?: string
          raw_amount?: Json
          reference?: string | null
          reference_id?: string | null
          return_id?: string | null
          updated_at?: string
          version?: number
        }
        Relationships: [
          {
            foreignKeyName: "order_transaction_order_id_foreign"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "order"
            referencedColumns: ["id"]
          },
        ]
      }
      payment: {
        Row: {
          amount: number
          canceled_at: string | null
          captured_at: string | null
          created_at: string
          currency_code: string
          data: Json | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          payment_collection_id: string
          payment_session_id: string
          provider_id: string
          raw_amount: Json
          updated_at: string
        }
        Insert: {
          amount: number
          canceled_at?: string | null
          captured_at?: string | null
          created_at?: string
          currency_code: string
          data?: Json | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          payment_collection_id: string
          payment_session_id: string
          provider_id: string
          raw_amount: Json
          updated_at?: string
        }
        Update: {
          amount?: number
          canceled_at?: string | null
          captured_at?: string | null
          created_at?: string
          currency_code?: string
          data?: Json | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          payment_collection_id?: string
          payment_session_id?: string
          provider_id?: string
          raw_amount?: Json
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "payment_payment_collection_id_foreign"
            columns: ["payment_collection_id"]
            isOneToOne: false
            referencedRelation: "payment_collection"
            referencedColumns: ["id"]
          },
        ]
      }
      payment_collection: {
        Row: {
          amount: number
          authorized_amount: number | null
          captured_amount: number | null
          completed_at: string | null
          created_at: string
          currency_code: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          raw_amount: Json
          raw_authorized_amount: Json | null
          raw_captured_amount: Json | null
          raw_refunded_amount: Json | null
          refunded_amount: number | null
          status: string
          updated_at: string
        }
        Insert: {
          amount: number
          authorized_amount?: number | null
          captured_amount?: number | null
          completed_at?: string | null
          created_at?: string
          currency_code: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          raw_amount: Json
          raw_authorized_amount?: Json | null
          raw_captured_amount?: Json | null
          raw_refunded_amount?: Json | null
          refunded_amount?: number | null
          status?: string
          updated_at?: string
        }
        Update: {
          amount?: number
          authorized_amount?: number | null
          captured_amount?: number | null
          completed_at?: string | null
          created_at?: string
          currency_code?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          raw_amount?: Json
          raw_authorized_amount?: Json | null
          raw_captured_amount?: Json | null
          raw_refunded_amount?: Json | null
          refunded_amount?: number | null
          status?: string
          updated_at?: string
        }
        Relationships: []
      }
      payment_collection_payment_providers: {
        Row: {
          payment_collection_id: string
          payment_provider_id: string
        }
        Insert: {
          payment_collection_id: string
          payment_provider_id: string
        }
        Update: {
          payment_collection_id?: string
          payment_provider_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "payment_collection_payment_providers_payment_col_aa276_foreign"
            columns: ["payment_collection_id"]
            isOneToOne: false
            referencedRelation: "payment_collection"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "payment_collection_payment_providers_payment_pro_2d555_foreign"
            columns: ["payment_provider_id"]
            isOneToOne: false
            referencedRelation: "payment_provider"
            referencedColumns: ["id"]
          },
        ]
      }
      payment_provider: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          is_enabled: boolean
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          is_enabled?: boolean
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_enabled?: boolean
          updated_at?: string
        }
        Relationships: []
      }
      payment_session: {
        Row: {
          amount: number
          authorized_at: string | null
          context: Json | null
          created_at: string
          currency_code: string
          data: Json
          deleted_at: string | null
          id: string
          metadata: Json | null
          payment_collection_id: string
          provider_id: string
          raw_amount: Json
          status: string
          updated_at: string
        }
        Insert: {
          amount: number
          authorized_at?: string | null
          context?: Json | null
          created_at?: string
          currency_code: string
          data?: Json
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          payment_collection_id: string
          provider_id: string
          raw_amount: Json
          status?: string
          updated_at?: string
        }
        Update: {
          amount?: number
          authorized_at?: string | null
          context?: Json | null
          created_at?: string
          currency_code?: string
          data?: Json
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          payment_collection_id?: string
          provider_id?: string
          raw_amount?: Json
          status?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "payment_session_payment_collection_id_foreign"
            columns: ["payment_collection_id"]
            isOneToOne: false
            referencedRelation: "payment_collection"
            referencedColumns: ["id"]
          },
        ]
      }
      price: {
        Row: {
          amount: number
          created_at: string
          currency_code: string
          deleted_at: string | null
          id: string
          max_quantity: number | null
          min_quantity: number | null
          price_list_id: string | null
          price_set_id: string
          raw_amount: Json
          rules_count: number | null
          title: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          created_at?: string
          currency_code: string
          deleted_at?: string | null
          id: string
          max_quantity?: number | null
          min_quantity?: number | null
          price_list_id?: string | null
          price_set_id: string
          raw_amount: Json
          rules_count?: number | null
          title?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          created_at?: string
          currency_code?: string
          deleted_at?: string | null
          id?: string
          max_quantity?: number | null
          min_quantity?: number | null
          price_list_id?: string | null
          price_set_id?: string
          raw_amount?: Json
          rules_count?: number | null
          title?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "price_price_list_id_foreign"
            columns: ["price_list_id"]
            isOneToOne: false
            referencedRelation: "price_list"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "price_price_set_id_foreign"
            columns: ["price_set_id"]
            isOneToOne: false
            referencedRelation: "price_set"
            referencedColumns: ["id"]
          },
        ]
      }
      price_list: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string
          ends_at: string | null
          id: string
          rules_count: number | null
          starts_at: string | null
          status: string
          title: string
          type: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description: string
          ends_at?: string | null
          id: string
          rules_count?: number | null
          starts_at?: string | null
          status?: string
          title: string
          type?: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string
          ends_at?: string | null
          id?: string
          rules_count?: number | null
          starts_at?: string | null
          status?: string
          title?: string
          type?: string
          updated_at?: string
        }
        Relationships: []
      }
      price_list_rule: {
        Row: {
          attribute: string
          created_at: string
          deleted_at: string | null
          id: string
          price_list_id: string
          updated_at: string
          value: Json | null
        }
        Insert: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id: string
          price_list_id: string
          updated_at?: string
          value?: Json | null
        }
        Update: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          price_list_id?: string
          updated_at?: string
          value?: Json | null
        }
        Relationships: [
          {
            foreignKeyName: "price_list_rule_price_list_id_foreign"
            columns: ["price_list_id"]
            isOneToOne: false
            referencedRelation: "price_list"
            referencedColumns: ["id"]
          },
        ]
      }
      price_preference: {
        Row: {
          attribute: string
          created_at: string
          deleted_at: string | null
          id: string
          is_tax_inclusive: boolean
          updated_at: string
          value: string | null
        }
        Insert: {
          attribute: string
          created_at?: string
          deleted_at?: string | null
          id: string
          is_tax_inclusive?: boolean
          updated_at?: string
          value?: string | null
        }
        Update: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_tax_inclusive?: boolean
          updated_at?: string
          value?: string | null
        }
        Relationships: []
      }
      price_rule: {
        Row: {
          attribute: string
          created_at: string
          deleted_at: string | null
          id: string
          operator: string
          price_id: string
          priority: number
          updated_at: string
          value: string
        }
        Insert: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id: string
          operator?: string
          price_id: string
          priority?: number
          updated_at?: string
          value: string
        }
        Update: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          operator?: string
          price_id?: string
          priority?: number
          updated_at?: string
          value?: string
        }
        Relationships: [
          {
            foreignKeyName: "price_rule_price_id_foreign"
            columns: ["price_id"]
            isOneToOne: false
            referencedRelation: "price"
            referencedColumns: ["id"]
          },
        ]
      }
      price_set: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          updated_at?: string
        }
        Relationships: []
      }
      product: {
        Row: {
          collection_id: string | null
          created_at: string
          deleted_at: string | null
          description: string | null
          discountable: boolean
          external_id: string | null
          handle: string
          height: string | null
          hs_code: string | null
          id: string
          is_giftcard: boolean
          length: string | null
          material: string | null
          metadata: Json | null
          mid_code: string | null
          origin_country: string | null
          status: string
          subtitle: string | null
          thumbnail: string | null
          title: string
          type_id: string | null
          updated_at: string
          weight: string | null
          width: string | null
        }
        Insert: {
          collection_id?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          discountable?: boolean
          external_id?: string | null
          handle: string
          height?: string | null
          hs_code?: string | null
          id: string
          is_giftcard?: boolean
          length?: string | null
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          status?: string
          subtitle?: string | null
          thumbnail?: string | null
          title: string
          type_id?: string | null
          updated_at?: string
          weight?: string | null
          width?: string | null
        }
        Update: {
          collection_id?: string | null
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          discountable?: boolean
          external_id?: string | null
          handle?: string
          height?: string | null
          hs_code?: string | null
          id?: string
          is_giftcard?: boolean
          length?: string | null
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          status?: string
          subtitle?: string | null
          thumbnail?: string | null
          title?: string
          type_id?: string | null
          updated_at?: string
          weight?: string | null
          width?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "product_collection_id_foreign"
            columns: ["collection_id"]
            isOneToOne: false
            referencedRelation: "product_collection"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "product_type_id_foreign"
            columns: ["type_id"]
            isOneToOne: false
            referencedRelation: "product_type"
            referencedColumns: ["id"]
          },
        ]
      }
      product_category: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string
          handle: string
          id: string
          is_active: boolean
          is_internal: boolean
          metadata: Json | null
          mpath: string
          name: string
          parent_category_id: string | null
          rank: number
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description?: string
          handle: string
          id: string
          is_active?: boolean
          is_internal?: boolean
          metadata?: Json | null
          mpath: string
          name: string
          parent_category_id?: string | null
          rank?: number
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string
          handle?: string
          id?: string
          is_active?: boolean
          is_internal?: boolean
          metadata?: Json | null
          mpath?: string
          name?: string
          parent_category_id?: string | null
          rank?: number
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_category_parent_category_id_foreign"
            columns: ["parent_category_id"]
            isOneToOne: false
            referencedRelation: "product_category"
            referencedColumns: ["id"]
          },
        ]
      }
      product_category_product: {
        Row: {
          product_category_id: string
          product_id: string
        }
        Insert: {
          product_category_id: string
          product_id: string
        }
        Update: {
          product_category_id?: string
          product_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_category_product_product_category_id_foreign"
            columns: ["product_category_id"]
            isOneToOne: false
            referencedRelation: "product_category"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "product_category_product_product_id_foreign"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "product"
            referencedColumns: ["id"]
          },
        ]
      }
      product_collection: {
        Row: {
          created_at: string
          deleted_at: string | null
          handle: string
          id: string
          metadata: Json | null
          title: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          handle: string
          id: string
          metadata?: Json | null
          title: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          handle?: string
          id?: string
          metadata?: Json | null
          title?: string
          updated_at?: string
        }
        Relationships: []
      }
      product_option: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          product_id: string
          title: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          product_id: string
          title: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          product_id?: string
          title?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_option_product_id_foreign"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "product"
            referencedColumns: ["id"]
          },
        ]
      }
      product_option_value: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          option_id: string | null
          updated_at: string
          value: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          option_id?: string | null
          updated_at?: string
          value: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          option_id?: string | null
          updated_at?: string
          value?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_option_value_option_id_foreign"
            columns: ["option_id"]
            isOneToOne: false
            referencedRelation: "product_option"
            referencedColumns: ["id"]
          },
        ]
      }
      product_sales_channel: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          product_id: string
          sales_channel_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          product_id: string
          sales_channel_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          product_id?: string
          sales_channel_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      product_shipping_profile: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          product_id: string
          shipping_profile_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          product_id: string
          shipping_profile_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          product_id?: string
          shipping_profile_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      product_tag: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          updated_at: string
          value: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          updated_at?: string
          value: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          updated_at?: string
          value?: string
        }
        Relationships: []
      }
      product_tags: {
        Row: {
          product_id: string
          product_tag_id: string
        }
        Insert: {
          product_id: string
          product_tag_id: string
        }
        Update: {
          product_id?: string
          product_tag_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_tags_product_id_foreign"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "product"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "product_tags_product_tag_id_foreign"
            columns: ["product_tag_id"]
            isOneToOne: false
            referencedRelation: "product_tag"
            referencedColumns: ["id"]
          },
        ]
      }
      product_type: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          updated_at: string
          value: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          updated_at?: string
          value: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          updated_at?: string
          value?: string
        }
        Relationships: []
      }
      product_variant: {
        Row: {
          allow_backorder: boolean
          barcode: string | null
          created_at: string
          deleted_at: string | null
          ean: string | null
          height: number | null
          hs_code: string | null
          id: string
          length: number | null
          manage_inventory: boolean
          material: string | null
          metadata: Json | null
          mid_code: string | null
          origin_country: string | null
          product_id: string | null
          sku: string | null
          title: string
          upc: string | null
          updated_at: string
          variant_rank: number | null
          weight: number | null
          width: number | null
        }
        Insert: {
          allow_backorder?: boolean
          barcode?: string | null
          created_at?: string
          deleted_at?: string | null
          ean?: string | null
          height?: number | null
          hs_code?: string | null
          id: string
          length?: number | null
          manage_inventory?: boolean
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          product_id?: string | null
          sku?: string | null
          title: string
          upc?: string | null
          updated_at?: string
          variant_rank?: number | null
          weight?: number | null
          width?: number | null
        }
        Update: {
          allow_backorder?: boolean
          barcode?: string | null
          created_at?: string
          deleted_at?: string | null
          ean?: string | null
          height?: number | null
          hs_code?: string | null
          id?: string
          length?: number | null
          manage_inventory?: boolean
          material?: string | null
          metadata?: Json | null
          mid_code?: string | null
          origin_country?: string | null
          product_id?: string | null
          sku?: string | null
          title?: string
          upc?: string | null
          updated_at?: string
          variant_rank?: number | null
          weight?: number | null
          width?: number | null
        }
        Relationships: [
          {
            foreignKeyName: "product_variant_product_id_foreign"
            columns: ["product_id"]
            isOneToOne: false
            referencedRelation: "product"
            referencedColumns: ["id"]
          },
        ]
      }
      product_variant_inventory_item: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          inventory_item_id: string
          required_quantity: number
          updated_at: string
          variant_id: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          inventory_item_id: string
          required_quantity?: number
          updated_at?: string
          variant_id: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          inventory_item_id?: string
          required_quantity?: number
          updated_at?: string
          variant_id?: string
        }
        Relationships: []
      }
      product_variant_option: {
        Row: {
          option_value_id: string
          variant_id: string
        }
        Insert: {
          option_value_id: string
          variant_id: string
        }
        Update: {
          option_value_id?: string
          variant_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "product_variant_option_option_value_id_foreign"
            columns: ["option_value_id"]
            isOneToOne: false
            referencedRelation: "product_option_value"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "product_variant_option_variant_id_foreign"
            columns: ["variant_id"]
            isOneToOne: false
            referencedRelation: "product_variant"
            referencedColumns: ["id"]
          },
        ]
      }
      product_variant_price_set: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          price_set_id: string
          updated_at: string
          variant_id: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          price_set_id: string
          updated_at?: string
          variant_id: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          price_set_id?: string
          updated_at?: string
          variant_id?: string
        }
        Relationships: []
      }
      promotion: {
        Row: {
          campaign_id: string | null
          code: string
          created_at: string
          deleted_at: string | null
          id: string
          is_automatic: boolean
          is_tax_inclusive: boolean
          status: string
          type: string
          updated_at: string
        }
        Insert: {
          campaign_id?: string | null
          code: string
          created_at?: string
          deleted_at?: string | null
          id: string
          is_automatic?: boolean
          is_tax_inclusive?: boolean
          status?: string
          type: string
          updated_at?: string
        }
        Update: {
          campaign_id?: string | null
          code?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_automatic?: boolean
          is_tax_inclusive?: boolean
          status?: string
          type?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "promotion_campaign_id_foreign"
            columns: ["campaign_id"]
            isOneToOne: false
            referencedRelation: "promotion_campaign"
            referencedColumns: ["id"]
          },
        ]
      }
      promotion_application_method: {
        Row: {
          allocation: string | null
          apply_to_quantity: number | null
          buy_rules_min_quantity: number | null
          created_at: string
          currency_code: string | null
          deleted_at: string | null
          id: string
          max_quantity: number | null
          promotion_id: string
          raw_value: Json | null
          target_type: string
          type: string
          updated_at: string
          value: number | null
        }
        Insert: {
          allocation?: string | null
          apply_to_quantity?: number | null
          buy_rules_min_quantity?: number | null
          created_at?: string
          currency_code?: string | null
          deleted_at?: string | null
          id: string
          max_quantity?: number | null
          promotion_id: string
          raw_value?: Json | null
          target_type: string
          type: string
          updated_at?: string
          value?: number | null
        }
        Update: {
          allocation?: string | null
          apply_to_quantity?: number | null
          buy_rules_min_quantity?: number | null
          created_at?: string
          currency_code?: string | null
          deleted_at?: string | null
          id?: string
          max_quantity?: number | null
          promotion_id?: string
          raw_value?: Json | null
          target_type?: string
          type?: string
          updated_at?: string
          value?: number | null
        }
        Relationships: [
          {
            foreignKeyName: "promotion_application_method_promotion_id_foreign"
            columns: ["promotion_id"]
            isOneToOne: false
            referencedRelation: "promotion"
            referencedColumns: ["id"]
          },
        ]
      }
      promotion_campaign: {
        Row: {
          campaign_identifier: string
          created_at: string
          deleted_at: string | null
          description: string | null
          ends_at: string | null
          id: string
          name: string
          starts_at: string | null
          updated_at: string
        }
        Insert: {
          campaign_identifier: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          ends_at?: string | null
          id: string
          name: string
          starts_at?: string | null
          updated_at?: string
        }
        Update: {
          campaign_identifier?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          ends_at?: string | null
          id?: string
          name?: string
          starts_at?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      promotion_campaign_budget: {
        Row: {
          campaign_id: string
          created_at: string
          currency_code: string | null
          deleted_at: string | null
          id: string
          limit: number | null
          raw_limit: Json | null
          raw_used: Json
          type: string
          updated_at: string
          used: number
        }
        Insert: {
          campaign_id: string
          created_at?: string
          currency_code?: string | null
          deleted_at?: string | null
          id: string
          limit?: number | null
          raw_limit?: Json | null
          raw_used: Json
          type: string
          updated_at?: string
          used?: number
        }
        Update: {
          campaign_id?: string
          created_at?: string
          currency_code?: string | null
          deleted_at?: string | null
          id?: string
          limit?: number | null
          raw_limit?: Json | null
          raw_used?: Json
          type?: string
          updated_at?: string
          used?: number
        }
        Relationships: [
          {
            foreignKeyName: "promotion_campaign_budget_campaign_id_foreign"
            columns: ["campaign_id"]
            isOneToOne: false
            referencedRelation: "promotion_campaign"
            referencedColumns: ["id"]
          },
        ]
      }
      promotion_promotion_rule: {
        Row: {
          promotion_id: string
          promotion_rule_id: string
        }
        Insert: {
          promotion_id: string
          promotion_rule_id: string
        }
        Update: {
          promotion_id?: string
          promotion_rule_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "promotion_promotion_rule_promotion_id_foreign"
            columns: ["promotion_id"]
            isOneToOne: false
            referencedRelation: "promotion"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "promotion_promotion_rule_promotion_rule_id_foreign"
            columns: ["promotion_rule_id"]
            isOneToOne: false
            referencedRelation: "promotion_rule"
            referencedColumns: ["id"]
          },
        ]
      }
      promotion_rule: {
        Row: {
          attribute: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          operator: string
          updated_at: string
        }
        Insert: {
          attribute: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          operator: string
          updated_at?: string
        }
        Update: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          operator?: string
          updated_at?: string
        }
        Relationships: []
      }
      promotion_rule_value: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          promotion_rule_id: string
          updated_at: string
          value: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          promotion_rule_id: string
          updated_at?: string
          value: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          promotion_rule_id?: string
          updated_at?: string
          value?: string
        }
        Relationships: [
          {
            foreignKeyName: "promotion_rule_value_promotion_rule_id_foreign"
            columns: ["promotion_rule_id"]
            isOneToOne: false
            referencedRelation: "promotion_rule"
            referencedColumns: ["id"]
          },
        ]
      }
      provider_identity: {
        Row: {
          auth_identity_id: string
          created_at: string
          deleted_at: string | null
          entity_id: string
          id: string
          provider: string
          provider_metadata: Json | null
          updated_at: string
          user_metadata: Json | null
        }
        Insert: {
          auth_identity_id: string
          created_at?: string
          deleted_at?: string | null
          entity_id: string
          id: string
          provider: string
          provider_metadata?: Json | null
          updated_at?: string
          user_metadata?: Json | null
        }
        Update: {
          auth_identity_id?: string
          created_at?: string
          deleted_at?: string | null
          entity_id?: string
          id?: string
          provider?: string
          provider_metadata?: Json | null
          updated_at?: string
          user_metadata?: Json | null
        }
        Relationships: [
          {
            foreignKeyName: "provider_identity_auth_identity_id_foreign"
            columns: ["auth_identity_id"]
            isOneToOne: false
            referencedRelation: "auth_identity"
            referencedColumns: ["id"]
          },
        ]
      }
      publishable_api_key_sales_channel: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          publishable_key_id: string
          sales_channel_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          publishable_key_id: string
          sales_channel_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          publishable_key_id?: string
          sales_channel_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      refund: {
        Row: {
          amount: number
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          note: string | null
          payment_id: string
          raw_amount: Json
          refund_reason_id: string | null
          updated_at: string
        }
        Insert: {
          amount: number
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          note?: string | null
          payment_id: string
          raw_amount: Json
          refund_reason_id?: string | null
          updated_at?: string
        }
        Update: {
          amount?: number
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          note?: string | null
          payment_id?: string
          raw_amount?: Json
          refund_reason_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "refund_payment_id_foreign"
            columns: ["payment_id"]
            isOneToOne: false
            referencedRelation: "payment"
            referencedColumns: ["id"]
          },
        ]
      }
      refund_reason: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          label: string
          metadata: Json | null
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          label: string
          metadata?: Json | null
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          label?: string
          metadata?: Json | null
          updated_at?: string
        }
        Relationships: []
      }
      region: {
        Row: {
          automatic_taxes: boolean
          created_at: string
          currency_code: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          automatic_taxes?: boolean
          created_at?: string
          currency_code: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          updated_at?: string
        }
        Update: {
          automatic_taxes?: boolean
          created_at?: string
          currency_code?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: []
      }
      region_country: {
        Row: {
          created_at: string
          deleted_at: string | null
          display_name: string
          iso_2: string
          iso_3: string
          metadata: Json | null
          name: string
          num_code: string
          region_id: string | null
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          display_name: string
          iso_2: string
          iso_3: string
          metadata?: Json | null
          name: string
          num_code: string
          region_id?: string | null
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          display_name?: string
          iso_2?: string
          iso_3?: string
          metadata?: Json | null
          name?: string
          num_code?: string
          region_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "region_country_region_id_foreign"
            columns: ["region_id"]
            isOneToOne: false
            referencedRelation: "region"
            referencedColumns: ["id"]
          },
        ]
      }
      region_payment_provider: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          payment_provider_id: string
          region_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          payment_provider_id: string
          region_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          payment_provider_id?: string
          region_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      reservation_item: {
        Row: {
          allow_backorder: boolean | null
          created_at: string
          created_by: string | null
          deleted_at: string | null
          description: string | null
          external_id: string | null
          id: string
          inventory_item_id: string
          line_item_id: string | null
          location_id: string
          metadata: Json | null
          quantity: number
          raw_quantity: Json | null
          updated_at: string
        }
        Insert: {
          allow_backorder?: boolean | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          description?: string | null
          external_id?: string | null
          id: string
          inventory_item_id: string
          line_item_id?: string | null
          location_id: string
          metadata?: Json | null
          quantity: number
          raw_quantity?: Json | null
          updated_at?: string
        }
        Update: {
          allow_backorder?: boolean | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          description?: string | null
          external_id?: string | null
          id?: string
          inventory_item_id?: string
          line_item_id?: string | null
          location_id?: string
          metadata?: Json | null
          quantity?: number
          raw_quantity?: Json | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "reservation_item_inventory_item_id_foreign"
            columns: ["inventory_item_id"]
            isOneToOne: false
            referencedRelation: "inventory_item"
            referencedColumns: ["id"]
          },
        ]
      }
      return: {
        Row: {
          canceled_at: string | null
          claim_id: string | null
          created_at: string
          created_by: string | null
          deleted_at: string | null
          display_id: number
          exchange_id: string | null
          id: string
          location_id: string | null
          metadata: Json | null
          no_notification: boolean | null
          order_id: string
          order_version: number
          raw_refund_amount: Json | null
          received_at: string | null
          refund_amount: number | null
          requested_at: string | null
          status: Database["public"]["Enums"]["return_status_enum"]
          updated_at: string
        }
        Insert: {
          canceled_at?: string | null
          claim_id?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          display_id?: number
          exchange_id?: string | null
          id: string
          location_id?: string | null
          metadata?: Json | null
          no_notification?: boolean | null
          order_id: string
          order_version: number
          raw_refund_amount?: Json | null
          received_at?: string | null
          refund_amount?: number | null
          requested_at?: string | null
          status?: Database["public"]["Enums"]["return_status_enum"]
          updated_at?: string
        }
        Update: {
          canceled_at?: string | null
          claim_id?: string | null
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          display_id?: number
          exchange_id?: string | null
          id?: string
          location_id?: string | null
          metadata?: Json | null
          no_notification?: boolean | null
          order_id?: string
          order_version?: number
          raw_refund_amount?: Json | null
          received_at?: string | null
          refund_amount?: number | null
          requested_at?: string | null
          status?: Database["public"]["Enums"]["return_status_enum"]
          updated_at?: string
        }
        Relationships: []
      }
      return_fulfillment: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_id: string
          id: string
          return_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id: string
          id: string
          return_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_id?: string
          id?: string
          return_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      return_item: {
        Row: {
          created_at: string
          damaged_quantity: number
          deleted_at: string | null
          id: string
          item_id: string
          metadata: Json | null
          note: string | null
          quantity: number
          raw_damaged_quantity: Json
          raw_quantity: Json
          raw_received_quantity: Json
          reason_id: string | null
          received_quantity: number
          return_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          damaged_quantity?: number
          deleted_at?: string | null
          id: string
          item_id: string
          metadata?: Json | null
          note?: string | null
          quantity: number
          raw_damaged_quantity: Json
          raw_quantity: Json
          raw_received_quantity: Json
          reason_id?: string | null
          received_quantity?: number
          return_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          damaged_quantity?: number
          deleted_at?: string | null
          id?: string
          item_id?: string
          metadata?: Json | null
          note?: string | null
          quantity?: number
          raw_damaged_quantity?: Json
          raw_quantity?: Json
          raw_received_quantity?: Json
          reason_id?: string | null
          received_quantity?: number
          return_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      return_reason: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          label: string
          metadata: Json | null
          parent_return_reason_id: string | null
          updated_at: string
          value: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          label: string
          metadata?: Json | null
          parent_return_reason_id?: string | null
          updated_at?: string
          value: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          label?: string
          metadata?: Json | null
          parent_return_reason_id?: string | null
          updated_at?: string
          value?: string
        }
        Relationships: [
          {
            foreignKeyName: "return_reason_parent_return_reason_id_foreign"
            columns: ["parent_return_reason_id"]
            isOneToOne: false
            referencedRelation: "return_reason"
            referencedColumns: ["id"]
          },
        ]
      }
      sales_channel: {
        Row: {
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          is_disabled: boolean
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          is_disabled?: boolean
          metadata?: Json | null
          name: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          is_disabled?: boolean
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: []
      }
      sales_channel_stock_location: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          sales_channel_id: string
          stock_location_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          sales_channel_id: string
          stock_location_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          sales_channel_id?: string
          stock_location_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      script_migrations: {
        Row: {
          created_at: string | null
          finished_at: string | null
          id: number
          script_name: string
        }
        Insert: {
          created_at?: string | null
          finished_at?: string | null
          id?: number
          script_name: string
        }
        Update: {
          created_at?: string | null
          finished_at?: string | null
          id?: number
          script_name?: string
        }
        Relationships: []
      }
      service_zone: {
        Row: {
          created_at: string
          deleted_at: string | null
          fulfillment_set_id: string
          id: string
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_set_id: string
          id: string
          metadata?: Json | null
          name: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          fulfillment_set_id?: string
          id?: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "service_zone_fulfillment_set_id_foreign"
            columns: ["fulfillment_set_id"]
            isOneToOne: false
            referencedRelation: "fulfillment_set"
            referencedColumns: ["id"]
          },
        ]
      }
      shipping_option: {
        Row: {
          created_at: string
          data: Json | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          price_type: string
          provider_id: string | null
          service_zone_id: string
          shipping_option_type_id: string
          shipping_profile_id: string | null
          updated_at: string
        }
        Insert: {
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          price_type?: string
          provider_id?: string | null
          service_zone_id: string
          shipping_option_type_id: string
          shipping_profile_id?: string | null
          updated_at?: string
        }
        Update: {
          created_at?: string
          data?: Json | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          price_type?: string
          provider_id?: string | null
          service_zone_id?: string
          shipping_option_type_id?: string
          shipping_profile_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "shipping_option_provider_id_foreign"
            columns: ["provider_id"]
            isOneToOne: false
            referencedRelation: "fulfillment_provider"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "shipping_option_service_zone_id_foreign"
            columns: ["service_zone_id"]
            isOneToOne: false
            referencedRelation: "service_zone"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "shipping_option_shipping_option_type_id_foreign"
            columns: ["shipping_option_type_id"]
            isOneToOne: false
            referencedRelation: "shipping_option_type"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "shipping_option_shipping_profile_id_foreign"
            columns: ["shipping_profile_id"]
            isOneToOne: false
            referencedRelation: "shipping_profile"
            referencedColumns: ["id"]
          },
        ]
      }
      shipping_option_price_set: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          price_set_id: string
          shipping_option_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          price_set_id: string
          shipping_option_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          price_set_id?: string
          shipping_option_id?: string
          updated_at?: string
        }
        Relationships: []
      }
      shipping_option_rule: {
        Row: {
          attribute: string
          created_at: string
          deleted_at: string | null
          id: string
          operator: string
          shipping_option_id: string
          updated_at: string
          value: Json | null
        }
        Insert: {
          attribute: string
          created_at?: string
          deleted_at?: string | null
          id: string
          operator: string
          shipping_option_id: string
          updated_at?: string
          value?: Json | null
        }
        Update: {
          attribute?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          operator?: string
          shipping_option_id?: string
          updated_at?: string
          value?: Json | null
        }
        Relationships: [
          {
            foreignKeyName: "shipping_option_rule_shipping_option_id_foreign"
            columns: ["shipping_option_id"]
            isOneToOne: false
            referencedRelation: "shipping_option"
            referencedColumns: ["id"]
          },
        ]
      }
      shipping_option_type: {
        Row: {
          code: string
          created_at: string
          deleted_at: string | null
          description: string | null
          id: string
          label: string
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id: string
          label: string
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          deleted_at?: string | null
          description?: string | null
          id?: string
          label?: string
          updated_at?: string
        }
        Relationships: []
      }
      shipping_profile: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          type: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          type: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          type?: string
          updated_at?: string
        }
        Relationships: []
      }
      stock_location: {
        Row: {
          address_id: string | null
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          address_id?: string | null
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name: string
          updated_at?: string
        }
        Update: {
          address_id?: string | null
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "stock_location_address_id_foreign"
            columns: ["address_id"]
            isOneToOne: false
            referencedRelation: "stock_location_address"
            referencedColumns: ["id"]
          },
        ]
      }
      stock_location_address: {
        Row: {
          address_1: string
          address_2: string | null
          city: string | null
          company: string | null
          country_code: string
          created_at: string
          deleted_at: string | null
          id: string
          metadata: Json | null
          phone: string | null
          postal_code: string | null
          province: string | null
          updated_at: string
        }
        Insert: {
          address_1: string
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code: string
          created_at?: string
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Update: {
          address_1?: string
          address_2?: string | null
          city?: string | null
          company?: string | null
          country_code?: string
          created_at?: string
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          phone?: string | null
          postal_code?: string | null
          province?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      store: {
        Row: {
          created_at: string
          default_location_id: string | null
          default_region_id: string | null
          default_sales_channel_id: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          name: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          default_location_id?: string | null
          default_region_id?: string | null
          default_sales_channel_id?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          default_location_id?: string | null
          default_region_id?: string | null
          default_sales_channel_id?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          name?: string
          updated_at?: string
        }
        Relationships: []
      }
      store_currency: {
        Row: {
          created_at: string
          currency_code: string
          deleted_at: string | null
          id: string
          is_default: boolean
          store_id: string | null
          updated_at: string
        }
        Insert: {
          created_at?: string
          currency_code: string
          deleted_at?: string | null
          id: string
          is_default?: boolean
          store_id?: string | null
          updated_at?: string
        }
        Update: {
          created_at?: string
          currency_code?: string
          deleted_at?: string | null
          id?: string
          is_default?: boolean
          store_id?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "store_currency_store_id_foreign"
            columns: ["store_id"]
            isOneToOne: false
            referencedRelation: "store"
            referencedColumns: ["id"]
          },
        ]
      }
      tax_provider: {
        Row: {
          created_at: string
          deleted_at: string | null
          id: string
          is_enabled: boolean
          updated_at: string
        }
        Insert: {
          created_at?: string
          deleted_at?: string | null
          id: string
          is_enabled?: boolean
          updated_at?: string
        }
        Update: {
          created_at?: string
          deleted_at?: string | null
          id?: string
          is_enabled?: boolean
          updated_at?: string
        }
        Relationships: []
      }
      tax_rate: {
        Row: {
          code: string
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          is_combinable: boolean
          is_default: boolean
          metadata: Json | null
          name: string
          rate: number | null
          tax_region_id: string
          updated_at: string
        }
        Insert: {
          code: string
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          is_combinable?: boolean
          is_default?: boolean
          metadata?: Json | null
          name: string
          rate?: number | null
          tax_region_id: string
          updated_at?: string
        }
        Update: {
          code?: string
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          is_combinable?: boolean
          is_default?: boolean
          metadata?: Json | null
          name?: string
          rate?: number | null
          tax_region_id?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "FK_tax_rate_tax_region_id"
            columns: ["tax_region_id"]
            isOneToOne: false
            referencedRelation: "tax_region"
            referencedColumns: ["id"]
          },
        ]
      }
      tax_rate_rule: {
        Row: {
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          reference: string
          reference_id: string
          tax_rate_id: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          reference: string
          reference_id: string
          tax_rate_id: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          reference?: string
          reference_id?: string
          tax_rate_id?: string
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "FK_tax_rate_rule_tax_rate_id"
            columns: ["tax_rate_id"]
            isOneToOne: false
            referencedRelation: "tax_rate"
            referencedColumns: ["id"]
          },
        ]
      }
      tax_region: {
        Row: {
          country_code: string
          created_at: string
          created_by: string | null
          deleted_at: string | null
          id: string
          metadata: Json | null
          parent_id: string | null
          provider_id: string | null
          province_code: string | null
          updated_at: string
        }
        Insert: {
          country_code: string
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id: string
          metadata?: Json | null
          parent_id?: string | null
          provider_id?: string | null
          province_code?: string | null
          updated_at?: string
        }
        Update: {
          country_code?: string
          created_at?: string
          created_by?: string | null
          deleted_at?: string | null
          id?: string
          metadata?: Json | null
          parent_id?: string | null
          provider_id?: string | null
          province_code?: string | null
          updated_at?: string
        }
        Relationships: [
          {
            foreignKeyName: "FK_tax_region_parent_id"
            columns: ["parent_id"]
            isOneToOne: false
            referencedRelation: "tax_region"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "FK_tax_region_provider_id"
            columns: ["provider_id"]
            isOneToOne: false
            referencedRelation: "tax_provider"
            referencedColumns: ["id"]
          },
        ]
      }
      user: {
        Row: {
          avatar_url: string | null
          created_at: string
          deleted_at: string | null
          email: string
          first_name: string | null
          id: string
          last_name: string | null
          metadata: Json | null
          updated_at: string
        }
        Insert: {
          avatar_url?: string | null
          created_at?: string
          deleted_at?: string | null
          email: string
          first_name?: string | null
          id: string
          last_name?: string | null
          metadata?: Json | null
          updated_at?: string
        }
        Update: {
          avatar_url?: string | null
          created_at?: string
          deleted_at?: string | null
          email?: string
          first_name?: string | null
          id?: string
          last_name?: string | null
          metadata?: Json | null
          updated_at?: string
        }
        Relationships: []
      }
      workflow_execution: {
        Row: {
          context: Json | null
          created_at: string
          deleted_at: string | null
          execution: Json | null
          id: string
          retention_time: number | null
          run_id: string
          state: string
          transaction_id: string
          updated_at: string
          workflow_id: string
        }
        Insert: {
          context?: Json | null
          created_at?: string
          deleted_at?: string | null
          execution?: Json | null
          id: string
          retention_time?: number | null
          run_id?: string
          state: string
          transaction_id: string
          updated_at?: string
          workflow_id: string
        }
        Update: {
          context?: Json | null
          created_at?: string
          deleted_at?: string | null
          execution?: Json | null
          id?: string
          retention_time?: number | null
          run_id?: string
          state?: string
          transaction_id?: string
          updated_at?: string
          workflow_id?: string
        }
        Relationships: []
      }
    }
    Views: {
      [_ in never]: never
    }
    Functions: {
      has_permission: {
        Args: {
          account_id: string
          permission_name: Database["public"]["Enums"]["app_permissions"]
          user_id: string
        }
        Returns: boolean
      }
      has_role_on_account: {
        Args: { account_id: string; account_role?: string }
        Returns: boolean
      }
      is_company_admin: {
        Args: { account_slug: string }
        Returns: boolean
      }
    }
    Enums: {
      app_permissions:
        | "roles.manage"
        | "billing.manage"
        | "settings.manage"
        | "members.manage"
        | "invites.manage"
      claim_reason_enum:
        | "missing_item"
        | "wrong_item"
        | "production_failure"
        | "other"
      order_claim_type_enum: "refund" | "replace"
      order_status_enum:
        | "pending"
        | "completed"
        | "draft"
        | "archived"
        | "canceled"
        | "requires_action"
      return_status_enum:
        | "open"
        | "requested"
        | "received"
        | "partially_received"
        | "canceled"
    }
    CompositeTypes: {
      invitation: {
        email: string | null
        role: string | null
        personal_code: string | null
      }
    }
  }
}

type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">

type DefaultSchema = DatabaseWithoutInternals[Extract<keyof Database, "public">]

export type Tables<
  DefaultSchemaTableNameOrOptions extends
    | keyof (DefaultSchema["Tables"] & DefaultSchema["Views"])
    | { schema: keyof DatabaseWithoutInternals },
  TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals
  }
    ? keyof (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
        DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])
    : never = never,
> = DefaultSchemaTableNameOrOptions extends {
  schema: keyof DatabaseWithoutInternals
}
  ? (DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"] &
      DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Views"])[TableName] extends {
      Row: infer R
    }
    ? R
    : never
  : DefaultSchemaTableNameOrOptions extends keyof (DefaultSchema["Tables"] &
        DefaultSchema["Views"])
    ? (DefaultSchema["Tables"] &
        DefaultSchema["Views"])[DefaultSchemaTableNameOrOptions] extends {
        Row: infer R
      }
      ? R
      : never
    : never

export type TablesInsert<
  DefaultSchemaTableNameOrOptions extends
    | keyof DefaultSchema["Tables"]
    | { schema: keyof DatabaseWithoutInternals },
  TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals
  }
    ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
    : never = never,
> = DefaultSchemaTableNameOrOptions extends {
  schema: keyof DatabaseWithoutInternals
}
  ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
      Insert: infer I
    }
    ? I
    : never
  : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
    ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
        Insert: infer I
      }
      ? I
      : never
    : never

export type TablesUpdate<
  DefaultSchemaTableNameOrOptions extends
    | keyof DefaultSchema["Tables"]
    | { schema: keyof DatabaseWithoutInternals },
  TableName extends DefaultSchemaTableNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals
  }
    ? keyof DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"]
    : never = never,
> = DefaultSchemaTableNameOrOptions extends {
  schema: keyof DatabaseWithoutInternals
}
  ? DatabaseWithoutInternals[DefaultSchemaTableNameOrOptions["schema"]]["Tables"][TableName] extends {
      Update: infer U
    }
    ? U
    : never
  : DefaultSchemaTableNameOrOptions extends keyof DefaultSchema["Tables"]
    ? DefaultSchema["Tables"][DefaultSchemaTableNameOrOptions] extends {
        Update: infer U
      }
      ? U
      : never
    : never

export type Enums<
  DefaultSchemaEnumNameOrOptions extends
    | keyof DefaultSchema["Enums"]
    | { schema: keyof DatabaseWithoutInternals },
  EnumName extends DefaultSchemaEnumNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals
  }
    ? keyof DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"]
    : never = never,
> = DefaultSchemaEnumNameOrOptions extends {
  schema: keyof DatabaseWithoutInternals
}
  ? DatabaseWithoutInternals[DefaultSchemaEnumNameOrOptions["schema"]]["Enums"][EnumName]
  : DefaultSchemaEnumNameOrOptions extends keyof DefaultSchema["Enums"]
    ? DefaultSchema["Enums"][DefaultSchemaEnumNameOrOptions]
    : never

export type CompositeTypes<
  PublicCompositeTypeNameOrOptions extends
    | keyof DefaultSchema["CompositeTypes"]
    | { schema: keyof DatabaseWithoutInternals },
  CompositeTypeName extends PublicCompositeTypeNameOrOptions extends {
    schema: keyof DatabaseWithoutInternals
  }
    ? keyof DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"]
    : never = never,
> = PublicCompositeTypeNameOrOptions extends {
  schema: keyof DatabaseWithoutInternals
}
  ? DatabaseWithoutInternals[PublicCompositeTypeNameOrOptions["schema"]]["CompositeTypes"][CompositeTypeName]
  : PublicCompositeTypeNameOrOptions extends keyof DefaultSchema["CompositeTypes"]
    ? DefaultSchema["CompositeTypes"][PublicCompositeTypeNameOrOptions]
    : never

export const Constants = {
  audit: {
    Enums: {
      action_status: ["SUCCESS", "FAIL"],
      doctor_page_view_action: [
        "VIEW_ANALYSIS_RESULTS",
        "VIEW_DASHBOARD",
        "VIEW_OPEN_JOBS",
        "VIEW_OWN_JOBS",
        "VIEW_DONE_JOBS",
      ],
      request_status: ["SUCCESS", "FAIL"],
      sync_status: ["SUCCESS", "FAIL"],
    },
  },
  graphql_public: {
    Enums: {},
  },
  medreport: {
    Enums: {
      analysis_feedback_status: ["STARTED", "DRAFT", "COMPLETED"],
      analysis_order_status: [
        "QUEUED",
        "ON_HOLD",
        "PROCESSING",
        "COMPLETED",
        "REJECTED",
        "CANCELLED",
        "PARTIAL_ANALYSIS_RESPONSE",
        "FULL_ANALYSIS_RESPONSE",
        "WAITING_FOR_DOCTOR_RESPONSE",
      ],
      app_permissions: [
        "roles.manage",
        "billing.manage",
        "settings.manage",
        "members.manage",
        "invites.manage",
      ],
      application_role: ["user", "doctor", "super_admin"],
      billing_provider: ["stripe", "lemon-squeezy", "paddle", "montonio"],
      connected_online_order_status: [
        "PENDING",
        "CONFIRMED",
        "REJECTED",
        "CANCELLED",
      ],
      locale: ["en", "et", "ru"],
      notification_channel: ["in_app", "email"],
      notification_type: ["info", "warning", "error"],
      payment_status: ["pending", "succeeded", "failed"],
      subscription_item_type: ["flat", "per_seat", "metered"],
      subscription_status: [
        "active",
        "trialing",
        "past_due",
        "canceled",
        "unpaid",
        "incomplete",
        "incomplete_expired",
        "paused",
      ],
    },
  },
  public: {
    Enums: {
      app_permissions: [
        "roles.manage",
        "billing.manage",
        "settings.manage",
        "members.manage",
        "invites.manage",
      ],
      claim_reason_enum: [
        "missing_item",
        "wrong_item",
        "production_failure",
        "other",
      ],
      order_claim_type_enum: ["refund", "replace"],
      order_status_enum: [
        "pending",
        "completed",
        "draft",
        "archived",
        "canceled",
        "requires_action",
      ],
      return_status_enum: [
        "open",
        "requested",
        "received",
        "partially_received",
        "canceled",
      ],
    },
  },
} as const

