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

export type Database = {
  // Allows to automatically instantiate createClient with right options
  // instead of createClient<Database, { PostgrestVersion: 'XX' }>(URL, KEY)
  __InternalSupabase: {
    PostgrestVersion: "14.5"
  }
  public: {
    Tables: {
      ai_conversations: {
        Row: {
          created_at: string
          id: string
          title: string | null
          updated_at: string
          user_id: string | null
        }
        Insert: {
          created_at?: string
          id?: string
          title?: string | null
          updated_at?: string
          user_id?: string | null
        }
        Update: {
          created_at?: string
          id?: string
          title?: string | null
          updated_at?: string
          user_id?: string | null
        }
        Relationships: []
      }
      ai_faqs: {
        Row: {
          active: boolean
          answer: string
          created_at: string
          id: string
          question: string
          sort_order: number
          updated_at: string
        }
        Insert: {
          active?: boolean
          answer: string
          created_at?: string
          id?: string
          question: string
          sort_order?: number
          updated_at?: string
        }
        Update: {
          active?: boolean
          answer?: string
          created_at?: string
          id?: string
          question?: string
          sort_order?: number
          updated_at?: string
        }
        Relationships: []
      }
      ai_messages: {
        Row: {
          content: string
          conversation_id: string
          created_at: string
          flagged_unanswered: boolean
          id: string
          rating: number | null
          role: string
        }
        Insert: {
          content: string
          conversation_id: string
          created_at?: string
          flagged_unanswered?: boolean
          id?: string
          rating?: number | null
          role: string
        }
        Update: {
          content?: string
          conversation_id?: string
          created_at?: string
          flagged_unanswered?: boolean
          id?: string
          rating?: number | null
          role?: string
        }
        Relationships: [
          {
            foreignKeyName: "ai_messages_conversation_id_fkey"
            columns: ["conversation_id"]
            isOneToOne: false
            referencedRelation: "ai_conversations"
            referencedColumns: ["id"]
          },
        ]
      }
      announcements: {
        Row: {
          body: string
          created_at: string
          id: string
          is_active: boolean
          title: string
          updated_at: string
        }
        Insert: {
          body: string
          created_at?: string
          id?: string
          is_active?: boolean
          title: string
          updated_at?: string
        }
        Update: {
          body?: string
          created_at?: string
          id?: string
          is_active?: boolean
          title?: string
          updated_at?: string
        }
        Relationships: []
      }
      business_settings: {
        Row: {
          ai_enabled: boolean
          email: string
          facebook_url: string | null
          hours: string
          id: number
          instagram_url: string | null
          location: string
          phone: string
          tiktok_url: string | null
          twitter_url: string | null
          updated_at: string
          whatsapp: string
          whatsapp_group_url: string | null
        }
        Insert: {
          ai_enabled?: boolean
          email?: string
          facebook_url?: string | null
          hours?: string
          id?: number
          instagram_url?: string | null
          location?: string
          phone?: string
          tiktok_url?: string | null
          twitter_url?: string | null
          updated_at?: string
          whatsapp?: string
          whatsapp_group_url?: string | null
        }
        Update: {
          ai_enabled?: boolean
          email?: string
          facebook_url?: string | null
          hours?: string
          id?: number
          instagram_url?: string | null
          location?: string
          phone?: string
          tiktok_url?: string | null
          twitter_url?: string | null
          updated_at?: string
          whatsapp?: string
          whatsapp_group_url?: string | null
        }
        Relationships: []
      }
      catalog_services: {
        Row: {
          base_price: number
          category: string
          created_at: string
          description: string
          icon: string
          id: string
          image_url: string | null
          is_active: boolean
          is_featured: boolean
          name: string
          price_label: string
          requirements: string[]
          slug: string
          sort_order: number
          turnaround: string
          updated_at: string
        }
        Insert: {
          base_price?: number
          category?: string
          created_at?: string
          description?: string
          icon?: string
          id?: string
          image_url?: string | null
          is_active?: boolean
          is_featured?: boolean
          name: string
          price_label?: string
          requirements?: string[]
          slug: string
          sort_order?: number
          turnaround?: string
          updated_at?: string
        }
        Update: {
          base_price?: number
          category?: string
          created_at?: string
          description?: string
          icon?: string
          id?: string
          image_url?: string | null
          is_active?: boolean
          is_featured?: boolean
          name?: string
          price_label?: string
          requirements?: string[]
          slug?: string
          sort_order?: number
          turnaround?: string
          updated_at?: string
        }
        Relationships: []
      }
      contact_submissions: {
        Row: {
          admin_reply: string | null
          created_at: string
          email: string
          id: string
          message: string
          name: string
          phone: string | null
          status: Database["public"]["Enums"]["contact_status"]
          updated_at: string
        }
        Insert: {
          admin_reply?: string | null
          created_at?: string
          email: string
          id?: string
          message: string
          name: string
          phone?: string | null
          status?: Database["public"]["Enums"]["contact_status"]
          updated_at?: string
        }
        Update: {
          admin_reply?: string | null
          created_at?: string
          email?: string
          id?: string
          message?: string
          name?: string
          phone?: string | null
          status?: Database["public"]["Enums"]["contact_status"]
          updated_at?: string
        }
        Relationships: []
      }
      deposits: {
        Row: {
          admin_notes: string | null
          amount: number
          channel_id: string | null
          created_at: string
          id: string
          mpesa_reference: string
          note: string | null
          paystack_reference: string | null
          provider: string
          reviewed_at: string | null
          reviewed_by: string | null
          status: Database["public"]["Enums"]["deposit_status"]
          updated_at: string
          user_id: string
        }
        Insert: {
          admin_notes?: string | null
          amount: number
          channel_id?: string | null
          created_at?: string
          id?: string
          mpesa_reference: string
          note?: string | null
          paystack_reference?: string | null
          provider?: string
          reviewed_at?: string | null
          reviewed_by?: string | null
          status?: Database["public"]["Enums"]["deposit_status"]
          updated_at?: string
          user_id: string
        }
        Update: {
          admin_notes?: string | null
          amount?: number
          channel_id?: string | null
          created_at?: string
          id?: string
          mpesa_reference?: string
          note?: string | null
          paystack_reference?: string | null
          provider?: string
          reviewed_at?: string | null
          reviewed_by?: string | null
          status?: Database["public"]["Enums"]["deposit_status"]
          updated_at?: string
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "deposits_channel_id_fkey"
            columns: ["channel_id"]
            isOneToOne: false
            referencedRelation: "payment_channels"
            referencedColumns: ["id"]
          },
        ]
      }
      notifications: {
        Row: {
          body: string
          created_at: string
          id: string
          is_read: boolean
          link: string | null
          order_id: string | null
          title: string
          user_id: string
        }
        Insert: {
          body?: string
          created_at?: string
          id?: string
          is_read?: boolean
          link?: string | null
          order_id?: string | null
          title: string
          user_id: string
        }
        Update: {
          body?: string
          created_at?: string
          id?: string
          is_read?: boolean
          link?: string | null
          order_id?: string | null
          title?: string
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "notifications_order_id_fkey"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "orders"
            referencedColumns: ["id"]
          },
        ]
      }
      offers: {
        Row: {
          active: boolean
          badge: string | null
          created_at: string
          cta_label: string | null
          cta_url: string | null
          description: string
          ends_at: string | null
          id: string
          promo_code: string | null
          sort_order: number
          starts_at: string | null
          title: string
          updated_at: string
        }
        Insert: {
          active?: boolean
          badge?: string | null
          created_at?: string
          cta_label?: string | null
          cta_url?: string | null
          description: string
          ends_at?: string | null
          id?: string
          promo_code?: string | null
          sort_order?: number
          starts_at?: string | null
          title: string
          updated_at?: string
        }
        Update: {
          active?: boolean
          badge?: string | null
          created_at?: string
          cta_label?: string | null
          cta_url?: string | null
          description?: string
          ends_at?: string | null
          id?: string
          promo_code?: string | null
          sort_order?: number
          starts_at?: string | null
          title?: string
          updated_at?: string
        }
        Relationships: []
      }
      order_documents: {
        Row: {
          created_at: string
          id: string
          kind: string
          mime_type: string | null
          name: string
          order_id: string
          path: string
          size_bytes: number | null
          user_id: string
        }
        Insert: {
          created_at?: string
          id?: string
          kind?: string
          mime_type?: string | null
          name: string
          order_id: string
          path: string
          size_bytes?: number | null
          user_id: string
        }
        Update: {
          created_at?: string
          id?: string
          kind?: string
          mime_type?: string | null
          name?: string
          order_id?: string
          path?: string
          size_bytes?: number | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "order_documents_order_id_fkey"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "orders"
            referencedColumns: ["id"]
          },
        ]
      }
      orders: {
        Row: {
          admin_notes: string | null
          assigned_to: string | null
          completed_at: string | null
          contact_email: string | null
          contact_name: string
          contact_phone: string
          created_at: string
          delivery_notes: string | null
          details: Json
          discount: number
          id: string
          notes: string | null
          order_no: string
          paid_at: string | null
          payment_status: Database["public"]["Enums"]["order_payment_status"]
          price: number | null
          service_id: string | null
          service_name: string
          service_slug: string
          status: Database["public"]["Enums"]["order_status"]
          updated_at: string
          user_id: string
          whatsapp: string | null
        }
        Insert: {
          admin_notes?: string | null
          assigned_to?: string | null
          completed_at?: string | null
          contact_email?: string | null
          contact_name: string
          contact_phone: string
          created_at?: string
          delivery_notes?: string | null
          details?: Json
          discount?: number
          id?: string
          notes?: string | null
          order_no: string
          paid_at?: string | null
          payment_status?: Database["public"]["Enums"]["order_payment_status"]
          price?: number | null
          service_id?: string | null
          service_name: string
          service_slug: string
          status?: Database["public"]["Enums"]["order_status"]
          updated_at?: string
          user_id: string
          whatsapp?: string | null
        }
        Update: {
          admin_notes?: string | null
          assigned_to?: string | null
          completed_at?: string | null
          contact_email?: string | null
          contact_name?: string
          contact_phone?: string
          created_at?: string
          delivery_notes?: string | null
          details?: Json
          discount?: number
          id?: string
          notes?: string | null
          order_no?: string
          paid_at?: string | null
          payment_status?: Database["public"]["Enums"]["order_payment_status"]
          price?: number | null
          service_id?: string | null
          service_name?: string
          service_slug?: string
          status?: Database["public"]["Enums"]["order_status"]
          updated_at?: string
          user_id?: string
          whatsapp?: string | null
        }
        Relationships: [
          {
            foreignKeyName: "orders_service_id_fkey"
            columns: ["service_id"]
            isOneToOne: false
            referencedRelation: "catalog_services"
            referencedColumns: ["id"]
          },
        ]
      }
      payment_channels: {
        Row: {
          account_name: string | null
          account_number: string | null
          created_at: string
          id: string
          instructions: string | null
          is_active: boolean
          kind: string
          name: string
          paybill_number: string | null
          sort_order: number
          till_number: string | null
          updated_at: string
        }
        Insert: {
          account_name?: string | null
          account_number?: string | null
          created_at?: string
          id?: string
          instructions?: string | null
          is_active?: boolean
          kind?: string
          name: string
          paybill_number?: string | null
          sort_order?: number
          till_number?: string | null
          updated_at?: string
        }
        Update: {
          account_name?: string | null
          account_number?: string | null
          created_at?: string
          id?: string
          instructions?: string | null
          is_active?: boolean
          kind?: string
          name?: string
          paybill_number?: string | null
          sort_order?: number
          till_number?: string | null
          updated_at?: string
        }
        Relationships: []
      }
      payments: {
        Row: {
          amount: number
          created_at: string
          description: string | null
          id: string
          method: Database["public"]["Enums"]["payment_method"]
          order_id: string | null
          reference: string | null
          user_id: string
        }
        Insert: {
          amount: number
          created_at?: string
          description?: string | null
          id?: string
          method?: Database["public"]["Enums"]["payment_method"]
          order_id?: string | null
          reference?: string | null
          user_id: string
        }
        Update: {
          amount?: number
          created_at?: string
          description?: string | null
          id?: string
          method?: Database["public"]["Enums"]["payment_method"]
          order_id?: string | null
          reference?: string | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "payments_order_id_fkey"
            columns: ["order_id"]
            isOneToOne: false
            referencedRelation: "orders"
            referencedColumns: ["id"]
          },
        ]
      }
      profiles: {
        Row: {
          avatar_url: string | null
          created_at: string
          email: string | null
          first_paid_at: string | null
          full_name: string | null
          id: string
          is_active: boolean
          loyalty_points: number
          phone: string | null
          referral_code: string | null
          referred_by: string | null
          updated_at: string
          username: string | null
        }
        Insert: {
          avatar_url?: string | null
          created_at?: string
          email?: string | null
          first_paid_at?: string | null
          full_name?: string | null
          id: string
          is_active?: boolean
          loyalty_points?: number
          phone?: string | null
          referral_code?: string | null
          referred_by?: string | null
          updated_at?: string
          username?: string | null
        }
        Update: {
          avatar_url?: string | null
          created_at?: string
          email?: string | null
          first_paid_at?: string | null
          full_name?: string | null
          id?: string
          is_active?: boolean
          loyalty_points?: number
          phone?: string | null
          referral_code?: string | null
          referred_by?: string | null
          updated_at?: string
          username?: string | null
        }
        Relationships: []
      }
      promo_codes: {
        Row: {
          active: boolean
          code: string
          created_at: string
          description: string | null
          expires_at: string | null
          id: string
          kind: string
          min_amount: number
          per_user_limit: number
          starts_at: string | null
          updated_at: string
          usage_limit: number | null
          value: number
        }
        Insert: {
          active?: boolean
          code: string
          created_at?: string
          description?: string | null
          expires_at?: string | null
          id?: string
          kind: string
          min_amount?: number
          per_user_limit?: number
          starts_at?: string | null
          updated_at?: string
          usage_limit?: number | null
          value: number
        }
        Update: {
          active?: boolean
          code?: string
          created_at?: string
          description?: string | null
          expires_at?: string | null
          id?: string
          kind?: string
          min_amount?: number
          per_user_limit?: number
          starts_at?: string | null
          updated_at?: string
          usage_limit?: number | null
          value?: number
        }
        Relationships: []
      }
      promo_redemptions: {
        Row: {
          code_id: string
          created_at: string
          discount: number
          id: string
          request_id: string | null
          user_id: string
        }
        Insert: {
          code_id: string
          created_at?: string
          discount: number
          id?: string
          request_id?: string | null
          user_id: string
        }
        Update: {
          code_id?: string
          created_at?: string
          discount?: number
          id?: string
          request_id?: string | null
          user_id?: string
        }
        Relationships: [
          {
            foreignKeyName: "promo_redemptions_code_id_fkey"
            columns: ["code_id"]
            isOneToOne: false
            referencedRelation: "promo_codes"
            referencedColumns: ["id"]
          },
          {
            foreignKeyName: "promo_redemptions_request_id_fkey"
            columns: ["request_id"]
            isOneToOne: false
            referencedRelation: "service_requests"
            referencedColumns: ["id"]
          },
        ]
      }
      referrals: {
        Row: {
          created_at: string
          id: string
          referee_id: string
          referrer_id: string
          reward_amount: number
          rewarded_at: string | null
        }
        Insert: {
          created_at?: string
          id?: string
          referee_id: string
          referrer_id: string
          reward_amount?: number
          rewarded_at?: string | null
        }
        Update: {
          created_at?: string
          id?: string
          referee_id?: string
          referrer_id?: string
          reward_amount?: number
          rewarded_at?: string | null
        }
        Relationships: []
      }
      service_overrides: {
        Row: {
          created_at: string
          description_override: string | null
          is_available: boolean
          price: string | null
          slug: string
          updated_at: string
        }
        Insert: {
          created_at?: string
          description_override?: string | null
          is_available?: boolean
          price?: string | null
          slug: string
          updated_at?: string
        }
        Update: {
          created_at?: string
          description_override?: string | null
          is_available?: boolean
          price?: string | null
          slug?: string
          updated_at?: string
        }
        Relationships: []
      }
      service_requests: {
        Row: {
          admin_notes: string | null
          attachments: Json
          contact_email: string | null
          contact_name: string
          contact_phone: string
          created_at: string
          deliverables: Json
          delivered_at: string | null
          delivery_notes: string | null
          discount: number
          id: string
          notes: string | null
          paid: boolean
          paid_at: string | null
          points_earned: number
          points_redeemed: number
          price: number | null
          promo_code: string | null
          service_name: string
          service_slug: string
          status: Database["public"]["Enums"]["request_status"]
          updated_at: string
          user_id: string | null
        }
        Insert: {
          admin_notes?: string | null
          attachments?: Json
          contact_email?: string | null
          contact_name: string
          contact_phone: string
          created_at?: string
          deliverables?: Json
          delivered_at?: string | null
          delivery_notes?: string | null
          discount?: number
          id?: string
          notes?: string | null
          paid?: boolean
          paid_at?: string | null
          points_earned?: number
          points_redeemed?: number
          price?: number | null
          promo_code?: string | null
          service_name: string
          service_slug: string
          status?: Database["public"]["Enums"]["request_status"]
          updated_at?: string
          user_id?: string | null
        }
        Update: {
          admin_notes?: string | null
          attachments?: Json
          contact_email?: string | null
          contact_name?: string
          contact_phone?: string
          created_at?: string
          deliverables?: Json
          delivered_at?: string | null
          delivery_notes?: string | null
          discount?: number
          id?: string
          notes?: string | null
          paid?: boolean
          paid_at?: string | null
          points_earned?: number
          points_redeemed?: number
          price?: number | null
          promo_code?: string | null
          service_name?: string
          service_slug?: string
          status?: Database["public"]["Enums"]["request_status"]
          updated_at?: string
          user_id?: string | null
        }
        Relationships: []
      }
      user_roles: {
        Row: {
          created_at: string
          id: string
          role: Database["public"]["Enums"]["app_role"]
          user_id: string
        }
        Insert: {
          created_at?: string
          id?: string
          role: Database["public"]["Enums"]["app_role"]
          user_id: string
        }
        Update: {
          created_at?: string
          id?: string
          role?: Database["public"]["Enums"]["app_role"]
          user_id?: string
        }
        Relationships: []
      }
      wallets: {
        Row: {
          balance: number
          created_at: string
          updated_at: string
          user_id: string
        }
        Insert: {
          balance?: number
          created_at?: string
          updated_at?: string
          user_id: string
        }
        Update: {
          balance?: number
          created_at?: string
          updated_at?: string
          user_id?: string
        }
        Relationships: []
      }
    }
    Views: {
      [_ in never]: never
    }
    Functions: {
      apply_promo_to_request: {
        Args: { _code: string; _request_id: string }
        Returns: number
      }
      approve_deposit: {
        Args: { _deposit_id: string; _note?: string }
        Returns: undefined
      }
      credit_deposit_gateway: {
        Args: { _deposit_id: string; _provider?: string; _reference: string }
        Returns: undefined
      }
      credit_deposit_paystack: {
        Args: { _deposit_id: string; _reference: string }
        Returns: undefined
      }
      has_role: {
        Args: {
          _role: Database["public"]["Enums"]["app_role"]
          _user_id: string
        }
        Returns: boolean
      }
      pay_for_service: { Args: { _request_id: string }; Returns: undefined }
      pay_order_from_wallet: { Args: { _order_id: string }; Returns: undefined }
      redeem_points_on_request: {
        Args: { _points: number; _request_id: string }
        Returns: number
      }
      reject_deposit: {
        Args: { _deposit_id: string; _note?: string }
        Returns: undefined
      }
    }
    Enums: {
      app_role: "admin" | "user"
      contact_status: "new" | "in_progress" | "replied" | "closed"
      deposit_status: "pending" | "approved" | "rejected"
      order_payment_status: "unpaid" | "pending" | "paid" | "refunded"
      order_status:
        | "submitted"
        | "in_review"
        | "processing"
        | "awaiting_info"
        | "completed"
        | "cancelled"
      payment_method: "wallet" | "mpesa" | "paystack" | "cash"
      request_status: "pending" | "processing" | "completed" | "cancelled"
    }
    CompositeTypes: {
      [_ in never]: never
    }
  }
}

type DatabaseWithoutInternals = Omit<Database, "__InternalSupabase">

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

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

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

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

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

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

export const Constants = {
  public: {
    Enums: {
      app_role: ["admin", "user"],
      contact_status: ["new", "in_progress", "replied", "closed"],
      deposit_status: ["pending", "approved", "rejected"],
      order_payment_status: ["unpaid", "pending", "paid", "refunded"],
      order_status: [
        "submitted",
        "in_review",
        "processing",
        "awaiting_info",
        "completed",
        "cancelled",
      ],
      payment_method: ["wallet", "mpesa", "paystack", "cash"],
      request_status: ["pending", "processing", "completed", "cancelled"],
    },
  },
} as const
