package com.aksenov.monitor.data;

import jakarta.persistence.*;
import jakarta.validation.constraints.Email;
import lombok.Data;

@Entity
@Data
@Table(name = "Customer")

public class Customer extends AbstractEntity {

    private String name;
    @Email
    private String email;

    @ManyToOne(cascade = CascadeType.DETACH)
    @JoinColumn(name = "city_id", nullable = false)
    private City city;

    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public City getCity() {
        return city;
    }
    public void setCityID(City cityID) {
        this.city = cityID;
    }

    public String getCityName() {
        return city.getName();
    }
}
