package cn.com.qmth.examcloud.core.questions.service;

import cn.com.qmth.examcloud.core.questions.service.config.UpYunProperty;
import main.java.com.UpYun;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.UUID;

@Service
public class UpYunService {
    protected static final Logger log = LoggerFactory.getLogger(UpYunService.class);

    public static final String TEMP_FILE_EXP = "docxExport/";

    @Autowired
    private UpYunProperty upYunProperty;

    public UpYun getInstance() {
        UpYun upyun = new UpYun(upYunProperty.getBucketName(), upYunProperty.getUserName(), upYunProperty.getPassword());
        upyun.setDebug(true);
        upyun.setTimeout(15);
        upyun.setApiDomain(UpYun.ED_AUTO);
        return upyun;
    }

    public String randomUUID() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

}