class Constant:
    MONTHS_LEN = [31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]
    MAX_STEP_HOURS = 24 * 30


class DataManager:
    def __init__(self) -> None:
        self.Pv = []
        self.Prices = []
        self.Load_Consumption = []
        self.Temperature = []
        self.Irradiance = []
        self.Wind = []

    def add_pv_element(self, element): self.Pv.append(element)

    def add_price_element(self, element): self.Prices.append(element)

    def add_load_element(self, element): self.Load_Consumption.append(element)

    def add_temperature_element(self, element): self.Temperature.append(element)

    def add_irradiance_element(self, element): self.Irradiance.append(element)

    def add_wind_element(self, element): self.Wind.append(element)

    # get current time data based on given month day, and day_time
    def get_pv_data(self, month, day, day_time):
        return self.Pv[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    def get_price_data(self, month, day, day_time):
        return self.Prices[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    def get_load_cons_data(self, month, day, day_time):
        return self.Load_Consumption[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    def get_temperature_data(self, month, day, day_time):
        return self.Temperature[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    def get_irradiance_data(self, month, day, day_time):
        return self.Irradiance[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    def get_wind_data(self, month, day, day_time):
        return self.Wind[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + day_time]

    # get series data for one episode
    def get_series_pv_data(self, month, day):
        return self.Pv[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                       (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]

    def get_series_price_data(self, month, day):
        return self.Prices[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                           (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]

    def get_series_load_cons_data(self, month, day):
        return self.Load_Consumption[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                                     (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]

    def get_series_temperature_data(self, month, day):
        return self.Temperature[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                                (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]

    def get_series_irradiance_data(self, month, day):
        return self.Irradiance[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                               (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]

    def get_series_wind_data(self, month, day):
        return self.Wind[(sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24:
                         (sum(Constant.MONTHS_LEN[:month - 1]) + day - 1) * 24 + 24]
