%%%-------------------------------------------------------------------
%%% @author  tyl
%%% @doc
%%%    社团协助头文件
%%% @end
%%% Created : 2021-03-15
%%%-------------------------------------------------------------------

%% 玩家进程dict感谢信和记录相关key
-define(P_GUILD_SUPPORT_THANK, guild_support_thank). % 公会协助礼包
-define(P_GUILD_SUPPORT_LOG, guild_support_log).     % 公会协助记录

%% 感谢信/感谢记录类型
-define(THANK_TYPE_SUPPORT,  1).
-define(THANK_TYPE_ORDER,    2).

%% 协助进度状态
-define(SUPPORT_NOT_STAR,    0).     %% 协助未开始
-define(SUPPORT_ON_GOING,    1).     %% 协助进行中
-define(SUPPORT_FINISH,      2).     %% 协助已完成
-define(SUPPORT_SEND_REWARD, 3).     %% 已推送奖励

%% 每日最大协助奖励次数
-define(SUPPORT_MAX_COUNT, 9999).        %% 默认值
-define(SUPPORT_HUSONG_MAX_COUNT, 3).    %% 护送

%% 请求者和协助者身份状态是否冲突
-define(NOT_CONFLICT,  0).    %% 不冲突(例如社团采集)
-define(IS_CONFLICT,   1).    %% 冲突(例如幻魔)

%% 退出场景是否取消协助
-define(OUT_SCENE_NOT_CANCEL, 0).  %% 不取消(例如社团采集)
-define(OUT_SCENE_CANCEL,     1).  %% 取消(例如幻魔)

%% 协助是否成功
-define(SUPPORT_FAIL,    0).   %% 协助失败(例如超时等)
-define(SUPPORT_SUCCESS, 1).   %% 协助成功
-define(SUPPORT_CANCEL,  2).   %% 协助取消

%% 感谢礼包
-record(guild_thank_packet, {
	ask_id     = 0,
	support_id = 0,
	role_list  = [],
	support_cfg_id = 0,
	content    = [],
	is_send    = 0,         %% 是否已经发送感谢
	time       = 0
}).

%% 协助记录(需求请求者先发送感谢)
-record(guild_thank_log, {
	ask_id     = 0,
	support_id = 0,
	support_cfg_id = 0,
	content    = [],
	chat_msg   = "",
	is_receive = 0,         %% 是否已经领取奖励
	time       = 0
}).

-define(SAVE_SUPPORT_THANK, <<"REPLACE INTO guild_support_thank (`support_id`, `guild_id`, `ask_id`,`support_cfg_id`,`role_list`,`content`,`is_send`,`time`) VALUES (~p, ~p, ~p, ~p, '~ts', '~ts', ~p, ~p)">>).
-define(SELECT_SUPPORT_THANK, <<"SELECT `support_id`,`guild_id`,`ask_id`,`support_cfg_id`,`role_list`,`content`,`is_send`,`time` FROM guild_support_thank WHERE `ask_id` = ~p and `time` > ~p">>).
-define(DELETE_SUPPORT_THANK, <<"DELETE FROM guild_support_thank WHERE `time` < ~p">>).

-define(BATCH_SAVE_SUPPORT_LOG, <<"REPLACE INTO guild_support_log (`support_id`,`guild_id`,`role_id`,`ask_id`,`support_cfg_id`,`content`,`chat_msg`,`is_receive`,`time`) VALUES ~ts">>).
-define(BATCH_SAVE_SUPPORT_LOG_VALUE, <<"(~p, ~p, ~p, ~p, ~p, '~ts', '~ts', ~p, ~p)">>).
-define(SELECT_SUPPORT_LOG, <<"SELECT `support_id`,`guild_id`,`role_id`,`ask_id`,`support_cfg_id`,`content`,`chat_msg`,`is_receive`,`time` FROM guild_support_log WHERE `role_id` = ~p and `time` > ~p">>).
-define(DELETE_SUPPORT_LOG, <<"DELETE FROM guild_support_log WHERE `time` < ~p">>).