package org.ssssssss.magicapi.datasource.model;

import lombok.Data;
import org.ssssssss.magicapi.core.model.MagicEntity;

@Data
public class DataSourceInfo extends MagicEntity {

	/**
	 * databaseName
	 */
	private String databaseName;
	/**
	 * URL
	 */
	private String url;

	/**
	 * 用户名
	 */
	private String username;

	/**
	 * 密码
	 */
	private String password;

	/**
	 * 数据源key
	 */
	private String key;

	/**
	 * 最多返回条数
	 */
	private int maxRows = -1;

	/**
	 * 驱动类
	 */
	private String driverClassName;

	/**
	 * 连接池类型
	 */
	private String type;



	@Override
	public MagicEntity simple() {
		DataSourceInfo dataSourceInfo = new DataSourceInfo();
		super.simple(dataSourceInfo);
		dataSourceInfo.setKey(this.key);
		return dataSourceInfo;
	}

	@Override
	public MagicEntity copy() {
		DataSourceInfo dataSourceInfo = new DataSourceInfo();
		super.copyTo(dataSourceInfo);
		dataSourceInfo.setUsername(this.username);
		dataSourceInfo.setPassword(this.password);
		dataSourceInfo.setUrl(this.url);
		dataSourceInfo.setDriverClassName(this.driverClassName);
		dataSourceInfo.setType(this.type);
		dataSourceInfo.setMaxRows(this.maxRows);
		dataSourceInfo.setKey(this.key);
		return dataSourceInfo;
	}
}
