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

import cn.ey.biz.common.util.json.JsonUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;

import javax.validation.constraints.NotEmpty;
import java.util.List;

@ApiModel("工时后台 - 代理人代理单元授权group Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class UserDelegationUnitSaveReqVO extends UserDelegationUnitBaseVO {

    @ApiModelProperty(value = "主键",notes = "更新或取消授权必填")
    private Long id;

    @ApiModelProperty(value = "关系描述", example = "[[\"1\",\"10\"],[\"2\",\"20\"]]", required = true,  notes = "选中代理单元value值")
    @NotEmpty(message = "关系描述不能为空")
    private List<String[]> relationData;

    /**
     * json 自动序列化使用
     */
    public void setRelationData(List<String[]> relationData) {
        this.relationData = relationData;
        setRelation(JsonUtils.toJsonString(relationData));
    }


}
