local C2S = {}

local function SendData(data)
    local jsonConvert = require("Base/json.lua")

    data.uid = CS.LuaSocketManager.GenerateUid(0x00)
    require("Network/NetworkQueue.lua"):PushUidOnSend(data.uid)

    local message = jsonConvert:encode(data)

    print("----> C2S: message:", message)
    CS.LuaSocketManager.Send(message)
end

function C2S:HeartBeat()
    -- todo for test 
    local nTimeNow, _ = require("Base/Utils.lua"):TimeNow()

    local data = {
        ["msgType"] = "HEARTBEAT",
        ["uid"]     = nTimeNow
    }
    SendData(data)
end

function C2S:EnterMeeting(meetingId, tel, szNick)
    -- todo for test 
    local nTimeNow, _ = require("Base/Utils.lua"):TimeNow()

    local data = {
        ["msgType"] = "JOIN_MEETING_REQ",
        ["uid"]     = nTimeNow,
        ["data"]    = {
            ["meetingId"] = meetingId,
            ["telephone"] = tel,
            ["nickName"]  = szNick
        }
    }
    SendData(data)
end


function C2S:GetScreenInfo(meetingId)
    -- todo for test 
    local nTimeNow, _ = require("Base/Utils.lua"):TimeNow()

    local data = {
        ["msgType"] = "MEETING_SCREEN_REQ",
        ["uid"]     = nTimeNow,
        ["data"]    = {
            ["meetingId"] = meetingId,
        }
    }
    SendData(data)
end

return C2S