package cn.ysk.cashier.cons;

public interface RedisConstant {
    //在线用户
    String ONLINE_USER = "ONLINE:USER";
    String CART = "CZG:CART:";

    public final Object PRODUCT = "PRODUCT:";

    public final String OUT_NUMBER="ORDER:NUMBER:";

    public static final String ORDER_MESSAGE="ORDER:MESSAGE:";
    public static final String ORDER_PRODUCT_NUM = "ORDER_NUM:";
    public static final String ORDER_CART_EXISTS = "ORDER_CART_EXISTS:";
    String CURRENT_TABLE_ORDER = "CURRENT_TABLE_ORDER:";

    public static String TABLE_CART = "TABLE:CART:";
    String ADD_TABLE_CART_LOCK = "ADD_TABLE_CART";
    String PC_OUT_NUMBER = "PC_OUT_NUMBER:";

    String LOCK_KEY = "LOCK:";
    String CREATE_ORDER = "CREATE_ORDER";


    static String getCurrentOrderKey(String tableId, String shopId) {
        return CURRENT_TABLE_ORDER + shopId + ":" + tableId;
    }

    static String getTableCartKey(String tableId, String shopId) {
        return TABLE_CART + tableId + "-" + shopId;
    }

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