package com.bocloud.cmp.model;

import com.alibaba.fastjson.JSONObject;
import com.bocloud.common.model.BocloudResult;

import java.util.List;

/**
 * 云管家通用类
 *
 * @author weiwei
 */
public class Butler {
	private String username;
	private String password;
	private String accessKey;
	private String secretKey;
	private String regions;
	private String tenant;
	private String url;
	private String uuid;// 云平台uuid
	private String name;// 云平台名称
	private String category;// 云平台类型，暂时取aliyun,openstask,jd,vmware,fusionCloud
	private String domainName;
	private String projectName;
	private String projectId;
	private String version;
	private String regionId;
	private List<HostModel> servers;
	private Boolean isPublic;
	private String subscriptionId;// 订阅ID(azure)
	private String clientId;// 应用程序(客户端)ID(azure)
	private String token; // k8s token
	private Integer gatewayPort; // ceph 网关服务器端口
	private String gatewayUsername; // ceph 网关服务器用户名
	private String gatewayPassword; // ceph 网关服务器密码
	private String proxyHost; // bulter http代理服务器ip地址
	private Integer proxyPort; // bulter http代理服务器端口号
	private String enrollmentNumber;// Azure合约编号

	private String proxyUri;
	private String domainId;

	public Butler() {
	}

	public Butler(String category) {
		super();
		this.category = category;
	}

	public Butler(String name, String uuid, String username, String password, String accessKey, String secretKey,
			String regions, String tenant, String url, String category, String domainName, String projectName,
			String version, List<HostModel> servers, String regionId) {
		super();
		this.name = name;
		this.uuid = uuid;
		this.username = username;
		this.password = password;
		this.accessKey = accessKey;
		this.secretKey = secretKey;
		this.regions = regions;
		this.tenant = tenant;
		this.url = url;
		this.category = category;
		this.domainName = domainName;
		this.projectName = projectName;
		this.version = version;
		this.servers = servers;
		this.regionId = regionId;
	}

	public static BocloudResult<Butler> convert(String config) {
		try {
			Butler butler = JSONObject.parseObject(config, Butler.class);
			return new BocloudResult<Butler>(true, butler, "success");
		} catch (Exception e) {
			return new BocloudResult<>(false, e.getMessage());
		}
	}

	/**
	 * @return the version
	 */
	public String getVersion() {
		return version;
	}

	/**
	 * @param version the version to set
	 */
	public void setVersion(String version) {
		this.version = version;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param name the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @return the uuid
	 */
	public String getUuid() {
		return uuid;
	}

	/**
	 * @param uuid the uuid to set
	 */
	public void setUuid(String uuid) {
		this.uuid = uuid;
	}

	/**
	 * @return the username
	 */
	public String getUsername() {
		return username;
	}

	/**
	 * @param username the username to set
	 */
	public void setUsername(String username) {
		this.username = username;
	}

	/**
	 * @return the password
	 */
	public String getPassword() {
		return password;
	}

	/**
	 * @param password the password to set
	 */
	public void setPassword(String password) {
		this.password = password;
	}

	/**
	 * @return the accessKey
	 */
	public String getAccessKey() {
		return accessKey;
	}

	/**
	 * @param accessKey the accessKey to set
	 */
	public void setAccessKey(String accessKey) {
		this.accessKey = accessKey;
	}

	/**
	 * @return the secretKey
	 */
	public String getSecretKey() {
		return secretKey;
	}

	/**
	 * @param secretKey the secretKey to set
	 */
	public void setSecretKey(String secretKey) {
		this.secretKey = secretKey;
	}

	/**
	 * @return the regions
	 */
	public String getRegions() {
		return regions;
	}

	/**
	 * @param regions the regions to set
	 */
	public void setRegions(String regions) {
		this.regions = regions;
	}

	/**
	 * @return the tenant
	 */
	public String getTenant() {
		return tenant;
	}

	/**
	 * @param tenant the tenant to set
	 */
	public void setTenant(String tenant) {
		this.tenant = tenant;
	}

	/**
	 * @return the url
	 */
	public String getUrl() {
		return url;
	}

	/**
	 * @param url the url to set
	 */
	public void setUrl(String url) {
		this.url = url;
	}

	/**
	 * @return the category
	 */
	public String getCategory() {
		return category;
	}

	/**
	 * @param category the category to set
	 */
	public void setCategory(String category) {
		this.category = category;
	}

	@Override
	public String toString() {
		return JSONObject.toJSONString(this);
	}

	public String getDomainName() {
		return domainName;
	}

	public void setDomainName(String domainName) {
		this.domainName = domainName;
	}

	public String getProjectName() {
		return projectName;
	}

	public void setProjectName(String projectName) {
		this.projectName = projectName;
	}

	/**
	 * @return the projectId
	 */
	public String getProjectId() {
		return projectId;
	}

	/**
	 * @param projectId the projectId to set
	 */
	public void setProjectId(String projectId) {
		this.projectId = projectId;
	}

	/**
	 * @return the regionId
	 */
	public String getRegionId() {
		return regionId;
	}

	/**
	 * @param regionId the regionId to set
	 */
	public void setRegionId(String regionId) {
		this.regionId = regionId;
	}

	public List<HostModel> getServers() {
		return servers;
	}

	public void setServers(List<HostModel> servers) {
		this.servers = servers;
	}

	public Boolean getIsPublic() {
		return isPublic;
	}

	public void setIsPublic(Boolean isPublic) {
		this.isPublic = isPublic;
	}

	public Boolean getPublic() {
		return isPublic;
	}

	public void setPublic(Boolean aPublic) {
		isPublic = aPublic;
	}

	public String getSubscriptionId() {
		return subscriptionId;
	}

	public void setSubscriptionId(String subscriptionId) {
		this.subscriptionId = subscriptionId;
	}

	public String getClientId() {
		return clientId;
	}

	public void setClientId(String clientId) {
		this.clientId = clientId;
	}

	public String getToken() {
		return token;
	}

	public void setToken(String token) {
		this.token = token;
	}

	public Integer getGatewayPort() {
		return gatewayPort;
	}

	public void setGatewayPort(Integer gatewayPort) {
		this.gatewayPort = gatewayPort;
	}

	public String getGatewayUsername() {
		return gatewayUsername;
	}

	public void setGatewayUsername(String gatewayUsername) {
		this.gatewayUsername = gatewayUsername;
	}

	public String getGatewayPassword() {
		return gatewayPassword;
	}

	public void setGatewayPassword(String gatewayPassword) {
		this.gatewayPassword = gatewayPassword;
	}

	public String getProxyHost() {
		return proxyHost;
	}

	public void setProxyHost(String proxyHost) {
		this.proxyHost = proxyHost;
	}

	public Integer getProxyPort() {
		return proxyPort;
	}

	public void setProxyPort(Integer proxyPort) {
		this.proxyPort = proxyPort;
	}

	public String getEnrollmentNumber() {
		return enrollmentNumber;
	}

	public void setEnrollmentNumber(String enrollmentNumber) {
		this.enrollmentNumber = enrollmentNumber;
	}

	public String getProxyUri() {
		return proxyUri;
	}

	public void setProxyUri(String proxyUri) {
		this.proxyUri = proxyUri;
	}

	public String getDomainId() {
		return domainId;
	}

	public void setDomainId(String domainId) {
		this.domainId = domainId;
	}

}
