package com.qs.mp.common.enums;

import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson.annotation.JSONType;
import com.baomidou.mybatisplus.annotation.IEnum;
import com.qs.mp.common.json.EnumValueDeserializer;

/**
 * @auther zhongcp
 * @create 2022 2022/3/7 2:30 下午
 * @describe
 */
@JSONType(deserializer = EnumValueDeserializer.class)
public enum CouponUseAreaEnum implements IEnum<Integer> {

  COMMON(0, "通用"),
  PRE_SCOPE(1, "指定范围"), // 生成优惠券的时候设定使用范围
  POST_SCOPE(2, "指定范围"), // 门店消费类优惠券，发放的时候动态设定使用范围
  ONLINE_SCOPE(3, "所有线上盲票"), // 盲票购买类优惠券，仅限线上盲票
  OFFLINE_SCOPE(4, "所有线下盲票"); // 盲票购买类优惠券，仅限线下盲票


  private final int value;
  private final String desc;

  CouponUseAreaEnum(int value, String desc) {
    this.value = value;
    this.desc = desc;
  }

  @Override
  public Integer getValue() {
    return value;
  }

  public String getDesc() {
    return desc;
  }

  @Override
  public String toString() {
    JSONObject object = new JSONObject();
    object.put("value", value);
    object.put("desc", desc);
    return object.toString();
  }
}
