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

import java.util.HashMap;
import java.util.Map;

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


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

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


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

    public static Map<String, Integer> getTypeBySize(Integer widthStr, Integer heightStr) {
        Map<String, Integer> map = new HashMap<>();
        for (MaterialEnum material : MaterialEnum.values()) {
            Integer width = material.getWidth();
            Integer height = material.getHeight();
            if (widthStr.equals(width) && heightStr.equals(height)) {
                map.put("type", material.getType());
                map.put("isKaiPing", material.getIsKaiPing());

                return map;
            }
        }

        map.put("type", 1);
        map.put("isKaiPing", 1);
        return map;
    }

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

    public Integer getIsKaiPing() {
        return isKaiPing;
    }

    public void setIsKaiPing(Integer isKaiPing) {
        this.isKaiPing = isKaiPing;
    }

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