// SPDX-FileCopyrightText: 2025 Contributors to the CitrineOS Project
//
// SPDX-License-Identifier: Apache-2.0

/**
 * This file was automatically generated by json-schema-to-typescript.
 * DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
 * and run json-schema-to-typescript to regenerate this file.
 */

import {
  DERControlEnumType,
  DERUnitEnumType,
  PowerDuringCessationEnumType,
} from '../enums/index.js';
import type { OcppRequest } from '../../../internal-types.js';

export interface ReportDERControlRequest extends OcppRequest {
  /**
   * @minItems 1
   * @maxItems 24
   */
  curve?: [DERCurveGetType, ...DERCurveGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  enterService?: [EnterServiceGetType, ...EnterServiceGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  fixedPFAbsorb?: [FixedPFGetType, ...FixedPFGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  fixedPFInject?: [FixedPFGetType, ...FixedPFGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  fixedVar?: [FixedVarGetType, ...FixedVarGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  freqDroop?: [FreqDroopGetType, ...FreqDroopGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  gradient?: [GradientGetType, ...GradientGetType[]] | null;
  /**
   * @minItems 1
   * @maxItems 24
   */
  limitMaxDischarge?: [LimitMaxDischargeGetType, ...LimitMaxDischargeGetType[]] | null;
  /**
   * RequestId from GetDERControlRequest.
   *
   */
  requestId: number;
  /**
   * To Be Continued. Default value when omitted: false. +
   * False indicates that there are no further messages as part of this report.
   *
   */
  tbc?: boolean | null;
  customData?: CustomDataType | null;
}
export interface DERCurveGetType {
  curve: DERCurveType;
  /**
   * Id of DER curve
   *
   *
   */
  id: string;
  curveType: DERControlEnumType;
  /**
   * True if this is a default curve
   *
   *
   */
  isDefault: boolean;
  /**
   * True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
   *
   *
   */
  isSuperseded: boolean;
  customData?: CustomDataType | null;
}
export interface DERCurveType {
  /**
   * @minItems 1
   * @maxItems 10
   */
  curveData:
    | [DERCurvePointsType]
    | [DERCurvePointsType, DERCurvePointsType]
    | [DERCurvePointsType, DERCurvePointsType, DERCurvePointsType]
    | [DERCurvePointsType, DERCurvePointsType, DERCurvePointsType, DERCurvePointsType]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ]
    | [
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
        DERCurvePointsType,
      ];
  hysteresis?: HysteresisType | null;
  /**
   * Priority of curve (0=highest)
   *
   *
   *
   */
  priority: number;
  reactivePowerParams?: ReactivePowerParamsType | null;
  voltageParams?: VoltageParamsType | null;
  yUnit: DERUnitEnumType;
  /**
   * Open loop response time, the time to ramp up to 90% of the new target in response to the change in voltage, in seconds. A value of 0 is used to mean no limit. When not present, the device should follow its default behavior.
   *
   *
   *
   */
  responseTime?: number | null;
  /**
   * Point in time when this curve will become activated. Only absent when _default_ is true.
   *
   *
   */
  startTime?: string | null;
  /**
   * Duration in seconds that this curve will be active. Only absent when _default_ is true.
   *
   *
   *
   */
  duration?: number | null;
  customData?: CustomDataType | null;
}
export interface DERCurvePointsType {
  /**
   * The data value of the X-axis (independent) variable, depending on the curve type.
   *
   *
   *
   */
  x: number;
  /**
   * The data value of the Y-axis (dependent) variable, depending on the  &lt;&lt;cmn_derunitenumtype&gt;&gt; of the curve. If _y_ is power factor, then a positive value means DER is absorbing reactive power (under-excited), a negative value when DER is injecting reactive power (over-excited).
   *
   *
   */
  y: number;
  customData?: CustomDataType | null;
}
/**
 * This class does not get 'AdditionalProperties = false' in the schema generation, so it can be extended with arbitrary JSON properties to allow adding custom data.
 */
export interface CustomDataType {
  vendorId: string;
  [k: string]: unknown;
}
export interface HysteresisType {
  /**
   * High value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
   *
   *
   *
   */
  hysteresisHigh?: number | null;
  /**
   * Low value for return to normal operation after a grid event, in absolute value. This value adopts the same unit as defined by yUnit
   *
   *
   *
   */
  hysteresisLow?: number | null;
  /**
   * Delay in seconds, once grid parameter within HysteresisLow and HysteresisHigh, for the EV to return to normal operation after a grid event.
   *
   *
   *
   */
  hysteresisDelay?: number | null;
  /**
   * Set default rate of change (ramp rate %/s) for the EV to return to normal operation after a grid event
   *
   *
   *
   */
  hysteresisGradient?: number | null;
  customData?: CustomDataType | null;
}
export interface ReactivePowerParamsType {
  /**
   * Only for VoltVar curve: The nominal ac voltage (rms) adjustment to the voltage curve points for Volt-Var curves (percentage).
   *
   *
   *
   */
  vRef?: number | null;
  /**
   * Only for VoltVar: Enable/disable autonomous VRef adjustment
   *
   *
   *
   */
  autonomousVRefEnable?: boolean | null;
  /**
   * Only for VoltVar: Adjustment range for VRef time constant
   *
   *
   *
   */
  autonomousVRefTimeConstant?: number | null;
  customData?: CustomDataType | null;
}
export interface VoltageParamsType {
  /**
   * EN 50549-1 chapter 4.9.3.4
   *     Voltage threshold for the 10 min time window mean value monitoring.
   *     The 10 min mean is recalculated up to every 3 s.
   *     If the present voltage is above this threshold for more than the time defined by _hv10MinMeanValue_, the EV must trip.
   *     This value is mandatory if _hv10MinMeanTripDelay_ is set.
   *
   *
   *
   */
  hv10MinMeanValue?: number | null;
  /**
   * Time for which the voltage is allowed to stay above the 10 min mean value.
   *     After this time, the EV must trip.
   *     This value is mandatory if OverVoltageMeanValue10min is set.
   *
   *
   *
   */
  hv10MinMeanTripDelay?: number | null;
  powerDuringCessation?: PowerDuringCessationEnumType | null;
  customData?: CustomDataType | null;
}
export interface EnterServiceGetType {
  enterService: EnterServiceType;
  /**
   * Id of setting
   *
   *
   */
  id: string;
  customData?: CustomDataType | null;
}
export interface EnterServiceType {
  /**
   * Priority of setting (0=highest)
   *
   *
   */
  priority: number;
  /**
   * Enter service voltage high
   *
   */
  highVoltage: number;
  /**
   * Enter service voltage low
   *
   *
   *
   */
  lowVoltage: number;
  /**
   * Enter service frequency high
   *
   *
   */
  highFreq: number;
  /**
   * Enter service frequency low
   *
   *
   *
   */
  lowFreq: number;
  /**
   * Enter service delay
   *
   *
   *
   */
  delay?: number | null;
  /**
   * Enter service randomized delay
   *
   *
   *
   */
  randomDelay?: number | null;
  /**
   * Enter service ramp rate in seconds
   *
   *
   *
   */
  rampRate?: number | null;
  customData?: CustomDataType | null;
}
export interface FixedPFGetType {
  fixedPF: FixedPFType;
  /**
   * Id of setting.
   *
   */
  id: string;
  /**
   * True if setting is a default control.
   *
   */
  isDefault: boolean;
  /**
   * True if this setting is superseded by a lower priority setting.
   *
   */
  isSuperseded: boolean;
  customData?: CustomDataType | null;
}
export interface FixedPFType {
  /**
   * Priority of setting (0=highest)
   *
   */
  priority: number;
  /**
   * Power factor, cos(phi), as value between 0..1.
   *
   */
  displacement: number;
  /**
   * True when absorbing reactive power (under-excited), false when injecting reactive power (over-excited).
   *
   */
  excitation: boolean;
  /**
   * Time when this setting becomes active
   *
   */
  startTime?: string | null;
  /**
   * Duration in seconds that this setting is active.
   *
   */
  duration?: number | null;
  customData?: CustomDataType | null;
}
export interface FixedVarGetType {
  fixedVar: FixedVarType;
  /**
   * Id of setting
   *
   *
   */
  id: string;
  /**
   * True if setting is a default control.
   *
   */
  isDefault: boolean;
  /**
   * True if this setting is superseded by a lower priority setting
   *
   *
   */
  isSuperseded: boolean;
  customData?: CustomDataType | null;
}
export interface FixedVarType {
  /**
   * Priority of setting (0=highest)
   *
   */
  priority: number;
  /**
   * The value specifies a target var output interpreted as a signed percentage (-100 to 100).
   *     A negative value refers to charging, whereas a positive one refers to discharging.
   *     The value type is determined by the unit field.
   *
   */
  setpoint: number;
  unit: DERUnitEnumType;
  /**
   * Time when this setting becomes active.
   *
   */
  startTime?: string | null;
  /**
   * Duration in seconds that this setting is active.
   *
   */
  duration?: number | null;
  customData?: CustomDataType | null;
}
export interface FreqDroopGetType {
  freqDroop: FreqDroopType;
  /**
   * Id of setting
   *
   *
   */
  id: string;
  /**
   * True if setting is a default control.
   *
   */
  isDefault: boolean;
  /**
   * True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
   *
   *
   */
  isSuperseded: boolean;
  customData?: CustomDataType | null;
}
export interface FreqDroopType {
  /**
   * Priority of setting (0=highest)
   *
   *
   *
   */
  priority: number;
  /**
   * Over-frequency start of droop
   *
   *
   *
   */
  overFreq: number;
  /**
   * Under-frequency start of droop
   *
   *
   *
   */
  underFreq: number;
  /**
   * Over-frequency droop per unit, oFDroop
   *
   *
   *
   */
  overDroop: number;
  /**
   * Under-frequency droop per unit, uFDroop
   *
   *
   */
  underDroop: number;
  /**
   * Open loop response time in seconds
   *
   *
   */
  responseTime: number;
  /**
   * Time when this setting becomes active
   *
   *
   *
   */
  startTime?: string | null;
  /**
   * Duration in seconds that this setting is active
   *
   *
   *
   */
  duration?: number | null;
  customData?: CustomDataType | null;
}
export interface GradientGetType {
  gradient: GradientType;
  /**
   * Id of setting
   *
   *
   */
  id: string;
  customData?: CustomDataType | null;
}
export interface GradientType {
  /**
   * Id of setting
   *
   *
   *
   */
  priority: number;
  /**
   * Default ramp rate in seconds (0 if not applicable)
   *
   *
   *
   */
  gradient: number;
  /**
   * Soft-start ramp rate in seconds (0 if not applicable)
   *
   *
   *
   */
  softGradient: number;
  customData?: CustomDataType | null;
}
export interface LimitMaxDischargeGetType {
  /**
   * Id of setting
   *
   *
   */
  id: string;
  /**
   * True if setting is a default control.
   *
   */
  isDefault: boolean;
  /**
   * True if this setting is superseded by a higher priority setting (i.e. lower value of _priority_)
   *
   *
   */
  isSuperseded: boolean;
  limitMaxDischarge: LimitMaxDischargeType;
  customData?: CustomDataType | null;
}
export interface LimitMaxDischargeType {
  /**
   * Priority of setting (0=highest)
   *
   *
   *
   */
  priority: number;
  /**
   * Only for PowerMonitoring. +
   *     The value specifies a percentage (0 to 100) of the rated maximum discharge power of EV.
   *     The PowerMonitoring curve becomes active when power exceeds this percentage.
   *
   *
   *
   */
  pctMaxDischargePower?: number | null;
  powerMonitoringMustTrip?: DERCurveType | null;
  /**
   * Time when this setting becomes active
   *
   *
   *
   */
  startTime?: string | null;
  /**
   * Duration in seconds that this setting is active
   *
   *
   *
   */
  duration?: number | null;
  customData?: CustomDataType | null;
}
