export type EquipmentStatus =
  | "AVAILABLE"
  | "RENTED"
  | "MAINTENANCE"
  | "RESERVED"
  | "INACTIVE";

export interface EquipmentCategory {
  id: string;
  companyId?: string;
  name: string;
  description?: string | null;
  color?: string;
  createdAt?: string;
}

export interface EquipmentPhoto {
  id: string;
  equipmentId: string;
  url: string;
  caption?: string | null;
  isPrimary: boolean;
}

export interface ServiceOrderSummary {
  id: string;
  code: string;
  title: string;
  status: string;
  cost: number;
  openedAt: string;
}

export interface EquipmentRentalSummary {
  id: string;
  quantity: number;
  dailyRate: number;
  total: number;
  rental?: {
    id: string;
    code: string;
    status: string;
    startDate: string;
    endDate: string;
    customer?: { id: string; name: string };
  };
}

export interface Equipment {
  id: string;
  companyId: string;
  categoryId: string;
  code: string;
  assetTag: string;
  brand: string;
  model: string;
  year?: number | null;
  serialNumber?: string | null;
  acquisitionValue: number;
  dailyRate: number;
  weeklyRate: number;
  monthlyRate: number;
  status: EquipmentStatus;
  hourMeter?: number | null;
  mileage?: number | null;
  qrCode?: string | null;
  notes?: string | null;
  createdAt: string;
  updatedAt: string;
  category?: EquipmentCategory;
  photos?: EquipmentPhoto[];
  serviceOrders?: ServiceOrderSummary[];
  rentalItems?: EquipmentRentalSummary[];
  _count?: {
    serviceOrders: number;
    rentalItems: number;
  };
}

export interface CreateEquipmentDTO {
  categoryId: string;
  code: string;
  assetTag: string;
  brand: string;
  model: string;
  year?: number;
  serialNumber?: string;
  acquisitionValue?: number;
  dailyRate?: number;
  weeklyRate?: number;
  monthlyRate?: number;
  status?: EquipmentStatus;
  hourMeter?: number;
  mileage?: number;
  qrCode?: string;
  notes?: string;
}

export type UpdateEquipmentDTO = Partial<CreateEquipmentDTO>;

export interface EquipmentStats {
  total: number;
  available: number;
  rented: number;
  maintenance: number;
  reserved: number;
  totalAcquisitionValue: number;
}

export interface EquipmentFilterParams {
  search?: string;
  status?: EquipmentStatus | "ALL";
  categoryId?: string | "ALL";
  page?: number;
  limit?: number;
}
