package com.yiqi.system.domain.dto;

import lombok.Data;

import java.io.Serializable;

/**
 * @author douya
 * @description
 * @date 2024/10/30
 */
@Data
public class DataGroupHeader implements Serializable {

    private static final long serialVersionUID = 1L;

    private String key;

    private String slot;

    private String title;

    private String type;

    private String fixed;

    private Integer minWidth = 100;

    public static DataGroupHeader create(String key, String title, String type) {
        DataGroupHeader dataGroupHeader = new DataGroupHeader();
        dataGroupHeader.setKey(key);
        dataGroupHeader.setTitle(title);
        if(type.equals("upload")){
            dataGroupHeader.setType("img");
        }
        return dataGroupHeader;
    }

    public static DataGroupHeader createIdHeader() {
        DataGroupHeader dataGroupHeader = new DataGroupHeader();
        dataGroupHeader.setTitle("ID");
        dataGroupHeader.setKey("id");
        dataGroupHeader.setMinWidth(80);
        return dataGroupHeader;
    }

    public static DataGroupHeader createStatusHeader() {
        DataGroupHeader dataGroupHeader = new DataGroupHeader();
        dataGroupHeader.setSlot("status");
        dataGroupHeader.setTitle("是否可用");
        dataGroupHeader.setMinWidth(80);
        return dataGroupHeader;
    }

    public static DataGroupHeader createActionHeader() {
        DataGroupHeader dataGroupHeader = new DataGroupHeader();
        dataGroupHeader.setSlot("action");
        dataGroupHeader.setTitle("操作");
        dataGroupHeader.setMinWidth(120);
        dataGroupHeader.setFixed("right");
        return dataGroupHeader;
    }

    public static DataGroupHeader createSortHeader() {
        DataGroupHeader dataGroupHeader = new DataGroupHeader();
        dataGroupHeader.setKey("sort");
        dataGroupHeader.setTitle("排序");
        dataGroupHeader.setMinWidth(80);
        return dataGroupHeader;
    }
}
