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),
    HorizontalVideoSmall(2, 1280, 720),
    HorizontalVideoBig(2, 1920, 1080);

    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 0;
    }


    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 +
                '}';
    }
}
