package com.njzscloud.common.sn;

import com.njzscloud.common.mvc.validator.Constrained;
import com.njzscloud.common.mvc.validator.Constraint;
import com.njzscloud.common.mvc.validator.ValidRule;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;

import java.util.HashMap;
import java.util.List;

@Getter
@Setter
@ToString
@Accessors(chain = true)
@Constraint
public class ModifySnConfigParam implements Constrained {
    private Long id;

    /**
     * 配置
     */
    private List<HashMap<String, Object>> config;

    /**
     * 备注
     */
    private String memo;

    @Override
    public ValidRule[] rules() {
        return new ValidRule[]{
                ValidRule.of(() -> config != null && !config.isEmpty(), "编码规则不能为空"),
        };
    }
}
