package bg.car_wash.areas.customer.entity;

import bg.car_wash.areas.car.entity.Car;

import javax.persistence.*;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

@Entity
@Table(name = "customers")
public class Customer {

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

	@Column(name = "name", nullable = false)
	@Size(min = 3, max = 100)
	private String name;

	@Column(name = "phone_number", nullable = false)
	@Size(min = 10, max = 15)
	private String phoneNumber;

	@Basic
	private Date date;

	@Basic
	private int discount;

	@OneToMany(targetEntity = Car.class, cascade = CascadeType.ALL, mappedBy = "owner")
	private List<Car> cars;

	public Customer() {
	}

	public Long getId() {
		return id;
	}

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

	public String getName() {
		return name;
	}

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

	public String getPhoneNumber() {
		return phoneNumber;
	}

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

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public int getDiscount() {
		return discount;
	}

	public void setDiscount(int discount) {
		this.discount = discount;
	}
}

@@ -1297,11 +1297,123 @@
 ount;%0A%09%7D
+%0A%0A%09public List%3CCar%3E getCars() %7B%0A%09%09return cars;%0A%09%7D%0A%0A%09public void setCars(List%3CCar%3E cars) %7B%0A%09%09this.cars = cars;%0A%09%7D
 %0A%7D%0A

add getter and setter