package com.xxl.job.executor.constant;

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


    VerticalVideoSmall(559368L, 720, 1280),
    VerticalVideoBig(560827L, 1080, 1920),
    HorizontalVideoSmall(560828L, 1280, 720),
    HorizontalVideoBig(560829L, 1920, 1080);


    private Long templateId;
    private Integer width;
    private Integer height;


    private MaterialSupplierEnum(Long templateId, Integer width, Integer height) {
        this.templateId = templateId;
        this.width = width;
        this.height = height;
    }

    public static Long getTemplateIdBySize(Integer widthStr, Integer heightStr) {
        for (MaterialSupplierEnum material : MaterialSupplierEnum.values()) {
            Integer width = material.getWidth();
            Integer height = material.getHeight();
            if (widthStr.equals(width)  && heightStr.equals(height)) {
                return material.getTemplateId();
            }
        }

        return 0L;
    }


    public Long getTemplateId() {
        return templateId;
    }

    public void setTemplateId(Long templateId) {
        this.templateId = templateId;
    }

    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 "MaterialSupplierEnum{" +
                "templateId=" + templateId +
                ", width=" + width +
                ", height=" + height +
                '}';
    }
}
