/*
 * Copyright 2017 Terencio Agozzino
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package be.heh.dogcare.domain;

import java.sql.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.ForeignKey;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 * A base model class for appointment.
 *
 * @author Terencio Agozzino
 */
@Entity
@Table(name = "appointment")
public class Appointment {

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

    @Size(min = 10, max = 191)
    @NotNull
    private String comment;

    @NotNull
    private Date schedule;

    @ManyToOne
    @NotNull
    @JoinColumn(name = "appointment_type_id",
		foreignKey = @ForeignKey(name="fk_appointment_id_appointment_type"))
    private AppointmentType appointmentType;

    @ManyToOne
    @NotNull
    @JoinColumn(name = "customer_id",
		foreignKey = @ForeignKey(name="fk_appointment_id_customer"))
    private Customer customer;

    @ManyToOne
    @NotNull
    @JoinColumn(name = "doctor_id",
		foreignKey = @ForeignKey(name="fk_appointment_id_doctor"))
    private Doctor doctor;

    @ManyToOne
    @NotNull
    @JoinColumn(name = "room_id",
		foreignKey = @ForeignKey(name="fk_appointment_id_room"))
    private Room room;

    @ManyToOne
    @NotNull
    @JoinColumn(name = "secretary_id",
		foreignKey = @ForeignKey(name="fk_appointment_id_secretary"))
    private Secretary secretary;

    /**
     * Default constructor of the Appointment class.
     */
    public Appointment() { }

    /**
     * Main constructor of the Appointment class.
     *
     * @param customer the customer of the appointment
     * @param appointmentType the appointment type of the appointment
     * @param comment the comment of the appointment
     * @param schedule the schedule of the appointment
     * @param doctor the doctor of the appointment
     * @param room the room of the appointment
     * @param secretary the secretary of the appointment
     */
    public Appointment(Customer customer, AppointmentType appointmentType,
		       String comment, Date schedule, Doctor doctor, Room room,
		       Secretary secretary) {
	this.customer = customer;
	this.appointmentType = appointmentType;
	this.comment = comment;
	this.schedule = schedule;
	this.doctor = doctor;
	this.room = room;
	this.secretary = secretary;
    }

    /**
     * Gets the identifier of the appointment.
     *
     * @return the identifier of the appointment
     */
    public Long getId() { return id; }

    /**
     * Sets the identifier of the appointment.
     *
     * @param id the identifier of the appointment
     */
    public void setId(Long id) { this.id = id; }

    /**
     * Gets the comment of the appointment.
     *
     * @return the comment of the appointment
     */
    public String getComment() { return comment; }

    /**
     * Sets the comment of the appointment.
     *
     * @param comment the comment  of the appointment
     */
    public void setComment(String comment) { this.comment = comment; }

    /**
     * Gets the schedule of the appointment.
     *
     * @return the schedule of the appointment
     */
    public Date getSchedule() { return schedule; }

    /**
     * Sets the schedule of the appointment.
     *
     * @param schedule the schedule of the appointment
     */
    public void setSchedule(Date schedule) { this.schedule = schedule; }

    /**
     * Gets the type of the appointment.
     *
     * @return the type of the appointment
     */
    public AppointmentType getAppointmentType() { return appointmentType; }

    /**
     * Sets the type of the appointment.
     *
     * @param appointmentType the type of the appointment
     */
    public void setAppointmentType(AppointmentType appointmentType) { this.appointmentType = appointmentType; }

    /**
     * Gets the customer of the appointment.
     *
     * @return the customer of the appointment
     */
    public Customer getCustomer() { return customer; }

    /**
     * Sets the customer of the appointment.
     *
     * @param customer the customer of the appointment
     */
    public void setCustomer(Customer customer) { this.customer = customer; }

    /**
     * Gets the doctor of the appointment.
     *
     * @return the doctor of the appointment
     */
    public Doctor getDoctor() { return doctor; }

    /**
     * Sets the doctor of the appointment.
     *
     * @param doctor the doctor of the appointment
     */
    public void setDoctor(Doctor doctor) { this.doctor = doctor; }

    /**
     * Gets the room of the appointment.
     *
     * @return the room of the appointment
     */
    public Room getRoom() { return room; }

    /**
     * Sets the room of the appointment.
     *
     * @param room the room of the appointment
     */
    public void setRoom(Room room) { this.room = room; }

    /**
     * Gets the secretary of the appointment.
     *
     * @return the secretary of the appointment
     */
    public Secretary getSecretary() { return secretary; }

    /**
     * Sets the secretary of the appointment.
     *
     * @param secretary the secretary the appointment
     */
    public void setSecretary(Secretary secretary) { this.secretary = secretary; }
}
