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

import lombok.Data;

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

@Data
public class CodeEpVO {

    @Size(max = 200, message = "规则最多200条")
    private List<@Valid Rule> rules;

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

    private String updater;

    private String date;

    @Data
    public static class Rule {

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

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

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

        @Valid
        private Condition condition;
    }

    @Data
    public static class Condition {

        private Integer rankCode;

        @Size(max = 100, message = "Rank最多100个")
        private List<String> rankValue;

        private Integer gpnCode;

        @Size(max = 100, message = "GPN最多100个")
        private List<String> gpnValues;

        // project 只要userid， 前台需要全部内容

        @Size(max = 1000, message = "exceptionEp最多100个")
        private List<@Valid Ep> exceptionEp;

        @Size(max = 1000, message = "data最多100个")
        private List<@Valid Ep> data;

    }

    @Data
    public static class Ep {

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

        @Size(max = 100, message = "rule最多100个")
        private List<NewRule> rule;

        @Size(max = 100, message = "table最多100个")
        private List<Table> table;
    }


    @Data
    public static class NewRule {

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

        @Size(max = 100, message = "region最多100个")
        private List<String> region;

        @Size(max = 100, message = "serviceLine最多100个")
        private List<String> serviceLine;

        @Size(max = 100, message = "rank最多100个")
        private List<String> rank;

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

    @Data
    public static class Table {

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

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

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

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

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

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

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

}
