package com.jeequan.jeepay.core.model;

import com.alibaba.fastjson.JSON;
import lombok.Data;

@Data
public class DBOSSConfig {

    private String ossUseType;
    private String aliyunOssConfig;
    /** oss公共读文件地址 **/
    private String ossPublicSiteUrl;

    private AliyunOssConfigModel aliyunOssConfigModel;

    public AliyunOssConfigModel getAliyunOssConfigModel(){
        if(aliyunOssConfigModel != null){
            return aliyunOssConfigModel;
        }

        AliyunOssConfigModel parseObject = JSON.parseObject(this.aliyunOssConfig, AliyunOssConfigModel.class);
        this.aliyunOssConfigModel = parseObject;
        return parseObject;
    }

    @Data
    public static class AliyunOssConfigModel{
        private String endpoint;
        private String publicBucketName;
        private String privateBucketName;
        private String accessKeyId;
        private String accessKeySecret;
        private Long expireTime;
    }

}

