import type { UserPublic } from './user'

export type ChoreFrequency = 'one_time' | 'daily' | 'weekly' | 'monthly' | 'custom'
export type ChoreType = 'personal' | 'group'

export interface Chore {
  id: number
  group_id?: number
  name: string
  description?: string
  created_by_id: number
  frequency: ChoreFrequency
  custom_interval_days?: number
  next_due_date: string
  last_completed_at?: string
  created_at: string
  updated_at: string
  type: ChoreType
  creator?: {
    id: number
    name: string
    email: string
  }
  assignments?: ChoreAssignment[]
}

export interface ChoreCreate {
  name: string
  description?: string
  frequency: ChoreFrequency
  custom_interval_days?: number
  next_due_date: string
  type: ChoreType
  group_id?: number
}

export interface ChoreUpdate {
  name?: string
  description?: string
  frequency?: ChoreFrequency
  custom_interval_days?: number
  next_due_date?: string
  type?: ChoreType
  group_id?: number
}

// Chore Assignment Types
export interface ChoreAssignment {
  id: number
  chore_id: number
  assigned_to_user_id: number
  due_date: string
  is_complete: boolean
  completed_at?: string
  created_at: string
  updated_at: string
  chore?: Chore
  assigned_user?: UserPublic
}

export interface ChoreAssignmentCreate {
  chore_id: number
  assigned_to_user_id: number
  due_date: string
}

export interface ChoreAssignmentUpdate {
  is_complete?: boolean
  due_date?: string
}
