import type { PSATicketSearchResult } from '@/types/integrations'

export interface TicketFilters {
  search: string
  board_id: number | null
  status_id: number | null
  priority: string | null
  company_id: number | null
  assigned: 'me' | 'unassigned' | 'all' | number
  include_closed: boolean
}

export const DEFAULT_TICKET_FILTERS: TicketFilters = {
  search: '',
  board_id: null,
  status_id: null,
  priority: null,
  company_id: null,
  assigned: 'all',
  include_closed: false,
}

export interface TicketCreationPayload {
  summary: string
  company_id: number | null
  board_id: number | null
  status_id: number | null
  priority_id: number | null
  description: string
  assigned_member_id: number | null
}

export interface AiParseResponse {
  summary: string | null
  company_id: number | null
  board_id: number | null
  priority_id: number | null
  status_id: number | null
  assigned_member_id: number | null
  description: string | null
  missing_fields: string[]
  warnings: string[]
}

export interface PSAResource {
  member_id: number
  member_name: string
  member_identifier: string
  is_rf_user: boolean
}

export interface PSATicketCreated {
  id: number
  summary: string
  board_name: string
  status_name: string
  priority_name: string
  company_name: string
  resources: PSAResource[]
}

export interface PSATicketStatusUpdate {
  ticket_id: number
  previous_status: string
  new_status: string
  new_status_id: number
}

export interface TicketListResponse {
  items: PSATicketSearchResult[]
  total: number
  page: number
  page_size: number
}

export interface PSAPriority {
  id: number
  name: string
}
