package cn.ey.biz.module.system.controller.admin.code.vo;

import lombok.Data;

import javax.validation.Valid;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.List;

@Data
public class CodeProjectVO {

    @Valid
    private Assurance assurance;

    @Valid
    private Consulting consulting;

    @Size(max = 200, message = "说明最多200个字符")
    private String explanation;

    @Data
    @Valid
    public static class Assurance {

        @Size(max = 100, message = "国家最多100个")
        private List<@Size(max = 100, message = "国家名最多100个字符") String> countries;

        @Size(max = 100, message = "region最多100个字符 ")
        private String region;

        @Size(max = 100, message = "业务线最多100个字符")
        private String sl;

        @Size(max = 100, message = "子业务线最多100个字符")
        private String subSl;

        @Size(max = 100, message = "Code最多100个")
        private List<@Valid Code> codes;
    }

    @Data
    @Valid
    public static class Consulting {

        @Size(max = 100, message = "国家最多100个")
        private List<@Size(max = 100, message = "国家名最多100个字符") String> countries;

        @Size(max = 100, message = "region最多100个字符")
        private String region;

        @Size(max = 100, message = "业务线最多100个字符")
        private String sl;

        @Size(max = 100, message = "子业务线最多100个字符")
        private List<@Size(max = 100, message = "子业务线名最多100个字符") String> subSl;

        @Size(max = 100, message = "Code最多100个")
        private List<@Valid Prefix> prefix;
    }

    @Data
    public static class Prefix {
        @Valid
        @Size(max = 100, message = "operation最多100个")
        private List<@Valid Item> operations;
    }

    @Data
    public static class Code {
        @NotBlank(message = "全球服务编码不能为空")
        @Size(max = 100, message = "全球服务编码最多100个字符")
        private String code;

        @NotBlank(message = "全球服务编码对应的命名前缀不能为空")
        @Size(max = 100, message = "全球服务编码对应的命名前缀最多100个字符")
        private String prefix;
    }

    @Data
    public static class Item {

        @NotBlank(message = "前缀名称不能为空")
        @Size(max = 100, message = "前缀名称最多100个字符")
        private String name;

        @Size(max = 100, message = "前缀名称Code最多100个字符")
        private String code;

        @NotBlank(message = "前缀赋值不能为空")
        @Size(max = 100, message = "前缀赋值最多100个字符")
        private String assignment;

        @Valid
        @Size(max = 100, message = "relation最多100个")
        private List<@Valid Item> relation;
    }
}
