package com.jeesharp.business.modules.finance.paymentrecord.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * 业务场景编码：区分支付发生在哪类业务链路，便于统计与对账。
 *
 * @author jeesharp
 * @since 2026-05-09
 */
@Getter
@AllArgsConstructor
public enum PayRecordBizSceneEnum {

    MALL_ORDER("MALL_ORDER", "商城订单"),
    SCENIC_TICKET("SCENIC_TICKET", "景区门票"),
    HOTEL_BOOKING("HOTEL_BOOKING", "酒店预订"),
    LEISURE_BOOKING("LEISURE_BOOKING", "休闲预订"),
    FOOD_ORDER("FOOD_ORDER", "餐饮订单"),
    FOOD_MEAL_ORDER("FOOD_MEAL_ORDER", "个人订餐订单"),
    STUDY_ORDER("STUDY_ORDER", "研学预约"),
    FOOD_COMPANY_RECHARGE("FOOD_COMPANY_RECHARGE", "企业团餐充值"),
    FOOD_COMPANY_MEAL_ORDER("FOOD_COMPANY_MEAL_ORDER", "企业团餐订单"),
    ROUTE_TRIP("ROUTE_TRIP", "线路/行程"),
    YEAR_CARD("YEAR_CARD", "年卡"),
    MEMBER_RECHARGE("MEMBER_RECHARGE", "会员充值"),
    VILLAGE_BOOKING("VILLAGE_BOOKING", "乡村预约"),
    GUIDE_SERVICE("GUIDE_SERVICE", "导游服务"),
    CULTURE_ENROLL("CULTURE_ENROLL", "文化活动报名"),
    OTHER("OTHER", "其它");

    private final String code;
    private final String desc;

    public static PayRecordBizSceneEnum fromCode(String code) {
        if (code == null || code.isEmpty()) {
            return null;
        }
        for (PayRecordBizSceneEnum e : values()) {
            if (e.code.equals(code)) {
                return e;
            }
        }
        return null;
    }

    public static String getDescByCode(String code) {
        PayRecordBizSceneEnum e = fromCode(code);
        return e != null ? e.getDesc() : (code == null ? "" : code);
    }
}
