package com.nisum.helper;

import com.nisum.model.Employee;
import com.nisum.model.impl.EmployeeImp;
import com.nisum.model.impl.JobRoleImp;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.stream.Collectors;

@Component
public class EmployeeHelper {
  public EmployeeImp createSoftwareEngineerEmployee(String fName, String lName) {
    EmployeeImp employeeImp = new EmployeeImp();
    employeeImp.setFirstName(fName);
    employeeImp.setLastName(lName);
    employeeImp.setJobRole(new JobRoleImp("Software Engineer"));
    return employeeImp;
  }

  public void displayTeam(List<Employee> employeeList) {
    String techTeam = employeeList.stream().map(employee ->
        String.format("%s - %s", employee.getDisplayName(), employee.getJobRole().getTitle())).collect(Collectors.joining("\n"));
    System.out.println(techTeam);
  }
}
