package com.czg.config;

/**
 *
 * key常量
 *
 * @author Administrator
 */
public interface RedisCst {
    String LOCK_KEY = "LOCK:";

    String LOGIN_CODE = "login:code:";
    String SYS_LOG_KEY = "sys:log:";


    /**
     * key过期监听
     */
    class classKeyExpired {
        //订单key过期
        public static final String EXPIRED_ORDER = "expired:order:";
        //台桌清台key过期
        public static final String EXPIRED_TABLE = "expired:table:";
        //优惠券过期
        public static final String EXPIRED_COUPON = "expired:coupon:";
        //拼团 任务过期
        public static final String EXPIRED_GB_ORDER = "expired:gb:order:";
        // 套餐推广 任务过期
        public static final String EXPIRED_PP_ORDER = "expired:pp:order:";
        //短信定时发放 倒计时KEY
        public static final String EXPIRED_SMS = "expired:sms:";
        //公众号推送 倒计时KEY
        public static final String EXPIRED_WECHAT = "expired:wechat:";
    }

    //商家进件
    String SHOP_ENTRY = "shop:entry";

    String SMS_CODE = "sms:code:";
    // 店铺会员动态支付码
    String SHOP_USER_DYNAMIC_CODE = "shop:user:dynamic:code:";

    //店铺取餐码key
    String SHOP_CODE = "shop:code:";

    //店铺会员码Key 跳转会员页面
    String SHOP_VIP_CODE = "shop:vip:code:";


    // 排队取号全局号码
    String TABLE_CALL_NUMBER = "table:call:number:";

    // 点歌地址url
    String SONG_URL = "song:";

    class kitchen {
        //后厨总单
        public static final String ALL = "print:kitchen:all";
        //菜品单
        public static final String ONLY = "print:kitchen:only";
        //退菜单
        public static final String REFUND_ALL = "print:kitchen:refundAll";
    }


    static String getLockKey(String sign, Object... args) {
        StringBuilder key = new StringBuilder(LOCK_KEY + ":" + sign + ":");
        for (Object arg : args) {
            if (arg != null) {
                key.append(":").append(arg);
            }
        }
        return key.toString();
    }

    static String getTableCallNumKey(Long shopId, Long callTableId) {
        return TABLE_CALL_NUMBER + shopId + ":" + callTableId;
    }

    /**
     * 后厨总单
     *
     * @param machineId 打印机设备id
     */
    static String kitchenAll(Long orderId, Long machineId) {
        return kitchen.ALL + orderId + ":" + machineId;
    }

    /**
     * 后厨单个菜品单
     *
     * @param machineId 打印机设备id
     */
    static String kitchenOnly(Long orderId, Long machineId, Long detailId) {
        return kitchen.ONLY + orderId + ":" + machineId + ":" + detailId;
    }

    /**
     * 后厨总单
     *
     * @param machineId 打印机设备id
     */
    static String kitchenRefundAll(Long orderId, Long machineId) {
        return kitchen.REFUND_ALL + orderId + ":" + machineId;
    }

    static String getSongUrlKey(Long shopId) {
        return SONG_URL + shopId;
    }
}
