package com.zsElectric.boot.common.enums;

/**
 * 优惠券相关枚举类
 *
 * @author zsElectric
 * @since 2025-12-19
 */
public class CouponEnums {

    /**
     * 优惠券状态枚举
     */
    public enum CouponStatus {
        UNUSED(1, "未使用"),
        USED(2, "已使用"),
        EXPIRED(3, "已过期");

        private final Integer code;
        private final String description;

        CouponStatus(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String getDescriptionByCode(Integer code) {
            for (CouponStatus status : values()) {
                if (status.getCode().equals(code)) {
                    return status.getDescription();
                }
            }
            return "未知";
        }
    }

    /**
     * 优惠券模板状态枚举
     */
    public enum TemplateStatus {
        ONLINE(1, "上线"),
        OFFLINE(2, "下线");

        private final Integer code;
        private final String description;

        TemplateStatus(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String getDescriptionByCode(Integer code) {
            for (TemplateStatus status : values()) {
                if (status.getCode().equals(code)) {
                    return status.getDescription();
                }
            }
            return "未知";
        }
    }

    /**
     * 优惠券类型枚举
     */
    public enum CouponType {
        DISCOUNT(1, "折扣券"),
        REDUCTION(2, "满减券"),
        NO_THRESHOLD(3, "无门槛券");

        private final Integer code;
        private final String description;

        CouponType(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String getDescriptionByCode(Integer code) {
            for (CouponType type : values()) {
                if (type.getCode().equals(code)) {
                    return type.getDescription();
                }
            }
            return "未知";
        }
    }

    /**
     * 领取类型枚举
     */
    public enum TakeType {
        USER_TAKE(1, "用户领取"),
        ADMIN_ISSUE(2, "后台发放");

        private final Integer code;
        private final String description;

        TakeType(Integer code, String description) {
            this.code = code;
            this.description = description;
        }

        public Integer getCode() {
            return code;
        }

        public String getDescription() {
            return description;
        }

        public static String getDescriptionByCode(Integer code) {
            for (TakeType type : values()) {
                if (type.getCode().equals(code)) {
                    return type.getDescription();
                }
            }
            return "未知";
        }
    }
}