-define(UN_USED,                0). % 未使用
-define(USED,                   1). % 使用中

-define(FASHION_POS_WEAPON,     2). % 武器位置

-define(FASHION_OPEN_LV,        1). %% 开放等级

%% ----------------------------------- 激活类型定义 ------------------------------------
-define(FASHION_ACTIVATE_SHORT, 1). %% 时装显示激活
-define(FASHION_ACTIVATE_EVER,  2). %% 时装永久激活
-define(FASHION_RENEW,          3). %% 时装续费

-define(FASHION_TRIAL_ACTIVE, trial_active).
-define(FASHION_PERMANENT_ACTIVE, permanent_active).

-define(COLOR_ACTIVE,               1). %% 无->永久激活
-define(COLOR_STAR_UP,              2). %% 升星
-define(COLOR_SHORT_ACTIVE_EVER,    3). %% 限时激活永久
-define(COLOR_SHORT_ACTIVE,         4). %% 限时激活|叠加

%% 部位定义
-define(CLOTH,       1).        %% 服饰
-define(HEAD_WEAR,   2).        %% 头饰
-define(BACK_DECOR,  3).        %% 背饰
-define(WEAPON,      4).        %% 武器
-define(HAIR,        5).        %% 发型

%% 人物时装总数据
-record(role_fashion, {
    all_fashions = [],                  %% 时装部位列表 [#fashion_pos{},...]
    fashion_attr = [],
    suit_list = [],                     %% 套装数据 [{套装id, [{Pos, FashionId, ColorId}(时装颜色列表)]},...]
    power = 0,                          %% 全部战力
    power1 = 0                          %% 无限时战力
    }).

-record(fashion_pos,{
    pos_id              = 0,            %% 部位ID
    wear_fashion_id     = 0,            %% 穿戴时装ID
    wear_color_id       = 0,            %% 穿戴时装颜色ID
    fashion_list        = []            %% 已激活时装列表 [#fashion_info{},...] | []
}).

-record(fashion_info, {
    pos_id              = 0,            %% 部位ID
    fashion_id          = 0,            %% 时装ID
    color_id            = 0,            %% 时装颜色ID
    color_list          = [],           %% 已激活颜色列表 [{颜色ID,颜色星级,过期时间},...]
    power               = 0             %% 时装战力
}).

%% ----------------------------------- 后台配置定义 -------------------------------------
%% 时装颜色升星
-record(base_fashion_star_up, {
    pos_id          = 0,                %% 部位
    fashion_id      = 0,                %% 时装id
    color_id        = 0,                %% 颜色ID
    star_lv         = 0,                %% 时装星级
    star_cost       = [],               %% 升星消耗
    cost_goods      = [],               %% 激活整件物品Id
    attr_list       = [],               %% 属性列表
    power           = 0                 %% 战力显示    
    }).


%% 时装染色
-record(fashion_color_con, {
    pos_id          = 0,                %% 部位
    fashion_id      = 0,                %% 时装id
    color_id        = 0,                %% 颜色id
    color_logo      = 0,                %% 颜色logo
    color_name      = "",               %% 颜色名字
    icon_id         = 0                 %% 图标ID
}).

%% 时装模型
-record(fashion_model_con, {
    pos_id          = 0,                %% 部位
    fashion_id      = 0,                %% 时装id
    name            = "",               %% 时装名字
    career          = 0,                %% 职业
    model_id        = 0,                %% 模型id
    index           = 0                 %% 序号(前端排序)
    ,open_day       = 0                 %% 开启天数
    ,open_time      = ""                %% 开启时间
}).


%% 限时时装体验配置
-record(base_fashion_trial, {
    goods_id = 0,
    fashion_id = 0,
    color_id = 0,
    expire_time = 0,
    is_overlay = 0
    }).


%% 时装套装配置
-record(base_fashion_suit, {
    suit_id = 0,                        %% 套装id
    fashion_id = [],                    %% 时装id
    attr = [],                          %% 属性
    index = 0,                          %% 序号
    res_id = 0                          %% 资源id
    }).


-define(REPLACE_FASHION_POS_SQL, 
    <<"REPLACE INTO `fashion_pos` (`role_id`, `pos_id`, `wear_fashion_id`, `wear_color_id`) VALUES (~p, ~p, ~p, ~p)">>).

-define(SELECT_FASHION_POS_SQL, 
    <<"SELECT `role_id`, `pos_id`, `wear_fashion_id`, `wear_color_id` FROM `fashion_pos` WHERE `role_id` = ~p">>).

-define(REPLACE_FASHION_INFO_SQL, 
    <<"REPLACE INTO `fashion_info` (`role_id`, `pos_id`, `fashion_id`, `color_id`, `color_list`) VALUES (~p, ~p, ~p, ~p, ~ts)">>).

% -define(REPLACE_FASHION_INFO_ALL_SQL, 
%     <<"REPLACE INTO `fashion_info` (`role_id`, `pos_id`, `fashion_id`, `color_id`, `color_list`, `suit_id`) VALUES ~s">>).

-define(SELECT_FASHION_INFO_SQL, 
    <<"SELECT `role_id`, `pos_id`, `fashion_id`, `color_id`, `color_list` FROM `fashion_info` WHERE `role_id` = ~p">>).

% -define(DELETE_FASHION_INFO_SQL, 
%     <<"DELETE FROM `fashion_info` WHERE `role_id` = ~p AND `pos_id` = ~p AND `fashion_id`= ~p">>).

-define(SELECT_ONE_FASHION_INFO_SQL, 
    <<"SELECT `color_id`, `color_list` FROM `fashion_info` WHERE `role_id` = ~p AND `pos_id` = ~p AND `fashion_id` = ~p">>).

-define(SELECT_FAHION_SUIT, 
    <<"SELECT `suit_id`, `suit_list`, `active` FROM `role_fashion_suit` WHERE `role_id` = ~p">>).

-define(REPLACE_INTO_FASHION_SUIT,
    <<"REPLACE INTO `role_fashion_suit` SET `role_id` = ~p, `suit_id` = ~p, `suit_list` = ~ts, `active` = ~p">>).