// AUTO-GENERATED — do not edit manually.
// Run `just db-types` to regenerate from Supabase schema.
// Manually seeded from migrations until `supabase gen types typescript` can run.

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

export type LanguageCode = 'en' | 'es';
export type AvatarTypeEnum = 'initials' | 'emoji' | 'upload';
export type MemberRoleEnum = 'admin' | 'member' | 'guest';
export type ListStatusEnum = 'active' | 'completed' | 'archived';
export type NoteColor = 'yellow' | 'green' | 'blue' | 'pink' | 'purple' | 'orange' | 'gray' | 'red';

export interface Database {
	public: {
		Tables: {
			users: {
				Row: {
					id: string;
					email: string;
					display_name: string;
					language: LanguageCode;
					avatar_type: AvatarTypeEnum;
					avatar_emoji: string | null;
					avatar_url: string | null;
					created_at: string;
					updated_at: string;
				};
				Insert: {
					id: string;
					email: string;
					display_name?: string;
					language?: LanguageCode;
					avatar_type?: AvatarTypeEnum;
					avatar_emoji?: string | null;
					avatar_url?: string | null;
					created_at?: string;
					updated_at?: string;
				};
				Update: {
					id?: string;
					email?: string;
					display_name?: string;
					language?: LanguageCode;
					avatar_type?: AvatarTypeEnum;
					avatar_emoji?: string | null;
					avatar_url?: string | null;
					created_at?: string;
					updated_at?: string;
				};
				Relationships: [];
			};
			collectives: {
				Row: {
					id: string;
					name: string;
					emoji: string;
					created_by: string;
					created_at: string;
				};
				Insert: {
					id?: string;
					name: string;
					emoji?: string;
					created_by: string;
					created_at?: string;
				};
				Update: {
					id?: string;
					name?: string;
					emoji?: string;
					created_by?: string;
					created_at?: string;
				};
				Relationships: [
					{
						foreignKeyName: 'collectives_created_by_fkey';
						columns: ['created_by'];
						referencedRelation: 'users';
						referencedColumns: ['id'];
					}
				];
			};
			collective_members: {
				Row: {
					collective_id: string;
					user_id: string;
					role: MemberRoleEnum;
					joined_at: string;
				};
				Insert: {
					collective_id: string;
					user_id: string;
					role?: MemberRoleEnum;
					joined_at?: string;
				};
				Update: {
					collective_id?: string;
					user_id?: string;
					role?: MemberRoleEnum;
					joined_at?: string;
				};
				Relationships: [
					{
						foreignKeyName: 'collective_members_collective_id_fkey';
						columns: ['collective_id'];
						referencedRelation: 'collectives';
						referencedColumns: ['id'];
					},
					{
						foreignKeyName: 'collective_members_user_id_fkey';
						columns: ['user_id'];
						referencedRelation: 'users';
						referencedColumns: ['id'];
					}
				];
			};
			collective_invitations: {
				Row: {
					id: string;
					collective_id: string;
					token: string;
					role: MemberRoleEnum;
					created_by: string;
					created_at: string;
					expires_at: string;
					accepted_at: string | null;
					accepted_by: string | null;
				};
				Insert: {
					id?: string;
					collective_id: string;
					token?: string;
					role?: MemberRoleEnum;
					created_by: string;
					created_at?: string;
					expires_at?: string;
					accepted_at?: string | null;
					accepted_by?: string | null;
				};
				Update: {
					id?: string;
					collective_id?: string;
					token?: string;
					role?: MemberRoleEnum;
					created_by?: string;
					created_at?: string;
					expires_at?: string;
					accepted_at?: string | null;
					accepted_by?: string | null;
				};
				Relationships: [
					{
						foreignKeyName: 'collective_invitations_collective_id_fkey';
						columns: ['collective_id'];
						referencedRelation: 'collectives';
						referencedColumns: ['id'];
					},
					{
						foreignKeyName: 'collective_invitations_created_by_fkey';
						columns: ['created_by'];
						referencedRelation: 'users';
						referencedColumns: ['id'];
					}
				];
			};
			shopping_lists: {
				Row: {
					id: string;
					collective_id: string;
					name: string;
					status: ListStatusEnum;
					created_by: string;
					created_at: string;
					completed_at: string | null;
					deleted_at: string | null;
				};
				Insert: {
					id?: string;
					collective_id: string;
					name: string;
					status?: ListStatusEnum;
					created_by: string;
					created_at?: string;
					completed_at?: string | null;
					deleted_at?: string | null;
				};
				Update: {
					id?: string;
					collective_id?: string;
					name?: string;
					status?: ListStatusEnum;
					created_by?: string;
					created_at?: string;
					completed_at?: string | null;
					deleted_at?: string | null;
				};
				Relationships: [];
			};
			shopping_items: {
				Row: {
					id: string;
					list_id: string;
					name: string;
					quantity: number | null;
					is_checked: boolean;
					checked_by: string | null;
					checked_at: string | null;
					sort_order: number;
					created_by: string;
					created_at: string;
				};
				Insert: {
					id?: string;
					list_id: string;
					name: string;
					quantity?: number | null;
					is_checked?: boolean;
					checked_by?: string | null;
					checked_at?: string | null;
					sort_order?: number;
					created_by: string;
					created_at?: string;
				};
				Update: {
					id?: string;
					list_id?: string;
					name?: string;
					quantity?: number | null;
					is_checked?: boolean;
					checked_by?: string | null;
					checked_at?: string | null;
					sort_order?: number;
					created_by?: string;
					created_at?: string;
				};
				Relationships: [];
			};
			task_lists: {
				Row: {
					id: string;
					collective_id: string;
					name: string;
					created_by: string;
					created_at: string;
				};
				Insert: {
					id?: string;
					collective_id: string;
					name: string;
					created_by: string;
					created_at?: string;
				};
				Update: {
					id?: string;
					collective_id?: string;
					name?: string;
					created_by?: string;
					created_at?: string;
				};
				Relationships: [];
			};
			tasks: {
				Row: {
					id: string;
					list_id: string;
					title: string;
					is_completed: boolean;
					completed_by: string | null;
					completed_at: string | null;
					sort_order: number;
					created_by: string;
					created_at: string;
				};
				Insert: {
					id?: string;
					list_id: string;
					title: string;
					is_completed?: boolean;
					completed_by?: string | null;
					completed_at?: string | null;
					sort_order?: number;
					created_by: string;
					created_at?: string;
				};
				Update: {
					id?: string;
					list_id?: string;
					title?: string;
					is_completed?: boolean;
					completed_by?: string | null;
					completed_at?: string | null;
					sort_order?: number;
					created_by?: string;
					created_at?: string;
				};
				Relationships: [];
			};
			notes: {
				Row: {
					id: string;
					collective_id: string;
					title: string | null;
					content: string;
					color: NoteColor | null;
					is_pinned: boolean;
					is_archived: boolean;
					deleted_at: string | null;
					created_by: string;
					created_at: string;
					updated_by: string;
					updated_at: string;
				};
				Insert: {
					id?: string;
					collective_id: string;
					title?: string | null;
					content?: string;
					color?: NoteColor | null;
					is_pinned?: boolean;
					is_archived?: boolean;
					deleted_at?: string | null;
					created_by: string;
					created_at?: string;
					updated_by: string;
					updated_at?: string;
				};
				Update: {
					id?: string;
					collective_id?: string;
					title?: string | null;
					content?: string;
					color?: NoteColor | null;
					is_pinned?: boolean;
					is_archived?: boolean;
					deleted_at?: string | null;
					created_by?: string;
					created_at?: string;
					updated_by?: string;
					updated_at?: string;
				};
				Relationships: [];
			};
			item_frequency: {
				Row: {
					collective_id: string;
					name: string;
					use_count: number;
					last_used_at: string;
				};
				Insert: {
					collective_id: string;
					name: string;
					use_count?: number;
					last_used_at?: string;
				};
				Update: {
					collective_id?: string;
					name?: string;
					use_count?: number;
					last_used_at?: string;
				};
				Relationships: [];
			};
		};
		Views: Record<string, never>;
		Functions: {
			accept_invitation: {
				Args: { p_token: string };
				Returns: Json;
			};
			is_active_member: {
				Args: { p_collective_id: string };
				Returns: boolean;
			};
			is_member: {
				Args: { p_collective_id: string };
				Returns: boolean;
			};
			is_admin: {
				Args: { p_collective_id: string };
				Returns: boolean;
			};
		};
		Enums: {
			language_code: LanguageCode;
			avatar_type: AvatarTypeEnum;
			member_role: MemberRoleEnum;
			list_status: ListStatusEnum;
			note_color: NoteColor;
		};
	};
}
