package com.example.springip.lab3.dto;

import com.example.springip.lab3.models.Company;
import com.example.springip.lab3.models.Employee;
import com.fasterxml.jackson.annotation.JsonProperty;

import java.util.ArrayList;
import java.util.List;

public class CompanyDto {
    private Long Id;
    private String name;
    private List<EmployeeDto> employees;

    public CompanyDto(Company company) {
        Id = company.getId();
        this.name = company.getName();
        this.employees = company.getEmployees().stream().map(EmployeeDto::new).toList();
    }

    public CompanyDto() {

    }

    @JsonProperty(access = JsonProperty.Access.READ_ONLY)
    public Long getId() {
        return Id;
    }

    public String getName() {
        return name;
    }

    public List<EmployeeDto> getEmployees() {
        return employees;
    }


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

}
