package com.platform.plugs.live.responseEntity;

import com.aliyuncs.vod.model.v20170321.GetTranscodeSummaryResponse;
import com.aliyuncs.vod.model.v20170321.GetTranscodeTaskResponse;
import com.aliyuncs.vod.model.v20170321.ListTranscodeTaskResponse;
import lombok.Data;

/**
 * @author MXY
 * 2019/12/3 19:10
 */
@Data
public class TranscodeTask {

    private String transcodeTaskId;

    private String videoId;

    private String taskStatus;

    private String transcodeTemplateGroupId;

    private String creationTime;

    private String completeTime;

    private String trigger;

    public static TranscodeTask parse(ListTranscodeTaskResponse.TranscodeTask source){

        TranscodeTask target = new TranscodeTask();

        target.setTranscodeTaskId(source.getTranscodeTaskId());
        target.setVideoId(source.getVideoId());
        target.setTaskStatus(source.getTaskStatus());
        target.setTranscodeTemplateGroupId(source.getTranscodeTemplateGroupId());
        target.setCreationTime(source.getCreationTime());
        target.setCompleteTime(source.getCompleteTime());
        target.setTrigger(source.getTrigger());

        return target;
    }

    public static TranscodeTask parse(GetTranscodeTaskResponse.TranscodeTask source){

        TranscodeTask target = new TranscodeTask();

        target.setTranscodeTaskId(source.getTranscodeTaskId());
        target.setVideoId(source.getVideoId());
        target.setTaskStatus(source.getTaskStatus());
        target.setTranscodeTemplateGroupId(source.getTranscodeTemplateGroupId());
        target.setCreationTime(source.getCreationTime());
        target.setCompleteTime(source.getCompleteTime());
        target.setTrigger(source.getTrigger());

        return target;
    }

    public static TranscodeTask parse(GetTranscodeSummaryResponse.TranscodeSummary source){

        TranscodeTask target = new TranscodeTask();

        target.setVideoId(source.getVideoId());
        target.setTaskStatus(source.getTranscodeStatus());
        target.setTranscodeTemplateGroupId(source.getTranscodeTemplateGroupId());
        target.setCreationTime(source.getCreationTime());
        target.setCompleteTime(source.getCompleteTime());
        target.setTrigger(source.getTrigger());

        return target;
    }
}
