package com.bonus.core.marketing.vo;

import com.bonus.core.marketing.v2.util.MarketUtil;
import com.bonus.framework.config.deserializer.DateDeserializer;
import com.bonus.framework.config.serializer.DateSerializer;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.time.LocalDate;
import java.util.List;

@ApiModel("消费规则基本信息")
public class MarketRuleVO {
   @ApiModelProperty("主键")
   private Long ruleId;
   @ApiModelProperty("规则名称")
   private String ruleName;
   @ApiModelProperty("场景类型")
   private Integer sceneType;
   @ApiModelProperty("模块类型（1：就餐，2：计价，3：扣款）")
   private Integer moduleType;
   @ApiModelProperty("规则类型")
   private Integer ruleType;
   @ApiModelProperty("生效时间类型：1：限制时间段，2：不限")
   private Integer effectTimeType;
   @ApiModelProperty("生效开始时间")
   @JsonSerialize(
      using = DateSerializer.YYYY_MM_DD.class
   )
   @JsonDeserialize(
      using = DateDeserializer.class
   )
   private LocalDate effectBeginTime;
   @ApiModelProperty("生效结束时间")
   @JsonSerialize(
      using = DateSerializer.YYYY_MM_DD.class
   )
   @JsonDeserialize(
      using = DateDeserializer.class
   )
   private LocalDate effectEndTime;
   @ApiModelProperty("生效时间段")
   private List<String> effectTimeValue;
   @ApiModelProperty("生效时间段")
   private String effectTimeValueStr;
   @ApiModelProperty("生效周期（1：每天；2：每周；3：每月；4：日期类型）")
   private Integer effectPeriod;
   @ApiModelProperty("生效周期值（1，2，3，4.....）")
   private List<Integer> effectPeriodValue;
   @ApiModelProperty("生效周期值（1，2，3，4.....）")
   private String effectPeriodValueStr;
   @ApiModelProperty("规则优先级")
   private Integer sort;
   @ApiModelProperty("备注")
   private String remark;
   @ApiModelProperty("规则内容json")
   private String ruleInfo;
   @ApiModelProperty("是否可以组合使用，暂不做")
   private Integer groupFlag;
   @ApiModelProperty("是否禁用(1-是，2-否)")
   private Integer disableFlag;
   @ApiModelProperty("创建人")
   private String crby;
   @ApiModelProperty("创建时间")
   @JsonSerialize(
      using = DateSerializer.YYYY_MM_DD.class
   )
   @JsonDeserialize(
      using = DateDeserializer.class
   )
   private LocalDate crtime;
   @ApiModelProperty("更新人")
   private String upby;
   @ApiModelProperty("更新时间")
   @JsonSerialize(
      using = DateSerializer.YYYY_MM_DD.class
   )
   @JsonDeserialize(
      using = DateDeserializer.class
   )
   private LocalDate uptime;

   public void setEffectTimeValueStr(String effectTimeValueStr) {
      this.effectTimeValueStr = effectTimeValueStr;
      this.effectTimeValue = MarketUtil.formatEffectTimeValueToList(effectTimeValueStr);
   }

   public void setEffectPeriodValueStr(String effectPeriodValueStr) {
      this.effectPeriodValueStr = effectPeriodValueStr;
      this.effectPeriodValue = MarketUtil.formatEffectPeriodValueToList(effectPeriodValueStr);
   }

   public void setEffectTimeValue(List<String> effectTimeValue) {
      this.effectTimeValue = effectTimeValue;
      this.effectTimeValueStr = MarketUtil.formatEffectTimeValueToStr(effectTimeValue);
   }

   public void setEffectPeriodValue(List<Integer> effectPeriodValue) {
      this.effectPeriodValue = effectPeriodValue;
      this.effectPeriodValueStr = MarketUtil.formatEffectPeriodValueToStr(effectPeriodValue);
   }

   public Long getRuleId() {
      return this.ruleId;
   }

   public String getRuleName() {
      return this.ruleName;
   }

   public Integer getSceneType() {
      return this.sceneType;
   }

   public Integer getModuleType() {
      return this.moduleType;
   }

   public Integer getRuleType() {
      return this.ruleType;
   }

   public Integer getEffectTimeType() {
      return this.effectTimeType;
   }

   public LocalDate getEffectBeginTime() {
      return this.effectBeginTime;
   }

   public LocalDate getEffectEndTime() {
      return this.effectEndTime;
   }

   public List<String> getEffectTimeValue() {
      return this.effectTimeValue;
   }

   public String getEffectTimeValueStr() {
      return this.effectTimeValueStr;
   }

   public Integer getEffectPeriod() {
      return this.effectPeriod;
   }

   public List<Integer> getEffectPeriodValue() {
      return this.effectPeriodValue;
   }

   public String getEffectPeriodValueStr() {
      return this.effectPeriodValueStr;
   }

   public Integer getSort() {
      return this.sort;
   }

   public String getRemark() {
      return this.remark;
   }

   public String getRuleInfo() {
      return this.ruleInfo;
   }

   public Integer getGroupFlag() {
      return this.groupFlag;
   }

   public Integer getDisableFlag() {
      return this.disableFlag;
   }

   public String getCrby() {
      return this.crby;
   }

   public LocalDate getCrtime() {
      return this.crtime;
   }

   public String getUpby() {
      return this.upby;
   }

   public LocalDate getUptime() {
      return this.uptime;
   }

   public void setRuleId(final Long ruleId) {
      this.ruleId = ruleId;
   }

   public void setRuleName(final String ruleName) {
      this.ruleName = ruleName;
   }

   public void setSceneType(final Integer sceneType) {
      this.sceneType = sceneType;
   }

   public void setModuleType(final Integer moduleType) {
      this.moduleType = moduleType;
   }

   public void setRuleType(final Integer ruleType) {
      this.ruleType = ruleType;
   }

   public void setEffectTimeType(final Integer effectTimeType) {
      this.effectTimeType = effectTimeType;
   }

   @JsonDeserialize(
      using = DateDeserializer.class
   )
   public void setEffectBeginTime(final LocalDate effectBeginTime) {
      this.effectBeginTime = effectBeginTime;
   }

   @JsonDeserialize(
      using = DateDeserializer.class
   )
   public void setEffectEndTime(final LocalDate effectEndTime) {
      this.effectEndTime = effectEndTime;
   }

   public void setEffectPeriod(final Integer effectPeriod) {
      this.effectPeriod = effectPeriod;
   }

   public void setSort(final Integer sort) {
      this.sort = sort;
   }

   public void setRemark(final String remark) {
      this.remark = remark;
   }

   public void setRuleInfo(final String ruleInfo) {
      this.ruleInfo = ruleInfo;
   }

   public void setGroupFlag(final Integer groupFlag) {
      this.groupFlag = groupFlag;
   }

   public void setDisableFlag(final Integer disableFlag) {
      this.disableFlag = disableFlag;
   }

   public void setCrby(final String crby) {
      this.crby = crby;
   }

   @JsonDeserialize(
      using = DateDeserializer.class
   )
   public void setCrtime(final LocalDate crtime) {
      this.crtime = crtime;
   }

   public void setUpby(final String upby) {
      this.upby = upby;
   }

   @JsonDeserialize(
      using = DateDeserializer.class
   )
   public void setUptime(final LocalDate uptime) {
      this.uptime = uptime;
   }
}
