package com.qs.mp.common.enums;

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

/**
 * @author zhangkaikai
 * @create 2023-05-24 1:58 PM
 **/
@JSONType(deserializer = EnumValueDeserializer.class)
public enum TicketBoxSaleAreaEnum implements IEnum<Integer> {

    // 线下所有渠道
    OFFLINE_ALL(1, "offline"),
    // 线下部分渠道
    OFFLINE_PART(2, "offline"),

    // 线上首页售卖
    ONLINE_HOMEPAGE(1,"online"),
    // 线上指定门店
    ONLINE_POINT(2,"online")
    ;

    private int value;
    private final String desc;

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

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

    public String getDesc() {
        return desc;
    }

    public static TicketBoxSaleAreaEnum valueToSaleAreaType(Integer value) {
        switch (value) {
            case 1:
                return TicketBoxSaleAreaEnum.OFFLINE_ALL;
            case 2:
                return TicketBoxSaleAreaEnum.OFFLINE_PART;
            case 3:
                return TicketBoxSaleAreaEnum.ONLINE_HOMEPAGE;
            case 4:
                return TicketBoxSaleAreaEnum.ONLINE_POINT;
            default:
                return null;
        }
    }
}
