package com.platform.modules.live.dto;

import com.aliyuncs.http.MethodType;
import lombok.Data;

import java.util.Map;
import java.util.Optional;

/**
 * @Description: ali 请求 dto
 * @Author: yikaihong
 * @CreateDate: 2019/1/19 14:25
 * @Version: 1.0
 */
@Data
public class AliRequestDto {


    private String regionId;
    private String accessKeyId;
    private String secret;

    private MethodType methodType;
    private String version;
    private String domain;

    private Map<String,Object> requestParams;
    private String action;


    public AliRequestDto(String regionId, String accessKeyId, String secret, MethodType methodType, String version, String domain, Map<String, Object> requestParams, String action) {
        this.regionId = Optional.ofNullable(regionId).orElse("cn-shanghai");
        this.accessKeyId = Optional.ofNullable(accessKeyId).orElse("LTAIRon7x0qHIhdy");
        this.secret = Optional.ofNullable(secret).orElse("X9AqFQ526j9bjv2fqcdz8KQ5GGzP3A");
        this.version = Optional.ofNullable(version).orElse("2016-11-01");
        this.domain = Optional.ofNullable(domain).orElse("live.aliyuncs.com");
        this.methodType = methodType;
        this.requestParams = requestParams;
        this.action = action;
    }

    public AliRequestDto(MethodType methodType, Map<String, Object> requestParams, String action) {
        this.regionId = Optional.ofNullable(regionId).orElse("cn-shanghai");
        this.accessKeyId = Optional.ofNullable(accessKeyId).orElse("LTAIRon7x0qHIhdy");
        this.secret = Optional.ofNullable(secret).orElse("X9AqFQ526j9bjv2fqcdz8KQ5GGzP3A");
        this.version = Optional.ofNullable(version).orElse("2016-11-01");
        this.domain = Optional.ofNullable(domain).orElse("live.aliyuncs.com");
        this.methodType = methodType;
        this.requestParams = requestParams;
        this.action = action;
    }

}