package com.example.computers.entity;

import jakarta.persistence.*;
import java.util.List;

@Entity
@Table(name = "location")
public class Location {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private String building;
    private String room;
    private String responsiblePerson;

    @OneToMany(mappedBy = "location")
    private List<Computer> computers;

    public Location() { }

    public Location(Long id, String building, String room, String responsiblePerson) {
        this.id = id;
        this.building = building;
        this.room = room;
        this.responsiblePerson = responsiblePerson;
    }

    public Long getId() { return id; }
    public void setId(Long id) { this.id = id; }

    public String getBuilding() { return building; }
    public void setBuilding(String building) { this.building = building; }

    public String getRoom() { return room; }
    public void setRoom(String room) { this.room = room; }

    public String getResponsiblePerson() { return responsiblePerson; }
    public void setResponsiblePerson(String responsiblePerson) { this.responsiblePerson = responsiblePerson; }

    public List<Computer> getComputers() { return computers; }
    public void setComputers(List<Computer> computers) { this.computers = computers; }

    @Override
    public String toString() {
        return building + " / " + room;
    }
}