export type UserRole = 'CUSTOMER' | 'SUPERVISOR' | 'MANAGER' | 'ADMIN'
export type ReviewSentiment = 'POSITIVE' | 'NEGATIVE'
export type ReviewStatus = 'PENDING' | 'ACKNOWLEDGED' | 'RESOLVED'

export interface User {
  id: string
  email: string
  name: string
  company?: string | null
  phone?: string | null
  role: UserRole
  isActive: boolean
  createdAt: string
}

export interface Review {
  id: string
  reviewCode: string
  customerId: string
  customer?: User
  rating: number
  title: string
  content: string
  sentiment: ReviewSentiment
  status: ReviewStatus
  assignedToId?: string | null
  assignedTo?: User
  serviceDate: string
  serviceType: string
  subType?: string | null
  notifiedAt?: string | null
  resolvedAt?: string | null
  createdAt: string
  updatedAt: string
  photos?: ReviewPhoto[]
  responses?: SupervisorResponse[]
}

export interface ReviewPhoto {
  id: string
  reviewId: string
  storageKey: string
  fileName: string
  sizeBytes: number
  uploadedAt: string
}

export interface SupervisorResponse {
  id: string
  reviewId: string
  supervisorId: string
  supervisor?: User
  actionTaken: string
  internalNote: string
  responseToClient: string
  createdAt: string
}

export interface Notification {
  id: string
  userId: string
  title: string
  message: string
  type: string
  reviewId?: string | null
  isRead: boolean
  createdAt: string
}

export const SERVICE_TYPES = [
  'Limpieza de oficinas',
  'Limpieza de baños',
  'Limpieza de domicilios',
  'Limpieza de Cocina',
  'Lavado de Alfombras',
  'Asistencia del personal Totes',
  'Provisión de insumos',
  'Imagen del personal',
] as const

export const PERSONNEL_SUB_TYPES = [
  'Falta',
  'Atraso',
  'Abandono laboral',
] as const

export const IMAGE_SUB_TYPES = [
  'Uniforme sucio',
  'Uniforme roto',
  'Falta de higiene',
  'Estado inconveniente',
] as const

export const STATUS_COLORS: Record<ReviewStatus, string> = {
  PENDING: 'bg-red-100 text-[#8B1A1A] border-red-200',
  ACKNOWLEDGED: 'bg-[#FFF3E5] text-[#7A3D00] border-[#FFD4B0]',
  RESOLVED: 'bg-[#E8FBF4] text-[#0F6E56] border-[#B0E8D4]',
}

export const STATUS_LABELS: Record<ReviewStatus, string> = {
  PENDING: 'Pendiente',
  ACKNOWLEDGED: 'En Proceso',
  RESOLVED: 'Resuelto',
}

export const SENTIMENT_COLORS: Record<ReviewSentiment, string> = {
  POSITIVE: 'text-[#1ECC8B]',
  NEGATIVE: 'text-[#F0453A]',
}

export const ROLE_LABELS: Record<UserRole, string> = {
  CUSTOMER: 'Cliente',
  SUPERVISOR: 'Supervisor',
  MANAGER: 'Gerencia',
  ADMIN: 'Administrador',
}
