from UniTAP.common import VideoMode, ColorInfo, Timing


def get_vm_color_format(color_mode: int) -> ColorInfo.ColorFormat:

    if color_mode == 0:
        return ColorInfo.ColorFormat.CF_NONE
    elif color_mode == 1:
        return ColorInfo.ColorFormat.CF_UNKNOWN
    elif color_mode == 2:
        return ColorInfo.ColorFormat.CF_RGB
    elif color_mode == 3:
        return ColorInfo.ColorFormat.CF_YCbCr_422
    elif color_mode == 4:
        return ColorInfo.ColorFormat.CF_YCbCr_444
    elif color_mode == 5:
        return ColorInfo.ColorFormat.CF_YCbCr_420
    else:
        return ColorInfo.ColorFormat.CF_IDO_DEFINED


def get_vm_colorimetry(colorimetry: int) -> ColorInfo.Colorimetry:

    if colorimetry == 0:
        return ColorInfo.Colorimetry.CM_RESERVED
    elif colorimetry == 1:
        return ColorInfo.Colorimetry.CM_NONE
    elif colorimetry == 2:
        return ColorInfo.Colorimetry.CM_sRGB
    elif colorimetry == 3:
        return ColorInfo.Colorimetry.CM_SMPTE_170M
    elif colorimetry == 4:
        return ColorInfo.Colorimetry.CM_ITUR_BT601
    elif colorimetry == 5:
        return ColorInfo.Colorimetry.CM_ITUR_BT709
    elif colorimetry == 6:
        return ColorInfo.Colorimetry.CM_xvYCC601
    elif colorimetry == 7:
        return ColorInfo.Colorimetry.CM_xvYCC709
    elif colorimetry == 8:
        return ColorInfo.Colorimetry.CM_sYCC601
    elif colorimetry == 9:
        return ColorInfo.Colorimetry.CM_AdobeYCC601
    elif colorimetry == 10:
        return ColorInfo.Colorimetry.CM_AdobeRGB
    elif colorimetry == 11:
        return ColorInfo.Colorimetry.CM_ITUR_BT2020_YcCbcCrc
    elif colorimetry == 12:
        return ColorInfo.Colorimetry.CM_ITUR_BT2020_YCbCr
    elif colorimetry == 13:
        return ColorInfo.Colorimetry.CM_ITUR_BT2020_RGB
    else:
        return ColorInfo.Colorimetry.CM_RESERVED
