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

import com.its.app.utils.SysUtils;
import com.its.vms.xnettcp.vms.protocol.enums.eVmsFormObjectKind;
import lombok.Getter;
import lombok.Setter;

/**
 * TEXT Object
 */
@Getter
@Setter
public class VmsFormObjText extends VmsFormObj {

    private int clrR;       // 1
    private int clrG;       // 1
    private int clrB;       // 1
    private int fontSize;   // 1
    private int fontKind;   // 1
    private int fontBold;   // 1
    private int reserved;   // 1
    private String text;    // n

    public VmsFormObjText(int objSize, int blinking, int posX, int posY, int bkClr, int clrR, int clrG, int clrB, int fontSize, int fontKind, int fontBold, String text) {
        super(eVmsFormObjectKind.OBJECT_TEXT.getValue(), objSize, blinking, posX, posY, bkClr);

        this.clrR = clrR;
        this.clrG = clrG;
        this.clrB = clrB;
        this.fontSize = fontSize;
        this.fontKind = fontKind;
        this.fontBold = fontBold;
        this.reserved = 0;
        this.text = text;
    }

    @Override
    public void calSize() {
        byte[] textArr = SysUtils.stringToByteArr(this.text);
        setSize(7 + textArr.length);
    }
}
