package com.qunzhixinxi.hnqz.admin.api.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.FastjsonTypeHandler;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.qunzhixinxi.hnqz.admin.api.constant.UpmsType;
import com.qunzhixinxi.hnqz.common.core.constant.enums.CommonFlag;
import lombok.Data;
import lombok.ToString;

import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

/**
 * 任务提交规则
 *
 * @author jimmy
 * @version 1.0.0
 * @date 2022-08-15 14:50
 */
@Data
@ToString
@TableName(value = "wm_task_sub_rule", autoResultMap = true)
public class WmTaskSubmissionRule implements Serializable {
	private static final long serialVersionUID = -3042306831006555056L;

	/**
	 * 提交规则id
	 */
	@TableId(value = "rule_id", type = IdType.AUTO)
	private Integer ruleId;

	/**
	 * 企业id
	 */
	private Integer deptId;

	/**
	 * 二级分类
	 */
	@TableField(value = "sub_cate")
	private UpmsType.TaskSubCategory subCategory;

	/**
	 * 任务规则
	 */
	@TableField(value = "sub_rule", typeHandler = FastjsonTypeHandler.class)
	private List<WmTaskSubmissionRule.SubmissionRule> rule;

	/**
	 * 可操作标记
	 */
	private CommonFlag.OptFlag optFlag;

	/**
	 * 创建时间
	 */
	private LocalDateTime createTime;

	/**
	 * 创建时间
	 */
	private LocalDateTime updateTime;


	/**
	 * 提交规则实体
	 */
	@Data
	@ToString
	public static class SubmissionRule implements Serializable {

		private static final long serialVersionUID = -9205151158528196927L;

		/**
		 * 限制说明
		 */
		private String manual;

		/**
		 * 限制频次
		 */
		private List<Map<String, Object>> frequency;

		/**
		 * 分隔符
		 */
		private String separator;

		/**
		 * 是否可以新增
		 */
		private Boolean multiple;


	}


}
