/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.services.catalog;

import com.arrebol.taxiservicios.beans.TaxiGenericBean;
import com.arrebol.taxiservicios.controller.catalog.ServiceController;
import com.arrebol.taxiservicios.model.admin.Service;
import java.io.Serializable;
import java.util.List;
import javax.annotation.PostConstruct;
import javax.faces.view.ViewScoped;
import javax.inject.Named;

/**
 *
 * @author oscarvargas
 */
@Named("servicesService")
@ViewScoped
public class ServicesService extends TaxiGenericBean implements Serializable{
    
    public List<Service> fillDatatableService(String idLocation) {

        return serviceCtrl.fillServiceDatatableByLocation(idLocation);
    }

    public void saveServiceService(Service service) {

        serviceCtrl.saveService(service, getLoggedUser().getId());
    }

    public void deleteServiceService(Service service) {

        serviceCtrl.deleteService(service);
    }
    
    private static final long serialVersionUID = -8088380776089398390L;
    
    private ServiceController serviceCtrl;

    @PostConstruct
    public void init() {
        serviceCtrl = new ServiceController();
    }
}
