package com.live.cases.largeClassLive;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.live.utils.TimeSetting;
import com.live.enums.ApiModele;
import com.live.enums.RequestType;
import com.live.enums.Terminal;
import com.live.utils.XMBaseTest;
import org.testng.Assert;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;

import java.util.ArrayList;

/**
 * @Author: zhangyumneg
 * @Date: 2020/11/12
 * @Description: 创建大班直播课
 */

public  class TestCreateBigLiveClass extends XMBaseTest {


    //private Object TimeSetting;

    @BeforeMethod
    public void beforeTest(){
        xmAppApi.setApiModule(ApiModele.CloudClass_B)
                .setApiName("API_createBigLiveCourse")
                .setLoginUser("zhangYuM_b")
                .setTerminal(Terminal.B);
        super.beforeTest();
    }


    @Test
    public void testCreateBigLiveCourse() {


        JSONObject jsonObject = new JSONObject();
        TimeSetting startTime = new TimeSetting();
        jsonObject.put("startTime", startTime.startTime());
        TimeSetting endTime = new TimeSetting();
        jsonObject.put("endTime", endTime.endTime());
        jsonObject.put("teacherId", "1323235986786807809");
        jsonObject.put("liveType", "LARGE_CLASS_LIVE");
        jsonObject.put("consumeHourNum", 1);
        jsonObject.put("consumeClassTime", 0);
        jsonObject.put("adminIds", new ArrayList<>());
        jsonObject.put("courseName", "自动化创建直播课");
        jsonObject.put("studentIds", new ArrayList<>());
        jsonObject.put("consumeStudentIds", new JSONArray());
        jsonObject.put("liveCourseMediaRequests", new JSONArray());
        jsonObject.put("needRecord", "YES");
        jsonObject.put("applyMode", "ANYONE");
        jsonObject.put("calendarTime", new JSONArray());
        jsonObject.getJSONArray("calendarTime").add("1605183968521");
        System.out.println("请求" + jsonObject);


        xmAppApi.doRequest(RequestType.JSON,params,jsonObject.toJSONString(),headers);

        JSONObject responseRes = xmAppApi.getBodyInJSON();
        Assert.assertNotNull(responseRes);
    }

}
