package com.pas.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.pas.dao.ParkingPlaceDao;
import com.pas.model.ParkingPlace;
import com.pas.model.User;
import com.pas.service.ParkingPlaceService;

@Service
public class ParkingPlaceServiceImpl implements ParkingPlaceService {
	@Autowired
	ParkingPlaceDao parkingPlaceDao;

	@Transactional
	public void add(ParkingPlace parkingPlace) {
		parkingPlaceDao.add(parkingPlace);
	}
	
	@Transactional
	public void edit(ParkingPlace parkingPlace) {
		parkingPlaceDao.edit(parkingPlace);
	}
	
	@Transactional
	public void delete(int parkingPlaceId) {
		parkingPlaceDao.delete(parkingPlaceId);
	}
	
	@Transactional
	public ParkingPlace getParkingPlace(int parkingPlaceId) {
		return (ParkingPlace) parkingPlaceDao.getParkingPlace(parkingPlaceId);
	}
	
	@Transactional
	public List<ParkingPlace> getAllParkingPlace() {
		return (List<ParkingPlace>) parkingPlaceDao.getAllParkingPlace();
	}

	@Transactional
	public List<ParkingPlace> getParkingPlaceByUser(User user) {
		return (List<ParkingPlace>) parkingPlaceDao.getAllParkingPlace();
	}
}