package com.palmnest.service.virtProject.manager.impl;

import com.palmnest.dao.estateserve.VirtualAccountDao;
import com.palmnest.model.estateserve.VirtualAccount;
import com.palmnest.service.impl.GenericManagerImpl;
import com.palmnest.service.virtProject.manager.VirtualAccountManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("virtualAccountManager")
public class VirtualAccountManagerImpl extends GenericManagerImpl<VirtualAccount, Long> implements VirtualAccountManager {

	private VirtualAccountDao virtualAccountDao;

	@Autowired
	public void setVirtualAccountDao(VirtualAccountDao virtualAccountDao) {
		this.virtualAccountDao = virtualAccountDao;
		this.dao = virtualAccountDao;
	}

	@Override
	public List<VirtualAccount> getVirAccountByVirId(int virId) {
		return virtualAccountDao.getVirAccountByVirId(virId);
	}

	@Override
	public List<VirtualAccount> getVirAccountByAccount(String orgId, String account,
													   String password) {
		return virtualAccountDao.getVirAccountByAccount(orgId, account, password);
	}

	@Override
	public void updateModel(VirtualAccount object) {
		virtualAccountDao.updateObj(object);
	}

	@Override
	public List<VirtualAccount> getVirAccountByVirIdIsEnable(int virId) {
		return virtualAccountDao.getVirAccountByVirIdIsEnable(virId);
	}

	@Override
	public VirtualAccount getVirtualAccountByName(String virAccount) {
		return virtualAccountDao.getVirtualAccountByName(virAccount);
	}

	public List<VirtualAccount> getVirAccByVirAndOrg(int virId, int orgId) {
		return virtualAccountDao.getVirAccByVirAndOrg(virId, orgId);
	}
}
