package ink.wgink.properties.media.video;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;

/**
 * When you feel like quitting. Think about why you started
 * 当你想要放弃的时候，想想当初你为何开始
 *
 * @ClassName: VideoProperties
 * @Description: 音频配置
 * @Author: WangGeng
 * @Date: 2021/6/8 22:18
 * @Version: 1.0
 **/
@Component
@ConfigurationProperties(prefix = "media.video")
public class VideoProperties {

    private String types;
    private Integer maxUploadCount;
    private Long backendMaxDuration;
    private Long appMaxDuration;

    public String getTypes() {
        return types == null ? "mp4" : types;
    }

    public void setTypes(String types) {
        this.types = types;
    }

    public Integer getMaxUploadCount() {
        return maxUploadCount == null || maxUploadCount <= 1 ? 1 : maxUploadCount;
    }

    public void setMaxUploadCount(Integer maxUploadCount) {
        this.maxUploadCount = maxUploadCount;
    }

    public Long getBackendMaxDuration() {
        return backendMaxDuration == null || backendMaxDuration <= 0 ? 0 : backendMaxDuration;
    }

    public void setBackendMaxDuration(Long backendMaxDuration) {
        this.backendMaxDuration = backendMaxDuration;
    }

    public Long getAppMaxDuration() {
        return appMaxDuration == null || appMaxDuration <= 0 ? 0 : appMaxDuration;
    }

    public void setAppMaxDuration(Long appMaxDuration) {
        this.appMaxDuration = appMaxDuration;
    }
}
