export const MSG_CODE_LEN = 8;
export const MAX_PRIVATE_MSGS = 99;
export const JEWEL_PUSH_LV = 7;

export const MSG_STATUS = {
    NORMAL: 0,
    BLOCKED: 1
}

export const MSG_TYPE = {
    TEXT: 0,
    RICH_TEXT: 1,
    IMG: 2
}

export const CHANNEL_PREFIX = {
    SYS: 'sys',
    WORLD: 'world',
    GUILD: 'guild',
    GVG: 'gvg',    // 战区
    TEAM: 'com_btl_team',
    CITY: 'city',      // 军团活动，诸侯混战，按城池分channel
    GUILD_AUCTION: 'g_auction', // 军团拍卖
    WORLD_AUCTION: 'w_auction', // 军团拍卖
    GROUP_SHOP: 'groupShop', // 团购页面
    GVG_AREAS: 'gvgAreas', // 大地图界面
    GVG_AREA_BY_TEAM: 'gvgTeam', // 选中玩家队伍后加入频道
    GVG_CITY: 'gvgCity', // 玩家进入城池
    LEAGUE: 'league', // 联军
}

export const getChannelType = function(prefix: string) {
    switch(prefix) {
        case CHANNEL_PREFIX.SYS:
            return 1;
        case CHANNEL_PREFIX.WORLD:
            return 2;
        case CHANNEL_PREFIX.GUILD:
            return 3;
        case CHANNEL_PREFIX.TEAM:
            return 4;
        case 'private':
            return 5;
        case CHANNEL_PREFIX.GVG:
            return 6;
        case CHANNEL_PREFIX.LEAGUE:
            return 7;
    }
}

export const getSdkChannelId = function(prefix: string) {
    switch(prefix) {
        case CHANNEL_PREFIX.WORLD:
            return 1;
        case CHANNEL_PREFIX.GUILD:
            return 4;
        case CHANNEL_PREFIX.TEAM:
            return 3;
        case 'private':
            return 2;
    }
}

// 消息来源
export const MSG_SOURCE = {
    ROLE_SEND_TEXT: 0,
    PRIVATE_SEND_GIFT: 1,
    TEAM_ROLE: 2,
    HERO_QUALITY_UP: 3,
    GET_ORANGE_HERO: 4,
    HERO_STAR_MAX: 5,
    GUILD_NOTICE: 6,
    GUILD_STRUCTURE_LV_UP: 7,
    GUILD_TRAIN_SUC: 8,
    GUILD_BOSS_SUC: 9,
    EQUIP_REFINE_SUC: 10,
    EQUIP_COMPOSE_SUIT: 11,
    EQUIP_COMPOSE_ORANGE: 12,
    JEWEL_COMPOSE: 13,
    ORANGE_BLUEPRT_COMPOSE: 14,
    TOWER_SUC: 15,
    MYSTERY_FIRST_SUC: 16,
    VESTIGE_FIRST_SUC: 17,
    TEAM_INVITE: 18,
    HERO_WAKE_UP: 19,
    EQUIP_REFRESH_BEST: 20,
    ACQUIRE_RARE_GOODS: 21,
    GROUP_SEND_GIFT: 22,
    SEND_MARQUEE: 23,
    GUILD_RECURIT: 24,
    EQUIP_STAR_UP: 25,
    EQUIP_QUALITY_UP: 26,
    LADDER_FIRST_CHANGE: 27,
    GET_UR_HERO: 28,
    GVG_RECURIT: 29,
    GVG_LV_UP: 30,
    GVG_NOTICE: 31,
    GVG_TECH_ACTIVATE: 32,
    GVG_TECH_UNLOCK: 33,
    GVG_VESTIGE_ACCOUNT: 34,
    GVG_OCCUPY_CITY: 35,
}

export const DEFAULT_MSG_PER_PAGE = 10;


export const PUSH_ROUTE = {
    PRIVATE_MSG: 'onPrivateMessage',
    GROUP_MSG: 'onGroupMessage',
    ADD_CHANNEL: 'onAddChannel',
    LEAVE_CHANNEL: 'onLeaveChannel',
    GUILD_ACTIVITY_STATUS: 'onGuildActivityStatus',
    RANK_TOP_UPDATE: 'onRankTopUpdated',
    MAILS_ADD: 'onMailsAdd',
    SERVER_MAINTENANCE: 'onServerMaintenance',
    PUSH_CURRENT_TIME: 'onPushCurrentTime',
    AUCTION_OVER: 'onAuctionOver',
    AUCTION_UPDATE: 'onAuctionUpdate',
    AUCTION_ADD: 'onAuctionAdd',
    DIVIDEND_UPDATE: 'onDividendsUpdate',
    DIVIDEND_ADD: 'onDividendsAdd',
    MEMBER_QUIT: 'onMemberQuit',
    DISMISS: 'onDismiss',
    GUILD_INFO_UPDATE: 'onGuildInfoUpdate',
    DEMOTION: 'onDemotion',
    PROMOTION: 'onPromotion',
    GUILD_REC_ADD: 'onGuildRecAdd',
    GUILD_BOSS_OPEN: 'onGuildBossStatus',
    RACE_START: 'onRaceStart',
    GATE_ACT_RANK: 'onGuildGateRankUpdate',    // 军团活动排行榜
    CITY_ACT_RANK: 'onGuildCityRankUpdate',    // 军团活动排行榜
    GUILD_GATE_ACT_HP: 'onGuildGateHpUpdate',   // 军团活动蛮夷入侵排行榜
    GUILD_ACTIVITY_END: 'onGuildActivityEnd',    // 军团活动结束
    GUILD_CITY_DECLARE: 'onGuildCityDeclare',    // 有军团对这个城池进行宣战了
    GUILD_CITY_ACT_HP: 'onGuildCityGateHpUpdate', // 诸侯入侵城门血条
    GUILD_RACE_UPDATE: 'onRaceHorseUpdate',   /// 更新木牛流马
    GUILD_RACE_JOIN: 'onRaceHorseJoin',
    GUILD_RACE_EVENT: 'onRaceEventUpdate',   /// 更新木牛流马
    GUILD_TRAIN_RESET: 'onGuildTainReset', // 试炼场重置
    GUILD_BOSS_ENCOURAGE: 'onGuildBossEncourage', // 鼓舞
    ACTIVITY_UPDATE: 'onActivityUpdate',
    TEAM_JOIN: 'onTeamJoin',
    TEAM_DISMISS: 'onTeamDismiss',
    TEAMMATE_READY: 'onTeammateReady',
    LEAVE_TEAM: 'onLeaveTeam',
    COMBATTLE_START: 'onComBtlStart',
    TEAM_COMPLETE: 'onTeamComplete',
    TEAMMATE_ACT: 'onTeammateAct',
    PLAYER_EXP_CHANGE: 'onPlayerExpChange',
    GUILD_INVITE: 'onGuildInvite',
    WISH_GOODS_RECEIVE: 'onWishGoodsRecive',
    FRIEND_APPLY: 'onFriendApply',
    FRIEND_ADD: 'onFriendAdd',
    FRIEND_SEND_HEART: 'onFriendSendHeart',
    SET_BLACK: 'onSetBlack',
    PLAY_TIME: 'onPlayTime',
    DAILY_TASK_REFRESH: 'onDailyTaskRefresh',
    AP_UPDATE: 'onApUpdate',
    ENTRY_DATA: 'onEntryData',
    ENTRY_DATA_START: 'onEntryDataStart',
    ENTRY_DATA_END: 'onEntryDataEnd',
    REFRESH_TIME: 'onRefreshTime',
    REMOTE_LOGIN: 'onRemoteLogin',
    SEND_EVENT: 'onSpecialEvent',
    BOSS_HP_UPDATE: 'onBossHpUpdate',
    MEMBER_JOIN_GUILD: 'onMemberJoinGuild',
    PLAYER_DATA_CHANGE: 'onPlayerDataChange',
    ORDER: 'onOrder',
    PLAYER_CE_UPDATE: 'onPlayerCeUpdate',
    RACE_ITEM_UPDATE: 'onRaceItemUpdate',
    HERO_SKIN_CHANGE: 'onHeroSkinChange',
    HERO_UPDATE: 'onHeroUpdate',
    ITEM_UPDATE: 'onItemUpdate',
    JEWEL_DEL: 'onJewelDel',
    JEWEL_ADD: 'onJewelAdd',
    ARTIFACT_DEL: 'onArtifactDel',
    ARTIFACT_ADD: 'onArtifactAdd',
    HEAD_CHANGE: 'onHeadChange',
    TASK_UPDATE: 'onTaskUpdate',
    ACTIVITY_TASK_UPDATE: 'onActivityTaskUpdate',
    TASK_BOX_REFRESH: 'onTaskBoxRefresh',
    UPDATE_SURVEY: 'onUpdateSurvey',
    DELETE_SURVEY: 'onDeleteSurvey',
    LADDER_CHECK_STOP: 'onLadderCheckStop',
    LADDER_BATTLE_STOP: 'onLadderBattleStop',
    LADDER_RANK_UPDATE: 'onLadderRankUpdate',
    GROUP_SHOP_UPDATE: 'onGroupShopUpdate',
    HIDDEN_DATA: 'onHiddenData',
    LEAGUE_APPLY: 'onLeagueApply',       // 当联军收到军团申请
    LEAGUE_INVITE: 'onLeagueInvite',     // 当联军收到军团邀请
    LEAGUE_KICK: 'onKickedByLeague',     // 当被踢出
    LEAGUE_DISSMISS: 'onLeagueDismiss',  // 当联军解散
    LEAGUE_ABDICATE: 'onLeagueAbdicate', // 当被转让盟主
    LEAGUE_ITEM_UPDATE: 'onLeagueItemUpdate',
    LEAGUE_TECH_CHANGE : 'onGVGTechChange', // 千机阁科技变更
    LEAGUE_TECH_UNLOCK: 'onGVGTechUnlock', // 千机阁科技解锁
    LEAGUE_TECH_ACITVE: 'onGVGTechActive', // 千机阁科技激活
    GVG_TASK_UPDATE: 'onGVGTaskUpdate', // GVG任务更新
    GVG_TEAM_ATTACKED: 'onTeamAttacked', // 当队伍受到攻击
    GVG_MY_TEAM_ATTACKED: 'onMyTeamAttacked', // 当队伍受到攻击
    GVG_AREA_SPINE_CHANGE: 'onAreaSpinesChange', // 可见区域内spine的变动，每隔5秒会下发
    GVG_AREA_POINT_CHANGE: 'onMyAreaPointChange', // 积分点上的驻守人变更
    GVG_PLAYER_AREA_ADD: 'onPlayerAddToArea', // 积分点上的驻守人变更
    GVG_PLAYER_LEAVE_AREA: 'onPlayerLeaveArea', // 积分点上的驻守人变更
    GVG_CITY_RANK_UPDATE: 'onGVGCityRankUpdate', // 城池积分排名
    GVG_SPINE_ATTACKED: 'onSpinesAttacked', // 4.7 队伍在地图上受到攻击
}