package com.swago.room.bean

import com.swago.baseswago.baseroom.IRoomInfo
import com.swago.baseswago.baseroom.RoleType
import com.swago.baseswago.baseroom.SwagoRoomManager
import com.swago.baseswago.model.MomentModel
import com.swago.baseswago.model.live.RoomModel

/**
 *@date 2021/10/11 14:29
 *description:
 */
class UserRoomModel :  IRoomInfo{

    var roomModel:RoomModel? = null

    var momentModel:MomentModel? = null

    override fun getAnchorName(): String {
        return roomModel?.user_name?:""
    }

    override fun getAnchorId(): String {
        return if (RoleType.user == SwagoRoomManager.roleType){
            momentModel?.id?:""
        }else{
            roomModel?.id?:""
        }
    }

    override fun getAnchorCode(): String {
        return roomModel?.user_account?:""
    }

    override fun getAnchorType(): Int {
        return roomModel?.anchor_type?:0
    }

    override fun getRoomId(): String {
        return if (RoleType.user == SwagoRoomManager.roleType){
            momentModel?.id?:""
        }else{
            roomModel?.id?:""
        }
    }

    override fun getRoomGroupId(): String {
        return roomModel?.im_group_id?:""
    }

    override fun getAgoraToken(): String {
        return roomModel?.rtc_token?:""
    }

    override fun getRoomCover(): String {
        return if (RoleType.user == SwagoRoomManager.roleType){
            momentModel?.user_head_img_url?:""
        }else{
            roomModel?.user_head_img_url?:""
        }
    }

    override fun getChannelName(): String {
        return if (RoleType.user == SwagoRoomManager.roleType){
            momentModel?.user_account?:""
        }else{
            roomModel?.user_account?:""
        }
    }

    override fun getRoomHot(): String {
        return roomModel?.broadcast_hot?:"0"
    }

    override fun getIsFollow(): Int {
        return roomModel?.is_follow?:0
    }

    override fun getRoomIncome(): String {
        return roomModel?.broadcast_income_coins?:"0"
    }

    override fun getGameUrl(): String {
        return roomModel?.game_url?:""
    }

    override fun getGameApiBaseUrl(): String {
        return roomModel?.game_api_url?:""
    }

    override fun getGameType(): Int {
        return roomModel?.game_type?:0
    }

    override fun getGameVersion(): Int {
        return roomModel?.game_version?:0
    }

    override fun getGameDownLoadUrl(): String {
        return roomModel?.game_down_url?:""
    }

    override fun getRoomSystemMsg(): String {
        return roomModel?.broadcast_notice_content?:""
    }

    override fun getIsRobot(): Boolean {
        return if (RoleType.user == SwagoRoomManager.roleType){
            momentModel?.is_robot?:0 == 1
        }else{
           false
        }
    }
}