import {PerformanceRatioDataDto} from "../../../api/RequestBodyData";

export type Size = {
    width: number,
    height: number
}

export type Margins = {
    bottom: number,
    top: number,
    left: number,
    right: number
}

export type LegendOffset = {
    bottom: number,
    top: number,
    left: number,
    right: number
}

export type MeasurementOptions = {
    withInverter?: Inverter[],
    withoutInverter?: Instrument[]
}

export type PickedMeasurements = {
    pickedInverterId?: number,
    pickedInstrumentIds?: number[]
}

export type Inverter = {
    inverterId: number,
    isOpen: boolean,
    isChecked: boolean,
    instruments: Instrument[]
}

export type Instrument = {
    id: number,
    isChecked: boolean,
    monitoredAreas: MonitoredArea[]
}

export type MonitoredArea = {
    id: number,
    description: string
}

export type MeasurementData = {
    instrumentEnergyAndIrradiance?: EnergyAndIrradianceData[],
    sumEnergy?: SumEnergyData,
    performanceRatio?: PerformanceRatioDataDto
}

export type EnergyAndIrradianceData = {
    instrumentId: number,
    minT: Date,
    maxT: Date,
    irradiance: DataPoint[],
    monitoredAreaEnergy?: MonitoredAreaEnergy[]
}

export type MonitoredAreaEnergy = {
    monitoredAreaId: number,
    graphData: DataPoint[]
}

export type SumEnergyData = {
    minT: Date,
    maxT: Date,
    realEnergy?: InverterEnergy,
    theoreticalEnergy: InstrumentEnergy[]
}

export type InstrumentEnergy = {
    instrumentId: number,
    graphData: DataPoint[]
}

export type InverterEnergy = {
    inverterId: number,
    graphData: DataPoint[]
}

export type PerformanceRatioData = {
    minT: Date,
    maxT: Date,
    inverterId: number,
    instrumentIds: number[],
    monitoredAreas: MonitoredArea[],
    graphData: DataPoint[]
}

export type DataPoint = {
    time: Date,
    value: number
}