export type FleetReportFormat = 'PDF' | 'XLSX'

export type FleetReportPeriod = 'PREVIOUS_DAY'

export type FleetReportSchedule = {
  id: number
  name: string
  recipientUserIds: number[]
  reportFormat: FleetReportFormat
  sendTime: string
  period: FleetReportPeriod
  timezone: string
  enabled: boolean
  createdAt: string
  updatedAt: string
}

export type FleetDailyReportMachineRow = {
  machineId: number
  name: string
  licensePlate: string
  type: string
  department: string
  beaconBound: boolean
  lastKnownState: string
  lastDataReceivedAt: string
  movingSeconds: number
  engineOnSeconds: number
  idleSeconds: number
  noDataSeconds: number
  stateChangesCount: number
  utilizationPercent: number
}

export type FleetDailyReportHistoryRow = {
  machineId: number
  machineName: string
  licensePlate: string
  startedAt: string
  endedAt: string
  state: string
  durationSeconds: number
}

export type FleetDailyReport = {
  date: string
  generatedAt: string
  summary: {
    totalMachines: number
    boundMachines: number
    unboundMachines: number
    machinesWithMovement: number
    machinesWithoutData: number
    movingSeconds: number
    engineOnSeconds: number
    idleSeconds: number
    noDataSeconds: number
    stateChangesCount: number
  }
  machines: FleetDailyReportMachineRow[]
  history: FleetDailyReportHistoryRow[]
}

export type GeneratedFleetReport = {
  fileName: string
  mimeType: string
  delivery: 'download' | 'print'
  blob?: Blob
  html?: string
}
