# LateralContributionTypes.py -- Pamhyr
# Copyright (C) 2023-2025  INRAE
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <https://www.gnu.org/licenses/>.

# -*- coding: utf-8 -*-

from Model.Except import NotImplementedMethodeError

from Model.WeatherParameters.WeatherParameters import WeatherParameters


class NotDefined(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(NotDefined, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "ND"
        self._header = ["x", "y"]

    @property
    def _default_0(self):
        return 0.0


class WeatherParam(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(WeatherParam, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "WP"
        self._header = ["time", "value"]
        self._types = [WeatherParam.time_convert, float]

    @classmethod
    def compatibility(cls):
        return ["liquid"]


class AirTemperature(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(AirTemperature, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "AT"
        self._header = ["time", "temperature"]
        self._types = [AirTemperature.time_convert, float]


class SpecificHumidity(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(SpecificHumidity, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "SH"
        self._header = ["time", "humidity"]
        self._types = [SpecificHumidity.time_convert, float]


class GlobalRadiation(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(GlobalRadiation, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "GR"
        self._header = ["time", "radiation"]
        self._types = [GlobalRadiation.time_convert, float]


class ReferenceWindSpeed(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(ReferenceWindSpeed, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "RWS"
        self._header = ["time", "wind speed"]
        self._types = [ReferenceWindSpeed.time_convert, float]


class GroundwaterTemperature(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(GroundwaterTemperature, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "GT"
        self._header = ["time", "temperature"]
        self._types = [GroundwaterTemperature.time_convert, float]


class GroundwaterFlowRate(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(GroundwaterFlowRate, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "GFR"
        self._header = ["time", "discharge"]
        self._types = [GroundwaterFlowRate.time_convert, float]


class Albedo(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(Albedo, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "ALB"
        self._header = ["time", "albedo"]
        self._types = [Albedo.time_convert, float]


class ShadingCoefficient(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(ShadingCoefficient, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "SC"
        self._header = ["time", "shading coefficient"]
        self._types = [ShadingCoefficient.time_convert, float]


class CloudCoverFraction(WeatherParameters):
    def __init__(self, id: int = -1, name: str = "",
                 status=None, owner_scenario=-1):
        super(CloudCoverFraction, self).__init__(
            id=id, name=name, status=status,
            owner_scenario=owner_scenario
        )

        self._type = "CCF"
        self._header = ["time", "cloud cover fraction"]
        self._types = [CloudCoverFraction.time_convert, float]
