package com.example.springip.lab3.dto;

import com.example.springip.lab3.models.Company;
import com.example.springip.lab3.models.Employee;
import com.example.springip.lab3.models.Position;

import java.util.List;
import java.util.Set;

public class EmployeeDto {
    private Long Id;
    private String name;
    private String phoneNumber;
    private String surname;
    private List<PositionDto> positions;

    private CompanyWithoutEmpDto company;

    public EmployeeDto(Employee employee) {
        Id = employee.getId();
        this.name = employee.getName();
        this.phoneNumber = employee.getPhoneNumber();
        this.surname = employee.getSurname();
        this.positions = employee.getPositions().stream().map(PositionDto::new).toList();
        this.company = employee.getCompany() != null ? new CompanyWithoutEmpDto(employee.getCompany()) : null;
    }

    public EmployeeDto() {
    }

    public Long getId() {
        return Id;
    }

    public String getName() {
        return name;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public String getSurname() {
        return surname;
    }

    public List<PositionDto> getPositions() {
        return positions;
    }

    public CompanyWithoutEmpDto getCompany() {
        return company;
    }

    public void setName(String name) {
        this.name = name;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }

    public void setSurname(String surname) {
        this.surname = surname;
    }
}
