package com.gyee.wisdom.dao.sql.power.entity;

import com.gyee.wisdom.common.data.ToData;
import com.gyee.wisdom.common.data.power.WindturbinePowerCurvefitting;
import com.gyee.wisdom.dao.sql.ModelConstants;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;

@Data
@NoArgsConstructor
@ToString
@EqualsAndHashCode()
@Entity
@Table(name = "windturbinepowercurvefitting")
public class WindturbinePowerCurvefittingEntity implements ToData<WindturbinePowerCurvefitting> {

    @Id
    @Column(name = ModelConstants.ID_)
    private String id;

    @Column(name = "windturbineid")
    private String windturbineId;
    @Column(name = "speed")
    private double speed;
    @Column(name = "actualpower")
    private double actualPower;
    @Column(name = "optimalpower")
    private double optimalPower;

    public WindturbinePowerCurvefittingEntity(WindturbinePowerCurvefitting wpc) {
        this.id = wpc.getId();
        this.windturbineId = wpc.getWindturbineId();
        this.speed = wpc.getSpeed();
        this.actualPower = wpc.getActualPower();
        this.optimalPower = wpc.getOptimalPower();
    }

    public WindturbinePowerCurvefitting toData() {
        WindturbinePowerCurvefitting wpc = new WindturbinePowerCurvefitting();
        wpc.setId(this.id);
        wpc.setWindturbineId(this.windturbineId);
        wpc.setSpeed(this.speed);
        wpc.setActualPower(this.actualPower);
        wpc.setOptimalPower(this.optimalPower);

        return wpc;

    }
}
