package com.its.op.dto.its.scrs;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.its.op.entity.its.scrs.TbScSgnlIxrStts;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.validation.constraints.PositiveOrZero;
import java.io.Serializable;

/**
 * 신호 교차로 상태 DTO Class
 */
@Data
@Builder
@ApiModel("TbScSgnlIxrSttsDto(신호 교차로 상태)")
public class TbScSgnlIxrSttsDto implements Serializable {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("신호 교차로 번호")  // N NUMBER(4)
    @JsonProperty("sgnl_ixr_nmbr")
    private Integer sgnlIxrNmbr;

    @ApiModelProperty("LC 카운트")  // Y NUMBER(3)
    @JsonProperty("lc_cnt")
    private Integer lcCnt;

    @ApiModelProperty("제어모드(0: TRC, 1: TOD, 2: MAN)")  // Y NUMBER(1)
    @JsonProperty("cntl_mode")
    private Integer cntlMode;

    @ApiModelProperty("제어상태(0: 온라인, 1: 오프라인, 2: 트랜스, 3: 통신장애)")  // Y NUMBER(1)
    @JsonProperty("cntl_stts")
    private Integer cntlStts;

    @ApiModelProperty("특수제어(0: 없음, 1: 점멸, 2: 소등, 3: 수동, 4: 감응)")  // Y NUMBER(2)
    @JsonProperty("spcl_cntl")
    private Integer spclCntl;

    @ApiModelProperty("주기")  // Y NUMBER(3)
    @JsonProperty("cycl")
    private Integer cycl;

    @ApiModelProperty("옵셋")  // Y NUMBER(3)
    @JsonProperty("ofst")
    private Integer ofst;

    @ApiModelProperty("A링 1현시")  // Y NUMBER(3)
    @JsonProperty("aring_1phas")
    private Integer aring1phas;

    @ApiModelProperty("A링 2현시")  // Y NUMBER(3)
    @JsonProperty("aring_2phas")
    private Integer aring2phas;

    @ApiModelProperty("A링 3현시")  // Y NUMBER(3)
    @JsonProperty("aring_3phas")
    private Integer aring3phas;

    @ApiModelProperty("A링 4현시")  // Y NUMBER(3)
    @JsonProperty("aring_4phas")
    private Integer aring4phas;

    @ApiModelProperty("A링 5현시")  // Y NUMBER(3)
    @JsonProperty("aring_5phas")
    private Integer aring5phas;

    @ApiModelProperty("A링 6현시")  // Y NUMBER(3)
    @JsonProperty("aring_6phas")
    private Integer aring6phas;

    @ApiModelProperty("A링 7현시")  // Y NUMBER(3)
    @JsonProperty("aring_7phas")
    private Integer aring7phas;

    @ApiModelProperty("A링 8현시")  // Y NUMBER(3)
    @JsonProperty("aring_8phas")
    private Integer aring8phas;

    @ApiModelProperty("B링 1현시")  // Y NUMBER(3)
    @JsonProperty("bring_1phas")
    private Integer bring1phas;

    @ApiModelProperty("B링 2현시")  // Y NUMBER(3)
    @JsonProperty("bring_2phas")
    private Integer bring2phas;

    @ApiModelProperty("B링 3현시")  // Y NUMBER(3)
    @JsonProperty("bring_3phas")
    private Integer bring3phas;

    @ApiModelProperty("B링 4현시")  // Y NUMBER(3)
    @JsonProperty("bring_4phas")
    private Integer bring4phas;

    @ApiModelProperty("B링 5현시")  // Y NUMBER(3)
    @JsonProperty("bring_5phas")
    private Integer bring5phas;

    @ApiModelProperty("B링 6현시")  // Y NUMBER(3)
    @JsonProperty("bring_6phas")
    private Integer bring6phas;

    @ApiModelProperty("B링 7현시")  // Y NUMBER(3)
    @JsonProperty("bring_7phas")
    private Integer bring7phas;

    @ApiModelProperty("B링 8현시")  // Y NUMBER(3)
    @JsonProperty("bring_8phas")
    private Integer bring8phas;

    @ApiModelProperty("현재 A링 현시")  // Y NUMBER(1)
    @JsonProperty("prst_aring_phas")
    private Integer prstAringPhas;

    @ApiModelProperty("현재 B링 현시")  // Y NUMBER(1)
    @JsonProperty("prst_bring_phas")
    private Integer prstBringPhas;

    @ApiModelProperty("함체 상태")  // Y NUMBER(1)
    @JsonProperty("cbox_stts")
    private Integer cboxStts;

    // Code Description Field
    @ApiModel("TbScSgnlIxrSttsUpdReq(신호 교차로 상태 정보변경)")
    @Getter
    @Setter
    @ToString
    @NoArgsConstructor//(access = AccessLevel.PROTECTED)
    public static class TbScSgnlIxrSttsUpdReq {

        @ApiModelProperty("신호 교차로 번호, Nullable = N, NUMBER(4)")  // N NUMBER(4)
        @JsonProperty("sgnl_ixr_nmbr")
        @PositiveOrZero
        private Integer sgnlIxrNmbr;

        @ApiModelProperty("LC 카운트, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("lc_cnt")
        @PositiveOrZero
        private Integer lcCnt;

        @ApiModelProperty("제어모드(0: TRC, 1: TOD, 2: MAN), Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("cntl_mode")
        @PositiveOrZero
        private Integer cntlMode;

        @ApiModelProperty("제어상태(0: 온라인, 1: 오프라인, 2: 트랜스, 3: 통신장애), Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("cntl_stts")
        @PositiveOrZero
        private Integer cntlStts;

        @ApiModelProperty("특수제어(0: 없음, 1: 점멸, 2: 소등, 3: 수동, 4: 감응), Nullable = Y, NUMBER(2)")  // Y NUMBER(2)
        @JsonProperty("spcl_cntl")
        @PositiveOrZero
        private Integer spclCntl;

        @ApiModelProperty("주기, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("cycl")
        @PositiveOrZero
        private Integer cycl;

        @ApiModelProperty("옵셋, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("ofst")
        @PositiveOrZero
        private Integer ofst;

        @ApiModelProperty("A링 1현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_1phas")
        @PositiveOrZero
        private Integer aring1phas;

        @ApiModelProperty("A링 2현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_2phas")
        @PositiveOrZero
        private Integer aring2phas;

        @ApiModelProperty("A링 3현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_3phas")
        @PositiveOrZero
        private Integer aring3phas;

        @ApiModelProperty("A링 4현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_4phas")
        @PositiveOrZero
        private Integer aring4phas;

        @ApiModelProperty("A링 5현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_5phas")
        @PositiveOrZero
        private Integer aring5phas;

        @ApiModelProperty("A링 6현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_6phas")
        @PositiveOrZero
        private Integer aring6phas;

        @ApiModelProperty("A링 7현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_7phas")
        @PositiveOrZero
        private Integer aring7phas;

        @ApiModelProperty("A링 8현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("aring_8phas")
        @PositiveOrZero
        private Integer aring8phas;

        @ApiModelProperty("B링 1현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_1phas")
        @PositiveOrZero
        private Integer bring1phas;

        @ApiModelProperty("B링 2현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_2phas")
        @PositiveOrZero
        private Integer bring2phas;

        @ApiModelProperty("B링 3현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_3phas")
        @PositiveOrZero
        private Integer bring3phas;

        @ApiModelProperty("B링 4현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_4phas")
        @PositiveOrZero
        private Integer bring4phas;

        @ApiModelProperty("B링 5현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_5phas")
        @PositiveOrZero
        private Integer bring5phas;

        @ApiModelProperty("B링 6현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_6phas")
        @PositiveOrZero
        private Integer bring6phas;

        @ApiModelProperty("B링 7현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_7phas")
        @PositiveOrZero
        private Integer bring7phas;

        @ApiModelProperty("B링 8현시, Nullable = Y, NUMBER(3)")  // Y NUMBER(3)
        @JsonProperty("bring_8phas")
        @PositiveOrZero
        private Integer bring8phas;

        @ApiModelProperty("현재 A링 현시, Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("prst_aring_phas")
        @PositiveOrZero
        private Integer prstAringPhas;

        @ApiModelProperty("현재 B링 현시, Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("prst_bring_phas")
        @PositiveOrZero
        private Integer prstBringPhas;

        @ApiModelProperty("함체 상태, Nullable = Y, NUMBER(1)")  // Y NUMBER(1)
        @JsonProperty("cbox_stts")
        @PositiveOrZero
        private Integer cboxStts;

        @Builder
        public TbScSgnlIxrSttsUpdReq(Integer sgnl_ixr_nmbr, Integer lc_cnt, Integer cntl_mode, Integer cntl_stts, Integer spcl_cntl, Integer cycl, Integer ofst, Integer aring_1phas, Integer aring_2phas, Integer aring_3phas, Integer aring_4phas, Integer aring_5phas, Integer aring_6phas, Integer aring_7phas, Integer aring_8phas, Integer bring_1phas, Integer bring_2phas, Integer bring_3phas, Integer bring_4phas, Integer bring_5phas, Integer bring_6phas, Integer bring_7phas, Integer bring_8phas, Integer prst_aring_phas, Integer prst_bring_phas, Integer cbox_stts) {
            this.sgnlIxrNmbr = sgnl_ixr_nmbr;
            this.lcCnt = lc_cnt;
            this.cntlMode = cntl_mode;
            this.cntlStts = cntl_stts;
            this.spclCntl = spcl_cntl;
            this.cycl = cycl;
            this.ofst = ofst;
            this.aring1phas = aring_1phas;
            this.aring2phas = aring_2phas;
            this.aring3phas = aring_3phas;
            this.aring4phas = aring_4phas;
            this.aring5phas = aring_5phas;
            this.aring6phas = aring_6phas;
            this.aring7phas = aring_7phas;
            this.aring8phas = aring_8phas;
            this.bring1phas = bring_1phas;
            this.bring2phas = bring_2phas;
            this.bring3phas = bring_3phas;
            this.bring4phas = bring_4phas;
            this.bring5phas = bring_5phas;
            this.bring6phas = bring_6phas;
            this.bring7phas = bring_7phas;
            this.bring8phas = bring_8phas;
            this.prstAringPhas = prst_aring_phas;
            this.prstBringPhas = prst_bring_phas;
            this.cboxStts = cbox_stts;
        }

        public TbScSgnlIxrStts toEntity() {
            return TbScSgnlIxrStts.builder()
                    .sgnlIxrNmbr(this.sgnlIxrNmbr)
                    .lcCnt(this.lcCnt)
                    .cntlMode(this.cntlMode)
                    .cntlStts(this.cntlStts)
                    .spclCntl(this.spclCntl)
                    .cycl(this.cycl)
                    .ofst(this.ofst)
                    .aring1phas(this.aring1phas)
                    .aring2phas(this.aring2phas)
                    .aring3phas(this.aring3phas)
                    .aring4phas(this.aring4phas)
                    .aring5phas(this.aring5phas)
                    .aring6phas(this.aring6phas)
                    .aring7phas(this.aring7phas)
                    .aring8phas(this.aring8phas)
                    .bring1phas(this.bring1phas)
                    .bring2phas(this.bring2phas)
                    .bring3phas(this.bring3phas)
                    .bring4phas(this.bring4phas)
                    .bring5phas(this.bring5phas)
                    .bring6phas(this.bring6phas)
                    .bring7phas(this.bring7phas)
                    .bring8phas(this.bring8phas)
                    .prstAringPhas(this.prstAringPhas)
                    .prstBringPhas(this.prstBringPhas)
                    .cboxStts(this.cboxStts)
                    .build();
        }

    }

}
