package com.platform.plugs.live.responseEntity;

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

/**
 * @author MXY
 * 2019/12/31 14:10
 */
@Data
public class TranscodeJob {

    private String transcodeJobId;

    private String transcodeTaskId;

    private String transcodeTemplateId;

    private String transcodeJobStatus;

    private String creationTime;

    private String completeTime;

    private Long transcodeProgress;

    private String inputFileUrl;

    private String outputFileUrl;

    private String priority;

    private String errorCode;

    private String errorMessage;

    private String definition;

    private String format;

    private String width;

    private String height;

    private String duration;

    private String bitrate;

    private String fps;

    private Long fileSize;

    private String encryption;

    public static TranscodeJob parse(GetTranscodeTaskResponse.TranscodeTask.TranscodeJobInfo source) {

        TranscodeJob target = new TranscodeJob();

        target.setTranscodeJobId(source.getTranscodeJobId());
        target.setTranscodeTemplateId(source.getTranscodeTemplateId());
        target.setTranscodeJobStatus(source.getTranscodeJobStatus());
        target.setCreationTime(source.getCreationTime());
        target.setCompleteTime(source.getCompleteTime());
        target.setTranscodeProgress(source.getTranscodeProgress());
        target.setInputFileUrl(source.getInputFileUrl());
        target.setOutputFileUrl(source.getOutputFile().getOutputFileUrl());
        target.setPriority(source.getPriority());
        target.setErrorCode(source.getErrorCode());
        target.setErrorMessage(source.getErrorMessage());
        target.setDefinition(source.getDefinition());
        target.setFormat(source.getOutputFile().getFormat());
        target.setWidth(source.getOutputFile().getWidth());
        target.setDuration(source.getOutputFile().getDuration());
        target.setBitrate(source.getOutputFile().getBitrate());
        target.setFps(source.getOutputFile().getFps());
        target.setFileSize(source.getOutputFile().getFilesize());
        target.setEncryption(source.getOutputFile().getEncryption());

        return target;
    }

}
