package library.model;

import javax.validation.constraints.Pattern;
import javax.validation.constraints.Size;

import org.hibernate.validator.constraints.NotEmpty;

public class LibraryItem {
	private int id = -1;
	@NotEmpty(message = "Pealkiri on kohustuslik")
	@Size(max = 255, message = "Pealkiri peab olema lühem kui 255 märki")
	private String title;
	@Pattern(regexp = "[0-9]+", message = "Aasta peab olema positiivne täisarv")  
	private String year="0";
	@Size(max = 50, message = "Pealkiri peab olema lühem kui 50 märki")
	private String type;
	@Size(max = 50, message = "Pealkiri peab olema lühem kui 50 märki")
	private String genre;
	@Size(max = 255, message = "Pealkiri peab olema lühem kui 255 märki")
	private String author;
	@Size(max = 1000, message = "Pealkiri peab olema lühem kui 1000 märki")
	private String comment;
	
	public LibraryItem () {}
	
	public LibraryItem (int id, String title, String author, String genre, String type, String year, String comment) {
		this.id = id;
		this.title = title;
		this.author = author;
		this.genre = genre;
		this.type = type;
		this.year = year;
		this.comment = comment;
	}
	
	public int getId() {
		return id;
	}
	public void setId(int id) {
		this.id = id;
	}
	public String getTitle() {
		return title;
	}
	public void setTitle(String title) {
		this.title = title;
	}
	public String getYear() {
		return year;
	}
	public void setYear(String year) {
		this.year = year;
	}
	public String getType() {
		return type;
	}
	public void setType(String type) {
		this.type = type;
	}
	public String getGenre() {
		return genre;
	}
	public void setGenre(String genre) {
		this.genre = genre;
	}
	public String getAuthor() {
		return author;
	}
	public void setAuthor(String author) {
		this.author = author;
	}
	public String getComment() {
		return comment;
	}
	public void setComment(String comment) {
		this.comment = comment;
	}
}
