package de.jottyfan.camporganizer.module.confirmation.board.model;

import java.io.Serializable;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;

/**
 *
 * @author jotty
 *
 */
public class PersonBean implements Serializable {
	private static final long serialVersionUID = 1L;

	private String forename;
	private String surname;
	private String street;
	private String zip;
	private String city;
	private String phone;
	private String email;
	private LocalDate birthDate;
	private String camprole;
	private String progress;
	private LocalDateTime created;
	private String sex;
	private Double paid;
	private String comment;
	private Boolean consentCatalogPhoto;

	public String getAge(LocalDate relation) {
		if (relation == null) {
			return "?";
		} else {
			Period period = Period.between(birthDate, relation);
			Integer years = period == null ? null : period.getYears();
			return years == null ? "?" : years.toString();
		}
	}

	public String getCamprolle() {
		if ("student".equals(camprole)) {
			return "Teilnehmer";
		} else if ("teacher".equals(camprole)) {
			return "Mitarbeiter";
		} else if ("director".equals(camprole)) {
			return "Leitung";
		} else if ("feeder".equals(camprole)) {
			return "Küche";
		} else if ("observer".equals(camprole)) {
			return "Mitarbeiterkind";
		} else {
			return null;
		}
	}

	/**
	 * @return the forename
	 */
	public String getForename() {
		return forename;
	}

	/**
	 * @param forename the forename to set
	 */
	public void setForename(String forename) {
		this.forename = forename;
	}

	/**
	 * @return the surname
	 */
	public String getSurname() {
		return surname;
	}

	/**
	 * @param surname the surname to set
	 */
	public void setSurname(String surname) {
		this.surname = surname;
	}

	/**
	 * @return the street
	 */
	public String getStreet() {
		return street;
	}

	/**
	 * @param street the street to set
	 */
	public void setStreet(String street) {
		this.street = street;
	}

	/**
	 * @return the zip
	 */
	public String getZip() {
		return zip;
	}

	/**
	 * @param zip the zip to set
	 */
	public void setZip(String zip) {
		this.zip = zip;
	}

	/**
	 * @return the city
	 */
	public String getCity() {
		return city;
	}

	/**
	 * @param city the city to set
	 */
	public void setCity(String city) {
		this.city = city;
	}

	/**
	 * @return the phone
	 */
	public String getPhone() {
		return phone;
	}

	/**
	 * @param phone the phone to set
	 */
	public void setPhone(String phone) {
		this.phone = phone;
	}

	/**
	 * @return the email
	 */
	public String getEmail() {
		return email;
	}

	/**
	 * @param email the email to set
	 */
	public void setEmail(String email) {
		this.email = email;
	}

	/**
	 * @return the birthDate
	 */
	public LocalDate getBirthDate() {
		return birthDate;
	}

	/**
	 * @param birthDate the birthDate to set
	 */
	public void setBirthDate(LocalDate birthDate) {
		this.birthDate = birthDate;
	}

	/**
	 * @return the camprole
	 */
	public String getCamprole() {
		return camprole;
	}

	/**
	 * @param camprole the camprole to set
	 */
	public void setCamprole(String camprole) {
		this.camprole = camprole;
	}

	/**
	 * @return the created
	 */
	public LocalDateTime getCreated() {
		return created;
	}

	/**
	 * @param created the created to set
	 */
	public void setCreated(LocalDateTime created) {
		this.created = created;
	}

	/**
	 * @return the sex
	 */
	public String getSex() {
		return sex;
	}

	/**
	 * @param sex the sex to set
	 */
	public void setSex(String sex) {
		this.sex = sex;
	}

	/**
	 * @return the paid
	 */
	public Double getPaid() {
		return paid;
	}

	/**
	 * @param paid the paid to set
	 */
	public void setPaid(Double paid) {
		this.paid = paid;
	}

	/**
	 * @return the comment
	 */
	public String getComment() {
		return comment;
	}

	/**
	 * @param comment the comment to set
	 */
	public void setComment(String comment) {
		this.comment = comment;
	}

	/**
	 * @return the consentCatalogPhoto
	 */
	public Boolean getConsentCatalogPhoto() {
		return consentCatalogPhoto;
	}

	/**
	 * @param consentCatalogPhoto the consentCatalogPhoto to set
	 */
	public void setConsentCatalogPhoto(Boolean consentCatalogPhoto) {
		this.consentCatalogPhoto = consentCatalogPhoto;
	}

	/**
	 * @return the progress
	 */
	public String getProgress() {
		return progress;
	}

	/**
	 * @param progress the progress to set
	 */
	public void setProgress(String progress) {
		this.progress = progress;
	}
}
