import { Injectable } from '@angular/core';

import { Base } from '../base/base';

@Injectable()
export class EmployeeService extends Base
{
  public saveEmployee(params: any)
  {
    return this.api.post('v1/employees/saveEmployee', params);
  }

  public deleteEmployee(employeeId: number, employeeType: number)
  {
    const params: any = { employeeId: employeeId, employeeType: employeeType };
    return this.api.post('v1/employees/deleteEmployee', params);
  }

  public updateEmployeeRole(employeeId: number, employeeType: number)
  {
    const params: any = { employeeId: employeeId, employeeType: employeeType };
    return this.api.post('v1/employees/updateEmployeeRole', params);
  }

  public removeEmployeeRole(employeeId: number, employeeType: number)
  {
    const params: any = { employeeId: employeeId, employeeType: employeeType };
    return this.api.post('v1/employees/removeEmployeeRole', params);
  }

  public getEmployee(employeeId: number)
  {
    const params: any = { employeeId: employeeId };
    return this.api.post('v1/employees/getEmployee', params);
  }

  public getEmployees(params: any)
  {
    return this.api.post('v1/employees/getEmployees', params);
  }

  public getEmployeesBasic(params: any)
  {
    return this.api.post('v1/employees/getEmployeesBasic', params);
  }

  public getEmployeeByCode(employeeType: number, code: string)
  {
    const params: any = { code: code, employeeType: employeeType, };
    return this.api.post('v1/employees/getEmployeeByCode', params);
  }

  public getEmployeesBySearch(employeeType: number, criteria: string, status: number = 8)
  {
    const params: any = { employeeType: employeeType, status: status, criteria: criteria };
    return this.api.post('v1/employees/getEmployeesBySearch', params);
  }
}
