package cn.com.ctop.common.module.enums;

/**
 * 素材类型
 */
public enum MaterialEnum {


    VerticalVideoSmall(1, 720, 1280),
    VerticalVideo787Small(1, 787, 1280),
    VerticalVideo846Small(1, 846, 1536),
    VerticalVideo1080mall(1, 1080, 2200),
    VerticalVideoBig(1, 1080, 1920),
    VerticalVideo360(1, 360, 640),
    VerticalVideo362(1, 362, 640),
    VerticalVideo368(1, 368, 490),
    VerticalVideo363(1, 363, 640),
    VerticalVideo438(1, 438, 640),
    VerticalVideo480(1, 480, 640),
    VerticalVideo525(1, 525, 640),
    VerticalVideo540(1, 540, 960),
    VerticalVideo544(1, 544, 726),
    VerticalVideo590(1, 590, 1280),
    VerticalVideo694(1, 694, 1236),
    VerticalVideo704(1, 704, 1252),
    VerticalVideo710(1, 710, 1264),
    VerticalVideo714(1, 714, 1270),
    VerticalVideo716(1, 716, 1276),
    VerticalVideo718(1, 718, 1278),
    VerticalVideo719(1, 719, 1170),
    VerticalVideo720(1, 720, 960),
    VerticalVideo750(1, 750, 1334),
    VerticalVideo787(1, 787, 1280),
    VerticalVideo864(1, 864, 1536),
    VerticalVideo1088(1, 1088, 1920),
    VerticalVideo1181(1, 1181, 1920),
    VerticalVideo1216(1, 1216, 2160),
    VerticalVideo1296(1, 1296, 2304),
    VerticalVideo1440(1, 1440, 2560),
    VerticalVideo2160(1, 2160, 3840),
    HorizontalVideoSmall(2, 1280, 720),
    HorizontalVideoBig(2, 1920, 1080),
    HorizontalVideo640(2, 640, 368),
    HorizontalVideo1281(2, 1281, 720),
    HorizontalVideo1400(2, 1400, 720),
    HorizontalVideo1700(2, 1700, 1080),
    HorizontalVideo1902(2, 1902, 1080),
    HorizontalVideo1920(2, 1920, 1080),
    BianlitieImageBig(4, 540, 540),
    BianLitieImageSmall(4, 450, 450);

    private Integer type;
    private Integer width;
    private Integer height;


    private MaterialEnum(Integer type, Integer width, Integer height) {
        this.type = type;
        this.width = width;
        this.height = height;
    }

    public static Integer getTypeBySize(Integer widthStr, Integer heightStr) {
        for (MaterialEnum material : MaterialEnum.values()) {
            Integer width = material.getWidth();
            Integer height = material.getHeight();
            if (widthStr.equals(width) && heightStr.equals(height)) {
                return material.getType();
            }
        }

        return 1;
    }


    public Integer getType() {
        return type;
    }

    public void setType(Integer type) {
        this.type = type;
    }

    public Integer getWidth() {
        return width;
    }

    public void setWidth(Integer width) {
        this.width = width;
    }

    public Integer getHeight() {
        return height;
    }

    public void setHeight(Integer height) {
        this.height = height;
    }

    @Override
    public String toString() {
        return "MaterialEnum{" +
                "type=" + type +
                ", width=" + width +
                ", height=" + height +
                '}';
    }
}
