package org.aegee.runanddine.registration;

import org.aegee.runanddine.RunAndDineApplication;
import org.aegee.runanddine.util.model.Model;

/**
 * Model for persistent SingleRegistrations
 * TODO: streetNo als String: z.B. Hugendubelstraße 77b im moment nur kacke machbar
 * @author s_wolff
 */
public class SingleRegistration extends Model {

    /**
     * Manager for SingleRegistrations
     */
    public static final SingleRegistrationManager OBJECTS = SingleRegistrationManager.getInstance();
    private static final long serialVersionUID = 1L;

    /**
     * ID of RunAndDine the SingleRegistration is related to
     */
    private int runAndDineId; // set on add to database

    /**
     * Set ID of RunAndDine the SingleRegistration is related to
     * @param runAndDineId ID of related RunAndDine
     */
    public void setRunAndDineId(int runAndDineId) {
        this.runAndDineId = runAndDineId;
    }

    /**
     * Get ID of RunAndDine the SingleRegistration is related to
     * @return ID of related RunAndDine
     */
    public int getRunAndDineId() {
        return runAndDineId;
    }
    // personal information
    private String firstName, lastName, email, phone;
    // address
    private String streetName, city, addressAddition, postalCode;
    private Integer streetNo;
    // additional information
    private String allergies, comment, validationToken;
    private boolean kitchenAvailable, accommodation, vegetarian, isValidated, tvAllowed;

    public SingleRegistration() {
        this.isValidated = false;
        this.kitchenAvailable = true;
        this.tvAllowed = true;
    }

    public SingleRegistration(String firstName, String lastName, String email,
            String phone, String street, String city, String addressAddition,
            Integer houseNo, String postalCode, String allergies,
            String annotation, String validationToken, boolean kitchenAvailable,
            boolean accommodation, boolean vegetarian, boolean isValidated, boolean tvAllowed) {
        this.firstName = firstName;
        this.lastName = lastName;
        this.email = email;
        this.phone = phone;
        this.streetName = street;
        this.city = city;
        this.addressAddition = addressAddition;
        this.streetNo = houseNo;
        this.postalCode = postalCode;
        this.allergies = allergies;
        this.comment = annotation;
        this.validationToken = validationToken;
        this.kitchenAvailable = kitchenAvailable;
        this.accommodation = accommodation;
        this.vegetarian = vegetarian;
        this.isValidated = isValidated;
        this.tvAllowed = tvAllowed;
    }

    /**
     * Debug output
     */
    public void debug() {
        RunAndDineApplication.debug(
                "\nfirstName:        " + this.firstName
                + "\nlastName:         " + this.lastName
                + "\nemail:            " + this.email
                + "\nphone:            " + this.phone
                + "\nstreetName:       " + this.streetName
                + "\ncity:             " + this.city
                + "\naddressAddition:  " + this.addressAddition
                + "\nstreetNo:         " + this.streetNo
                + "\npostalCode:       " + this.postalCode
                + "\nallergies:        " + this.allergies
                + "\ncomment:          " + this.comment
                + "\nvalidationToken:  " + this.validationToken
                + "\nkitchenAvailable: " + this.kitchenAvailable
                + "\naccommodation:    " + this.accommodation
                + "\nvegetarian:       " + this.vegetarian
                + "\nisValidated:      " + this.isValidated);
    }

    @Override
    public String toString() {
        return this.firstName + " " + this.lastName + " - " + this.email;
    }

    /**
     * Get address addition for kitchen
     * @return Address addition
     */
    public String getAddressAddition() {
        return addressAddition;
    }

    /**
     * Get allergies of participant
     * @return Allergies
     */
    public String getAllergies() {
        return allergies;
    }

    /**
     * Get city for kitchen
     * @return City
     */
    public String getCity() {
        return city;
    }

    /**
     * Get comment of the participant
     * @return Comment
     */
    public String getComment() {
        return comment;
    }

    /**
     * Get email of the participant
     * @return Email
     */
    public String getEmail() {
        return email;
    }

    /**
     * Get first name of the participant
     * @return First name
     */
    public String getFirstName() {
        return firstName;
    }

    /**
     * Get last name of the participant
     * @return Last name
     */
    public String getLastName() {
        return lastName;
    }

    /**
     * Get phone number of the participant
     * @return Phone number
     */
    public String getPhone() {
        return phone;
    }

    /**
     * Get postal code of kitchen
     * @return Postal code
     */
    public String getPostalCode() {
        return postalCode;
    }

    /**
     * Get street name of kitchen
     * @return Street name
     */
    public String getStreetName() {
        return streetName;
    }

    /**
     * Get street number of kitchen
     * @return Street number
     */
    public Integer getStreetNo() {
        return streetNo;
    }

    /**
     * Get validation token for participant
     * @return Validation token
     */
    public String getValidationToken() {
        return validationToken;
    }

    /**
     * Check whether participant needs accomodation
     * @return Accomodation needed
     */
    public boolean isAccommodation() {
        return accommodation;
    }

    /**
     * Check whether SingleRegistration is validated
     * @return SingleRegistration is validated
     */
    public boolean isIsValidated() {
        return isValidated;
    }

    /**
     * Check whether participant has kitchen
     * @return Participant has kitchen
     */
    public boolean isKitchenAvailable() {
        return kitchenAvailable;
    }

    /**
     * Check whether participant is vegetarian
     * @return Participant is vegetarian
     */
    public boolean isVegetarian() {
        return vegetarian;
    }

    /**
     * Set whether participant needs accomodation
     * @param accommodation Accomodation needed
     */
    public void setAccommodation(boolean accommodation) {
        this.accommodation = accommodation;
    }

    /**
     * Set address addition of kitchen
     * @param adressAddition Address addition to be set
     */
    public void setAddressAddition(String adressAddition) {
        this.addressAddition = adressAddition;
    }

    /**
     * Set allergies of participant
     * @param allergies Allergies to be set
     */
    public void setAllergies(String allergies) {
        this.allergies = allergies;
    }

    /**
     * Set city of kitchen
     * @param city City to be set
     */
    public void setCity(String city) {
        this.city = city;
    }

    /**
     * Set comment of participant
     * @param comment Comment to be set
     */
    public void setComment(String comment) {
        this.comment = comment;
    }

    /**
     * Set email of participant
     * @param email Email to be set
     */
    public void setEmail(String email) {
        this.email = email;
    }

    /**
     * Set first name of participant
     * @param firstName First name to be set
     */
    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    /**
     * Set whether SingleRegistration is validated
     * @param isValidated SingleRegistration is validated
     */
    public void setIsValidated(boolean isValidated) {
        this.isValidated = isValidated;
    }

    /**
     * Set whether participant has kitchen
     * @param kitchenAvailable Participant has kitchen
     */
    public void setKitchenAvailable(boolean kitchenAvailable) {
        this.kitchenAvailable = kitchenAvailable;
    }

    /**
     * Set last name of participant
     * @param lastName Last name to be set
     */
    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    /**
     * Set phone number of participant
     * @param phone Phone number to be set
     */
    public void setPhone(String phone) {
        this.phone = phone;
    }

    /**
     * Set postal code of kitchen
     * @param postalCode Postal code to be set
     */
    public void setPostalCode(String postalCode) {
        this.postalCode = postalCode;
    }

    /**
     * Set street name of kitchen
     * @param streetName Street name to be set
     */
    public void setStreetName(String streetName) {
        this.streetName = streetName;
    }

    /**
     * Set street number of kitchen
     * @param streetNo Street number to be set
     */
    public void setStreetNo(Integer streetNo) {
        this.streetNo = streetNo;
    }

    /**
     * Set validation token for SingleRegistration
     * @param validationToken Validation token to be set
     */
    public void setValidationToken(String validationToken) {
        this.validationToken = validationToken;
    }

    /**
     * Set whether participant is vegetarian
     * @param vegetarian Participant is vegetarian
     */
    public void setVegetarian(boolean vegetarian) {
        this.vegetarian = vegetarian;
    }

    /**
     * Set whether participant allows a tv team to enter his home and/or film him
     * @param tvAllowed 
     */
    public void setTvAllowed(boolean tvAllowed) {
        this.tvAllowed = tvAllowed;
    }

    /**
     * Check wheather participant allows a tv team to enter his home and/or film him
     * @return 
     */
    public boolean isTvAllowed() {
        return tvAllowed;
    }
}
