from warnings import warn

from UniTAP.dev.modules.dut_tests.dut_default_params.dp_2_1_common_video_modes import VideoModeInfo


class Dp21AvailableVideoModes:
    """
    Class `Dp21AvailableVideoModes` allows working with video modes.
    - Set and get...
    """
    def __init__(self, json_obj):
        self.__768x480_85hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_768_480_85"])
        self.__1024x640_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1024_640_60"])
        self.__1152x720_75hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1152_720_75"])
        self.__1280x720_24hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1280_720_24"])
        self.__1280x720_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1280_720_120"])
        self.__1280x768_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1280_768_60"])
        self.__1280x960_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1280_960_60"])
        self.__1440x240_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1440_240_60"])
        self.__1440x480_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1440_480_60"])
        self.__1440x900_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1440_900_60"])
        self.__1536x960_85hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1536_960_85"])
        self.__1920x1080_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_30"])
        self.__1920x1080_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_60"])
        self.__1920x1080_85hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_85"])
        self.__1920x1080_100hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_100"])
        self.__1920x1080_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_120"])
        self.__1920x1080_144hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_144"])
        self.__1920x1080_240hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1080_240"])
        self.__1920x1440_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_1920_1440_60"])
        self.__2048x1280_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2048_1280_60"])
        self.__2048x1536_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2048_1536_60"])
        self.__2128x1200_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2128_1200_60"])
        self.__2456x1536_50hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2456_1536_50"])
        self.__2456x1536_75hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2456_1536_75"])
        self.__2560x1080_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2560_1080_30"])
        self.__2560x1080_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2560_1080_60"])
        self.__2560x1080_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2560_1080_120"])
        self.__2560x1600_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2560_1600_60"])
        self.__2560x1920_75hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2560_1920_75"])
        self.__2728x1536_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_2728_1536_60"])
        self.__3840x2160_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2160_30"])
        self.__3840x2160_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2160_60"])
        self.__3840x2160_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2160_120"])
        self.__3840x2160_144hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2160_144"])
        self.__3840x2160_240hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2160_240"])
        self.__3840x2400_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_3840_2400_60"])
        self.__4096x2160_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_4096_2160_30"])
        self.__5120x2160_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2160_30"])
        self.__5120x2160_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2160_60"])
        self.__5120x2160_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2160_120"])
        self.__5120x2160_144hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2160_144"])
        self.__5120x2160_240hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2160_240"])
        self.__5120x2880_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2880_30"])
        self.__5120x2880_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2880_60"])
        self.__5120x2880_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_5120_2880_120"])
        self.__7680x4320_24hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_7680_4320_24"])
        self.__7680x4320_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_7680_4320_30"])
        self.__7680x4320_50hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_7680_4320_50"])
        self.__7680x4320_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_7680_4320_60"])
        self.__7680x4320_120hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_7680_4320_120"])
        self.__10240x4320_24hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_10240_4320_24"])
        self.__10240x4320_30hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_10240_4320_30"])
        self.__10240x4320_60hz = VideoModeInfo(json_obj["TSI_DP20_SRCCTS_VMT_10240_4320_60"])

    @property
    def vm_768x480_85hz(self) -> VideoModeInfo:
        return self.__768x480_85hz

    @property
    def vm_1024x640_60hz(self) -> VideoModeInfo:
        return self.__1024x640_60hz

    @property
    def vm_1152x720_75hz(self) -> VideoModeInfo:
        return self.__1152x720_75hz

    @property
    def vm_1280x720_24hz(self) -> VideoModeInfo:
        return self.__1280x720_24hz

    @property
    def vm_1280x720_120hz(self) -> VideoModeInfo:
        return self.__1280x720_120hz

    @property
    def vm_1280x768_60hz(self) -> VideoModeInfo:
        return self.__1280x768_60hz

    @property
    def vm_1280x960_60hz(self) -> VideoModeInfo:
        return self.__1280x960_60hz

    @property
    def vm_1440x240_60hz(self) -> VideoModeInfo:
        return self.__1440x240_60hz

    @property
    def vm_1440x480_60hz(self) -> VideoModeInfo:
        return self.__1440x480_60hz

    @property
    def vm_1440x900_60hz(self) -> VideoModeInfo:
        return self.__1440x900_60hz

    @property
    def vm_1536x960_85hz(self) -> VideoModeInfo:
        return self.__1536x960_85hz

    @property
    def vm_1920x1080_30hz(self) -> VideoModeInfo:
        return self.__1920x1080_30hz

    @property
    def vm_1920x1080_60hz(self) -> VideoModeInfo:
        return self.__1920x1080_60hz

    @property
    def vm_1920x1080_85hz(self) -> VideoModeInfo:
        return self.__1920x1080_85hz

    @property
    def vm_1920x1080_100hz(self) -> VideoModeInfo:
        return self.__1920x1080_100hz

    @property
    def vm_1920x1080_120hz(self) -> VideoModeInfo:
        return self.__1920x1080_120hz

    @property
    def vm_1920x1080_144hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__1920x1080_144hz

    @property
    def vm_1920x1080_240hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__1920x1080_240hz

    @property
    def vm_1920x1440_60hz(self) -> VideoModeInfo:
        return self.__1920x1440_60hz

    @property
    def vm_2048x1280_60hz(self) -> VideoModeInfo:
        return self.__2048x1280_60hz

    @property
    def vm_2048x1536_60hz(self) -> VideoModeInfo:
        return self.__2048x1536_60hz

    @property
    def vm_2128x1200_60hz(self) -> VideoModeInfo:
        return self.__2128x1200_60hz

    @property
    def vm_2456x1536_50hz(self) -> VideoModeInfo:
        return self.__2456x1536_50hz

    @property
    def vm_2456x1536_75hz(self) -> VideoModeInfo:
        return self.__2456x1536_75hz

    @property
    def vm_2560x1080_30hz(self) -> VideoModeInfo:
        return self.__2560x1080_30hz

    @property
    def vm_2560x1080_60hz(self) -> VideoModeInfo:
        return self.__2560x1080_60hz

    @property
    def vm_2560x1080_120hz(self) -> VideoModeInfo:
        return self.__2560x1080_120hz

    @property
    def vm_2560x1600_60hz(self) -> VideoModeInfo:
        return self.__2560x1600_60hz

    @property
    def vm_2560x1920_75hz(self) -> VideoModeInfo:
        return self.__2560x1920_75hz

    @property
    def vm_2728x1536_60hz(self) -> VideoModeInfo:
        return self.__2728x1536_60hz

    @property
    def vm_3840x2160_30hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__3840x2160_30hz

    @property
    def vm_3840x2160_60hz(self) -> VideoModeInfo:
        return self.__3840x2160_60hz

    @property
    def vm_3840x2160_120hz(self) -> VideoModeInfo:
        return self.__3840x2160_120hz

    @property
    def vm_3840x2160_144hz(self) -> VideoModeInfo:
        return self.__3840x2160_144hz

    @property
    def vm_3840x2160_240hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__3840x2160_240hz

    @property
    def vm_3840x2400_60hz(self) -> VideoModeInfo:
        return self.__3840x2400_60hz

    @property
    def vm_4096x2160_30hz(self) -> VideoModeInfo:
        return self.__4096x2160_30hz

    @property
    def vm_5120x2160_30hz(self) -> VideoModeInfo:
        return self.__5120x2160_30hz

    @property
    def vm_5120x2160_60hz(self) -> VideoModeInfo:
        return self.__5120x2160_60hz

    @property
    def vm_5120x2160_120hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__5120x2160_120hz

    @property
    def vm_5120x2160_144hz(self) -> VideoModeInfo:
        return self.__5120x2160_144hz

    @property
    def vm_5120x2160_240hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__5120x2160_240hz

    @property
    def vm_5120x2880_30hz(self) -> VideoModeInfo:
        return self.__5120x2880_30hz

    @property
    def vm_5120x2880_60hz(self) -> VideoModeInfo:
        return self.__5120x2880_60hz

    @property
    def vm_5120x2880_120hz(self) -> VideoModeInfo:
        return self.__5120x2880_120hz

    @property
    def vm_7680x4320_24hz(self) -> VideoModeInfo:
        return self.__7680x4320_24hz

    @property
    def vm_7680x4320_30hz(self) -> VideoModeInfo:
        return self.__7680x4320_30hz

    @property
    def vm_7680x4320_50hz(self) -> VideoModeInfo:
        return self.__7680x4320_50hz

    @property
    def vm_7680x4320_60hz(self) -> VideoModeInfo:
        return self.__7680x4320_60hz

    @property
    def vm_7680x4320_120hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__7680x4320_120hz

    @property
    def vm_10240x4320_24hz(self) -> VideoModeInfo:
        return self.__10240x4320_24hz

    @property
    def vm_10240x4320_30hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__10240x4320_30hz

    @property
    def vm_10240x4320_60hz(self) -> VideoModeInfo:
        warn("This video mode is DSC only, please configure this video mode using dsc_video_modes.", DeprecationWarning,
             2)
        return self.__10240x4320_60hz

    def select_all_standards(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.set_all()

    def select_all_cta_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.cta = True

    def select_all_dmt_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.dmt = True

    def select_all_cvt_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.cvt = True

    def select_all_cvt_rb1_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.cvt_rb1 = True

    def select_all_cvt_rb2_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.cvt_rb2 = True

    def select_all_ovt_standard(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).standard.ovt = True

    def select_all_colorimetries(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.set_all(bpc)

    def select_all_rgb_colorimetry(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.rgb = bpc

    def select_all_ycbcr444_colorimetry(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.ycbcr444 = bpc

    def select_all_ycbcr422_colorimetry(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.ycbcr422 = bpc

    def select_all_ycbcr_simple422_colorimetry(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.ycbcr_simple422 = bpc

    def select_all_ycbcr420_colorimetry(self, bpc: int = 8):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.ycbcr420 = bpc

    def clear_all(self):
        var_list = self.__dict__
        for item in var_list:
            self.__getattribute__(item).colorimetry.clear_all()
            self.__getattribute__(item).standard.clear_all()
