%%% -------------------------------------------------------
%%% @author huangyongxing@yeah.net
%%% @doc
%%% 弹珠活动相关
%%% @end
%%% -------------------------------------------------------
-ifndef(PELLET_HRL).
-define(PELLET_HRL, ok).

%% 抽奖数据
-define(SQL_SELECT_ROLE_PELLET, <<"SELECT `round`,`count`,`got_ids`,`got_time`,`draw_time`,`draw_subtype`,`draw_key`,`draw_over` FROM `role_pellet_draw` WHERE `id`=~w">>).
-define(SQL_REPLACE_ROLE_PELLET_HEAD, <<"REPLACE INTO `role_pellet_draw` (`id`,`round`,`count`,`got_ids`,`got_time`,`draw_time`,`draw_subtype`,`draw_key`,`draw_over`)">>).

%% 抽奖、累计次数奖励记录
-define(SQL_SELECT_PELLET_AWARD_RECORD_RECENTLY, <<"SELECT `id`,`role_id`,`name`,`goods_type_id`,`goods_num`,`get_type`,`time` FROM pellet_award_records ORDER BY id DESC LIMIT ~w">>).
-define(SQL_REPLACE_PELLET_AWARD_RECORD_HEAD, <<"REPLACE INTO pellet_award_records (`role_id`,`name`,`goods_type_id`,`goods_num`,`get_type`,`time`)">>).
-define(SQL_DEL_PELLET_AWARD_RECORD_ID, <<"DELETE FROM pellet_award_records WHERE id < ~w">>).

%% 奖励未领取，活动结算时通过邮件发放
-define(PELLET_MAIL_TITLE, 3310601).
-define(PELLET_MAIL_CONTENT, 3310602).

%% 传闻相关语言包331活动模块下，子id配置
-define(LANG_DRAW_SUB_ID, 3).
-define(LANG_DRAW_COUNT_SUB_ID, 4).

%% 定义弹珠活动累计次数奖励状态
-define(PELLET_COUNT_NOT_ENOUGH, 0).
-define(PELLET_COUNT_CAN_GET,    1).
-define(PELLET_COUNT_GOT,        2).

%% 活动档次的充值/消费类型
-define(GRADE_TYPE_RECHARGE,  1).
-define(GRADE_TYPE_CONSUME, 2).

%% 玩家数据
%% 对应每日累充/消费 - 弹珠活动
%% CUSTOM_ACT_TYPE_DAILY_CHARGE_CONSUME
-record(pellet, {
        round = 0                       % 当前抽奖轮次
        ,count = 0                      % 当前轮次抽奖次数
        ,got_ids = []                   % 本轮次已领取的次数奖励Id [AwardId]
        ,got_time = 0                   % 上次领取次数奖励的时间戳
        ,draw_time = 0                  % 上次请求抽奖的时间
        ,draw_subtype = 0               % 当前请求抽奖的活动子类型
        ,draw_key = <<>>                % 抽奖验证key
        ,draw_over = 0                  % 抽奖结果提交/结算时间
    }).

%% 弹珠活动产出奖励 记录条目 数据结构
-record(pellet_award_record, {
        role_id = 0
        ,name = <<>>
        ,goods_type_id = 0
        ,goods_num = 0
        ,get_type = 0
        ,time = 0
        ,is_saved = true
    }).

%% 弹珠活动结算参数之累充消费数据
-record(pellet_settle_params, {
        role_id = 0
        ,recharge_gold = 0
        ,consume_gold = 0
        ,recharge_reward_cfgs = []
        ,consume_reward_cfgs = []
        ,settle_midnight = 0
    }).

-endif.
