package cn.estsh.i3plus.pojo.model.dynamic.table;

import lombok.Data;

import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;

/**
 * @Description :
 * @Reference :
 * @Author : Adair Peng
 * @CreateDate : 2018-12-11 15:37
 * @Modify: 动态Table Row
 **/
@Data
public class DynTableRow implements Serializable {

    private static final long serialVersionUID = 2012638500620164166L;
    // 是否选中
    private boolean isChecked;

    // 行ID
    private String key;

    // 行号
    private Integer index = 0;

    // 行Size
    private Integer cellSize = 0;

    //时间
    private String createDatetime;

    // 行数据
    private Map<String, DynTableCell> cellMap = new HashMap<>();


    public DynTableRow putCell(DynTableCell cell) {
        this.cellMap.put(cell.getCellKey(), cell);
        return this;
    }

    public Integer getCellSize() {
        return cellMap != null ? cellMap.size() : 0;
    }

    /**
     * 禁止外部给 Size 赋值
     *
     * @param cellSize
     */
    private void setCellSize(Integer cellSize) {
    }

}
