package database.dataset;

import java.io.Serializable;
import java.sql.Date;

/**
 * @author alexis
 * dataset de la table reservation
 */
public class Reservation implements Serializable {
	/**
	 * 
	 */
	private static final long serialVersionUID = 4457748160475754530L;
	private int reservation_p_id;
	private int chambre_fk_id;
	private Date reservation_debut;
	private Date reservation_fin;
	private String reservation_commentaire;
	private int status_fk_id;
	private final String NOM_TABLE = "reservation";

	/**************************************************************************
	 * constructeur
	 *************************************************************************/
	
	public Reservation(int reservation_p_id, int chambre_fk_id,
					   Date reservation_debut, Date reservation_fin, String reservation_commentaire, int status_fk_id) {
		this.reservation_p_id = reservation_p_id;
		this.chambre_fk_id = chambre_fk_id;
		this.reservation_debut = reservation_debut;
		this.reservation_fin = reservation_fin;
		this.reservation_commentaire = reservation_commentaire;
		this.status_fk_id = status_fk_id;
	}
	
	/**************************************************************************
	 * getter
	 *************************************************************************/

	/**
	 * @return the reservation_p_id
	 */
	public int getReservation_p_id() {
		return reservation_p_id;
	}

	/**
	 * @return the chambre_fk_id
	 */
	public int getChambre_fk_id() {
		return chambre_fk_id;
	}

	/**
	 * @return the reservation_debut
	 */
	public Date getReservation_debut() {
		return reservation_debut;
	}

	/**
	 * @return the reservation_fin
	 */
	public Date getReservation_fin() {
		return reservation_fin;
	}

	/**
	 * @return the reservation_commentaire
	 */
	public String getReservation_commentaire() {
		return reservation_commentaire;
	}
	
	/**
	 * Retourne le nom de la table
	 * @return NOM_TABLE
	 */
	public String getNomTable()
	{
		return NOM_TABLE;		
	}
	
	/**************************************************************************
	 * setter
	 *************************************************************************/

	/**
	 * @return the status_fk_id
	 */
	public int getStatus_fk_id() {
		return status_fk_id;
	}

	/**
	 * @param reservation_p_id the reservation_p_id to set
	 */
	public void setReservation_p_id(int reservation_p_id) {
		this.reservation_p_id = reservation_p_id;
	}

	/**
	 * @param chambre_fk_id the chambre_fk_id to set
	 */
	public void setChambre_fk_id(int chambre_fk_id) {
		this.chambre_fk_id = chambre_fk_id;
	}

	/**
	 * @param reservation_debut the reservation_debut to set
	 */
	public void setReservation_debut(Date reservation_debut) {
		this.reservation_debut = reservation_debut;
	}

	/**
	 * @param reservation_fin the reservation_fin to set
	 */
	public void setReservation_fin(Date reservation_fin) {
		this.reservation_fin = reservation_fin;
	}

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

	/**
	 * @param status_fk_id the status_fk_id to set
	 */
	public void setStatus_fk_id(int status_fk_id) {
		this.status_fk_id = status_fk_id;
	}
	
	/**************************************************************************
	 * object
	 *************************************************************************/

	/* (non-Javadoc)
	 * @see java.lang.Object#toString()
	 */
	@Override
	public String toString() {
		return "reservation [reservation_p_id=" + reservation_p_id
				+ ", chambre_fk_id=" + chambre_fk_id + ", reservation_debut="
				+ reservation_debut + ", reservation_fin=" + reservation_fin
				+ ", reservation_commentaire=" + reservation_commentaire
				+ ", status_fk_id=" + status_fk_id + "]";
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#hashCode()
	 */
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + chambre_fk_id;
		result = prime
				* result
				+ ((reservation_commentaire == null) ? 0
						: reservation_commentaire.hashCode());
		result = prime
				* result
				+ ((reservation_debut == null) ? 0 : reservation_debut
						.hashCode());
		result = prime * result
				+ ((reservation_fin == null) ? 0 : reservation_fin.hashCode());
		result = prime * result + reservation_p_id;
		result = prime * result + status_fk_id;
		return result;
	}

	/* (non-Javadoc)
	 * @see java.lang.Object#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Reservation other = (Reservation) obj;
		if (chambre_fk_id != other.chambre_fk_id)
			return false;
		if (reservation_commentaire == null) {
			if (other.reservation_commentaire != null)
				return false;
		} else if (!reservation_commentaire
				.equals(other.reservation_commentaire))
			return false;
		if (reservation_debut == null) {
			if (other.reservation_debut != null)
				return false;
		} else if (!reservation_debut.equals(other.reservation_debut))
			return false;
		if (reservation_fin == null) {
			if (other.reservation_fin != null)
				return false;
		} else if (!reservation_fin.equals(other.reservation_fin))
			return false;
		if (reservation_p_id != other.reservation_p_id)
			return false;
		if (status_fk_id != other.status_fk_id)
			return false;
		return true;
	}
}