package io.openems.edge.goodwe.stsbox;

import org.osgi.service.metatype.annotations.AttributeDefinition;
import org.osgi.service.metatype.annotations.ObjectClassDefinition;

import io.openems.edge.goodwe.GoodWeConstants;
import io.openems.edge.goodwe.common.enums.EnableDisable;
import io.openems.edge.goodwe.common.enums.MultiplexingMode;

@ObjectClassDefinition(//
		name = "GoodWe STS Box", //
		description = "GoodWe STS Box")

@interface Config {
	@AttributeDefinition(name = "Component-ID", description = "Unique ID of this Component")
	String id() default "sts0";

	@AttributeDefinition(name = "Alias", description = "Human-readable name of this Component; defaults to Component-ID")
	String alias() default "";

	@AttributeDefinition(name = "Is enabled?", description = "Is this Component enabled?")
	boolean enabled() default true;

	@AttributeDefinition(name = "Modbus-ID", description = "ID of Modbus bridge.")
	String modbus_id() default "modbus1";

	@AttributeDefinition(name = "Modbus Unit-ID", description = "The Unit-ID of the Modbus device.")
	int modbusUnitId() default GoodWeConstants.DEFAULT_UNIT_ID;

	@AttributeDefinition(name = "Genset Id", description = "ID of the Genset")
	String genset_id();

	@AttributeDefinition(name = "Port Multiplexing Mode", description = "The mode of the multiplexing port")
	MultiplexingMode portMultiplexingMode() default MultiplexingMode.GENSET;

	@AttributeDefinition(name = "Genset Rated Power", description = "Nominal genset power in watt. Allowed range: 0–50000 W.")
	int ratedPower() default 0;

	@AttributeDefinition(name = "Lead Time", description = "Genset lead time in seconds. Allowed range: 10–300 s.")
	int preheatingTime() default 10;

	@AttributeDefinition(name = "Runtime", description = "Maximum genset runtime in minutes. Allowed range: 0–1440 minutes (24 hours).")
	int runtime() default 0;

	@AttributeDefinition(name = "Enable Charging from Genset", description = "Controls whether charging from the Genset is enabled.")
	EnableDisable enableCharge() default EnableDisable.ENABLE;

	@AttributeDefinition(name = "Charge Start SoC", description = "State of Charge percentage at which Genset charging starts. Allowed range: 10–90%.")
	int chargeSocStart() default 10;

	@AttributeDefinition(name = "Charge End SoC", description = "State of Charge percentage at which Genset charging stops. Allowed range: 40–95%.")
	int chargeSocEnd() default 95;

	@AttributeDefinition(name = "Maximum Charging Power", description = "Maximum charging power expressed as a percentage of the Gensets rated power. Allowed range: 0–100%.")
	int maxPowerPercent() default 100;

	@AttributeDefinition(name = "Voltage Upper Limit", description = "The voltage upper limit in Volt")
	int voltageUpperLimit() default 280;

	@AttributeDefinition(name = "Voltage Lower Limit", description = "The voltage lower limit in Volt")
	int voltageLowerLimit() default 80;

	@AttributeDefinition(name = "Frequency Upper Limit", description = "The frequency upper limit in Hertz")
	int frequencyUpperLimit() default 65;

	@AttributeDefinition(name = "Frequency Lower Limit", description = "The frequency lower limit in Hertz")
	int frequencyLowerLimit() default 45;

	@AttributeDefinition(name = "Modbus target filter", description = "This is auto-generated by 'Modbus-ID'.")
	String Modbus_target() default "(enabled=true)";

	String webconsole_configurationFactory_nameHint() default "GoodWe STS Box [{id}]";
}