// ============================================================================
// Task request / response types
// Generated from:
//   honeyDueAPI-go/internal/dto/requests/task.go
//   honeyDueAPI-go/internal/dto/responses/task.go
// ============================================================================

import type { TotalSummary } from "./residence";

// ---------------------------------------------------------------------------
// Requests
// ---------------------------------------------------------------------------

export interface CreateTaskRequest {
  residence_id: number;
  title: string;
  description?: string;
  category_id?: number | null;
  priority_id?: number | null;
  frequency_id?: number | null;
  custom_interval_days?: number | null;
  in_progress?: boolean;
  assigned_to_id?: number | null;
  due_date?: string | null;
  estimated_cost?: string | null;
  contractor_id?: number | null;
}

export interface UpdateTaskRequest {
  title?: string | null;
  description?: string | null;
  category_id?: number | null;
  priority_id?: number | null;
  frequency_id?: number | null;
  custom_interval_days?: number | null;
  in_progress?: boolean | null;
  assigned_to_id?: number | null;
  due_date?: string | null;
  estimated_cost?: string | null;
  actual_cost?: string | null;
  contractor_id?: number | null;
}

export interface CreateTaskCompletionRequest {
  task_id: number;
  completed_at?: string | null;
  notes?: string;
  actual_cost?: string | null;
  rating?: number | null;
  image_urls?: string[];
}

export interface UpdateTaskCompletionRequest {
  notes?: string | null;
  actual_cost?: string | null;
  rating?: number | null;
  image_urls?: string[];
}

export interface CompletionImageInput {
  image_url: string;
  caption?: string;
}

// ---------------------------------------------------------------------------
// Responses
// ---------------------------------------------------------------------------

export interface TaskCategoryResponse {
  id: number;
  name: string;
  description: string;
  icon: string;
  color: string;
  display_order: number;
}

export interface TaskPriorityResponse {
  id: number;
  name: string;
  level: number;
  color: string;
  display_order: number;
}

export interface TaskFrequencyResponse {
  id: number;
  name: string;
  days: number | null;
  display_order: number;
}

export interface TaskUserResponse {
  id: number;
  username: string;
  email: string;
  first_name: string;
  last_name: string;
}

export interface TaskCompletionImageResponse {
  id: number;
  image_url: string;
  media_url: string;
  caption: string;
}

export interface TaskCompletionResponse {
  id: number;
  task_id: number;
  completed_by?: TaskUserResponse | null;
  completed_at: string;
  notes: string;
  actual_cost: string | null;
  rating: number | null;
  images: TaskCompletionImageResponse[];
  created_at: string;
  task?: TaskResponse | null;
}

export interface TaskResponse {
  id: number;
  residence_id: number;
  created_by_id: number;
  created_by?: TaskUserResponse | null;
  assigned_to_id: number | null;
  assigned_to?: TaskUserResponse | null;
  title: string;
  description: string;
  category_id: number | null;
  category?: TaskCategoryResponse | null;
  priority_id: number | null;
  priority?: TaskPriorityResponse | null;
  frequency_id: number | null;
  frequency?: TaskFrequencyResponse | null;
  in_progress: boolean;
  due_date: string | null;
  next_due_date: string | null;
  estimated_cost: string | null;
  actual_cost: string | null;
  contractor_id: number | null;
  is_cancelled: boolean;
  is_archived: boolean;
  parent_task_id: number | null;
  completion_count: number;
  kanban_column?: string;
  created_at: string;
  updated_at: string;
}

export interface KanbanColumnResponse {
  name: string;
  display_name: string;
  button_types: string[];
  icons: Record<string, string>;
  color: string;
  tasks: TaskResponse[];
  count: number;
}

export interface KanbanBoardResponse {
  columns: KanbanColumnResponse[];
  days_threshold: number;
  residence_id: string;
}

// ---------------------------------------------------------------------------
// Response wrappers with summary
// ---------------------------------------------------------------------------

export interface TaskWithSummaryResponse {
  data: TaskResponse;
  summary: TotalSummary;
}

export interface TaskCompletionWithSummaryResponse {
  data: TaskCompletionResponse;
  summary: TotalSummary;
}

export interface DeleteWithSummaryResponse {
  data: string;
  summary: TotalSummary;
}
