export interface TicketDepartment {
  id: number;
  name: string;
  slug: string;
  position: number;
  is_active: boolean;
  created_at: string;
  updated_at: string;
}

export interface TicketStatus {
  id: number;
  name: string;
  slug: string;
  position: number;
  is_active: boolean;
  created_at: string;
  updated_at: string;
}

export interface TicketSubject {
  id: number;
  department_id: number;
  name: string;
  slug: string;
  position: number;
  is_active: boolean;
  created_at: string;
  updated_at: string;
  department?: TicketDepartment;
}

export interface TicketAttachment {
  id: number;
  created_at: string;
  updated_at: string;
  name: string;
  original_name: string;
  size: number;
  mime_type: string;
  serve_key: string;
  url: string;
  type?: string;
}

export interface TicketMessage {
  id: number;
  sender_type: "user" | "admin";
  message: string;
  created_at: string;
  attachments: TicketAttachment[];
}

export interface TicketAssignee {
  id: number;
  first_name?: string;
  last_name?: string;
  username?: string;
}

export interface TicketSummary {
  id: number;
  ticket_number: string;
  title: string;
  department?: TicketDepartment;
  subject?: TicketSubject;
  status?: TicketStatus;
  updated_at: string;
  assigned_to?: number;
  assigned_user?: TicketAssignee;
  created_at?: string;
}

export interface TicketDetail extends TicketSummary {
  messages: TicketMessage[];
  user?: {
    id: number;
    first_name?: string;
    last_name?: string;
    phone_number?: string;
  };
}

export interface TicketListResponse {
  tickets: TicketSummary[];
  total: number;
}

export interface TicketDetailResponse {
  ticket: TicketDetail;
}

export interface TicketDepartmentsResponse {
  departments: TicketDepartment[];
}

export interface TicketDepartmentResponse {
  department: TicketDepartment;
}

export interface TicketStatusesResponse {
  statuses: TicketStatus[];
}

export interface TicketStatusResponse {
  status: TicketStatus;
}

export interface TicketSubjectsResponse {
  subjects: TicketSubject[];
}

export interface TicketSubjectResponse {
  subject: TicketSubject;
}

export interface TicketFilters {
  limit?: number;
  offset?: number;
  page?: number;
  status_id?: number;
  department_id?: number;
  user_id?: number;
  assigned_to?: number;
  search?: string;
}

export interface TicketReplyRequest {
  message: string;
  file_ids?: number[];
}

export interface TicketStatusUpdateRequest {
  status_id: number;
}

export interface TicketAssignRequest {
  assigned_to: number;
}

export interface TicketDepartmentPayload {
  name: string;
  slug: string;
  position: number;
  is_active?: boolean;
}

export interface TicketStatusPayload {
  name: string;
  slug: string;
  position: number;
  is_active?: boolean;
}

export interface TicketSubjectPayload {
  department_id: number;
  name: string;
  slug: string;
  position: number;
  is_active?: boolean;
}

