package com.its.vms.xnettcp.vms.protocol.dto;

import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

@Data
public class VmsFormDataDto implements Serializable {
    private static final long serialVersionUID = 1L;

    private int formId;     // 폼 ID        2 Byte
    private int formCnt;    // 전체 폼 수   2 Byte

    private List<VmsFormDto> formList;

    public VmsFormDataDto(int formId, int formCnt) {
        this.formId = formId;
        this.formCnt = formCnt;
        this.formList = new ArrayList<>();
    }

    /**
     * 새로운 폼 정보를 추가
     * @param formNo
     * @param dispSec
     * @param dispType
     * @param bkClr
     * @return
     */
    public VmsFormDto addForm(int formNo, int dispSec, int dispType, int bkClr, int objCnt) {
        VmsFormDto form = new VmsFormDto(formNo, dispSec, dispType, bkClr, objCnt);
        this.formList.add(form);
        return form;
    }

    public void calFormCount() {
        this.formCnt = this.formList.size();
    }
}
