package llc.arma.fleet.monitor.presentation.model

import llc.arma.fleet.monitor.data.entity.MachineEntity
import llc.arma.fleet.monitor.data.entity.UserEntity
import llc.arma.fleet.monitor.data.entity.MachineStateIntervalEntity
import java.time.OffsetDateTime

data class CreateMachinePayload(
    val name: String,
    val licensePlate: String,
    val typeId: Long,
    val departmentId: Long,
    val description: String?,
)

data class UpdateMachinePayload(
    val name: String?,
    val licensePlate: String?,
    val typeId: Long?,
    val departmentId: Long?,
    val description: String?,
)

data class BeaconTelemetryPayload(
    val mac: String,
    val vibration: Double,
    val duration: Int,
    val timeMillis: Long,
)

data class CreateMachineStateDefinitionPayload(
    val name: String,
    val icon: String,
    val color: String,
    val description: String?,
)

data class UpdateMachineStateDefinitionPayload(
    val name: String?,
    val icon: String?,
    val color: String?,
    val description: String?,
)

data class CreateMachineCalibrationRulePayload(
    val machineId: Long,
    val stateDefinitionId: Long,
    val vibrationMin: Double,
    val vibrationMax: Double,
)

data class UpdateMachineCalibrationRulePayload(
    val stateDefinitionId: Long?,
    val vibrationMin: Double?,
    val vibrationMax: Double?,
)

data class UsersPage(
    val totalPages: Int,
    val totalElements: Long,
    val page: List<UserEntity>,
)

data class MachinesPage(
    val totalPages: Int,
    val totalElements: Long,
    val page: List<MachineEntity>,
)

data class MachineStateHistoryPage(
    val totalPages: Int,
    val totalElements: Long,
    val page: List<MachineStateIntervalEntity>,
)

data class MachineUsageSummary(
    val machine: MachineEntity,
    val periodStart: OffsetDateTime,
    val periodEnd: OffsetDateTime,
    val movingSeconds: Int,
    val engineOnSeconds: Int,
    val idleSeconds: Int,
    val noDataSeconds: Int,
    val stateChangesCount: Int,
    val utilizationPercent: Int,
)

data class MachineDailyUsageStat(
    val machine: MachineEntity,
    val date: String,
    val movingSeconds: Int,
    val engineOnSeconds: Int,
    val idleSeconds: Int,
    val noDataSeconds: Int,
    val utilizationPercent: Int,
)
