/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.arrebol.taxiservicios.beans.admin.driver;

import com.arrebol.taxiservicios.beans.TaxiGenericBean;
import com.arrebol.taxiservicios.beans.TicketSocioEconomicStudy;
import com.arrebol.taxiservicios.controller.admin.DriverController;
import com.arrebol.taxiservicios.controller.admin.SanctionController;
import com.arrebol.taxiservicios.controller.catalog.LocationController;
import com.arrebol.taxiservicios.controller.util.DateWrapper;
import com.arrebol.taxiservicios.model.admin.Document;
import com.arrebol.taxiservicios.model.admin.Reference;
import com.arrebol.taxiservicios.model.admin.Sanction;
import com.arrebol.taxiservicios.model.catalog.Holiday;
import com.arrebol.taxiservicios.model.catalog.Location;
import com.arrebol.taxiservicios.model.core.Address;
import com.arrebol.taxiservicios.model.core.ContactNumber;
import com.arrebol.taxiservicios.model.core.Person;
import com.arrebol.taxiservicios.model.core.User;
import com.arrebol.taxiservicios.model.dashboard.ToCollect;
import com.arrebol.taxiservicios.model.enums.AddressType;
import com.arrebol.taxiservicios.model.enums.DocumentType;
import com.arrebol.taxiservicios.model.enums.ExpenseStatusType;
import com.arrebol.taxiservicios.model.enums.PersonType;
import com.arrebol.taxiservicios.model.enums.PhoneType;
import com.arrebol.taxiservicios.model.enums.ReferenceType;
import com.arrebol.taxiservicios.model.enums.SanctionType;
import com.arrebol.taxiservicios.utils.ToCollectUtility;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Date;
import java.util.List;
import java.util.UUID;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.view.ViewScoped;
import javax.inject.Named;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.primefaces.event.FileUploadEvent;
import org.primefaces.model.UploadedFile;

/**
 *
 * @author Picasso
 */
@Named("driverAddBean")
@ViewScoped
public class DriverAddBean extends TaxiGenericBean implements Serializable {

    /**
     * Save/Update an taxi driver in the system.
     */
    public void addDriver() {
        logger.info("addDriver");
        try {

            if (estudio == 0D) {
                showMessage(FacesMessage.SEVERITY_WARN,
                        "Estudio socioeconómico",
                        "Debe de ser mayor a 0");
                return;
            }

            if (ingreso == 0D) {
                showMessage(FacesMessage.SEVERITY_INFO,
                        "Ingreso",
                        "Debe de ser mayor a 0");
                return;
            }
            String tmpDriverId = null;

            if (!isAddDriverBtnOnclick()) {
                tmpDriverId = UUID.randomUUID().toString();
                getDriver().setId(tmpDriverId);
                getDriver().setActive(true);
                getDriver().setRoot(false);
                getDriver().setCreatedOn(new Date());
                getDriver().setLocation(new Location(locationId));
                getDriver().setAjustador(Boolean.FALSE);
            } else {
                tmpDriverId = getDriver().getId();
                getDriver().setLastUpdatedOn(new Date());
            }                        

            boolean success = getController().addPerson(getDriver(), getLoggedUser().getUserName(), !isAddDriverBtnOnclick());

            if (success) {
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("driver.add.title"),
                        getBundlePropertyFile().getString("driver.add.success.desc"));

                Sanction sactionEstudio = new Sanction();
                sactionEstudio.setId(UUID.randomUUID().toString());
                sactionEstudio.setType(SanctionType.ESTUDIO);
                sactionEstudio.setPaymentDate(new Date());
                sactionEstudio.setPayment(estudio);
                sactionEstudio.setDescription("");
                Calendar calendar = Calendar.getInstance();
                calendar.add(Calendar.HOUR, -6);
                sactionEstudio.setCreatedOn(calendar.getTime());
                sactionEstudio.setLocation(getLoggedUser().getLocation());
                sactionEstudio.setStatus(ExpenseStatusType.AUTHORIZED);

                if (getSanctionController().addSanction(sactionEstudio, getLoggedUser().getId(), getDriver().getId())) {
                    showMessage(FacesMessage.SEVERITY_INFO,
                            "Estudio socioeconómico",
                            "Se creó correctamente");
                    estudio = 0D;
                }

                Sanction sactionIngreso = new Sanction();
                sactionIngreso.setId(UUID.randomUUID().toString());
                sactionIngreso.setType(SanctionType.ADD);
                sactionIngreso.setPaymentDate(new Date());
                sactionIngreso.setPayment(ingreso);
                sactionIngreso.setDescription("");
                Calendar calendar2 = Calendar.getInstance();
                calendar2.add(Calendar.HOUR, -6);
                sactionIngreso.setCreatedOn(calendar2.getTime());
                sactionIngreso.setLocation(getLoggedUser().getLocation());
                sactionIngreso.setStatus(ExpenseStatusType.AUTHORIZED);

                if (getSanctionController().addSanction(sactionIngreso, getLoggedUser().getId(), getDriver().getId())) {
                    showMessage(FacesMessage.SEVERITY_INFO,
                            "Ingreso",
                            "Se creó correctamente");
                    printTicket(sactionEstudio.getPayment(), sactionIngreso.getPayment());
                    ingreso = 0D;
                }
                /*
                if (!isAddDriverBtnOnclick()) {
                    List<Person> persons = new ArrayList<>();
                    Calendar startDate = Calendar.getInstance();

                    persons.add(new Person(tmpDriverId));
                    startDate.setTime(DateWrapper.today().addHours(-6).midnigthTime().asDate());

                    List<ToCollect> collects = prepareToCollectForActiveDriver(persons, startDate);

                    if (!getController().saveToCollect(collects)) {
                        showMessage(FacesMessage.SEVERITY_ERROR,
                                getBundlePropertyFile().getString("driver.add.title"),
                                getBundlePropertyFile().getString("driver.to.collect.fails.desc"));
                    }
                }
                 */

                setAddDriverBtnOnclick(true);
            } else {
                logger.error("Driver " + getDriver() + " was not " + (isAddDriverBtnOnclick() ? "updated" : "saved"));
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("driver.add.title"),
                        getBundlePropertyFile().getString("driver.add.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addDriver: " + e);
            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("driver.add.title"),
                    getBundlePropertyFile().getString("driver.add.exception.desc"));
        }
    }

    public void printTicket(Double socioEconomicStudy, Double amount) {
        TicketSocioEconomicStudy ticket = new TicketSocioEconomicStudy(getDriver().getFirstName() + " "
                + getDriver().getSecondName() + " " + getDriver().getLastName() + " " + getDriver().getMiddleName(),
                socioEconomicStudy.toString(), amount.toString());
        ticket.printTest();
        ticket.print();
    }

    /**
     * Add RFC, Email, CURP, and Local/Mobile phones to taxi driver.
     */
    public void addContactDetails() {
        logger.info("addContactDetails");
        try {
            if (!isAddContactBtnOnclick()) {
                getContactNumbers().stream().map((contactNumber) -> {
                    contactNumber.setId(UUID.randomUUID().toString());
                    return contactNumber;
                }).forEachOrdered((contactNumber) -> {
                    contactNumber.setPerson(getDriver());
                    contactNumber.setCreatedOn(new Date());
                });
            } else {
                getContactNumbers().forEach((phone) -> {
                    phone.setLastUpdatedOn(new Date());
                });
            }
            getDriver().setLastUpdatedOn(new Date());

            boolean success = getController().saveOrUpdatePersonContactDetailsById(
                    getDriver().getId(), getDriver().getCurp(),
                    getDriver().getRfc(), getDriver().getMail(),
                    getContactNumbers(), getLoggedUser().getUserName(),
                    !isAddContactBtnOnclick(), !isAddContactBtnOnclick());
            if (success) {
                setAddContactBtnOnclick(true);
                logger.info("Contact detais saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("person.add.contact.title"),
                        getBundlePropertyFile().getString("person.add.contact.success.desc"));
            } else {
                logger.error("Contact details can not be saved.");
                logger.error("Contact details: " + getDriver());
                logger.error("Numbers details: " + getContactNumbers());
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("person.add.contact.title"),
                        getBundlePropertyFile().getString("person.add.contact.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addContactDetails: " + e);

            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("person.add.contact.title"),
                    getBundlePropertyFile().getString("person.add.contact.exception.desc"));
        }
    }

    /**
     * Save an address(HOME) taxi driver details.
     *
     * @param formName
     */
    public void addAddress(String formName) {
        logger.info("addAddress");
        try {
            /*
            getAddress().setStreet(facesContext().getExternalContext().getRequestParameterMap().get(formName + ":streetHdn"));
            getAddress().setExtendedAddress(facesContext().getExternalContext().getRequestParameterMap().get(formName + ":colonyHdn"));
            getAddress().setLocality(facesContext().getExternalContext().getRequestParameterMap().get(formName + ":departmentHdn"));
            getAddress().setRegion(facesContext().getExternalContext().getRequestParameterMap().get(formName + ":stateHdn"));
            getAddress().setZipCode(facesContext().getExternalContext().getRequestParameterMap().get(formName + ":cpHdn"));
             */
            if (!isAddAddressBtnOnclick()) {
                getAddress().setId(UUID.randomUUID().toString());
                getAddress().setCreatedOn(new Date());
            } else {
                getAddress().setLastUpdatedOn(new Date());
            }

            boolean success = getController().saveOrUpdateAddress(getAddress(), !isAddAddressBtnOnclick(), getDriver().getId(), getLoggedUser().getUserName());

            if (success) {
                setAddAddressBtnOnclick(true);
                logger.info("Address detais saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("person.add.address.title"),
                        getBundlePropertyFile().getString("person.add.address.success.desc"));
            } else {
                logger.error("Address details not saved " + getAddress());
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("person.add.address.title"),
                        getBundlePropertyFile().getString("person.add.address.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addAddress: " + e);

            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("person.add.address.title"),
                    getBundlePropertyFile().getString("person.add.address.exception.desc"));
        }
    }

    /**
     *
     */
    public void addDriverCard() {
        logger.info("addDriverCard");
        try {
            boolean success = getController().updateDriverCardDetails(
                    getDriver().getIfe(), getDriver().getLicense(),
                    getDriver().getExpirationLicenseDate(),
                    getDriver().getId(), getLoggedUser().getId());

            if (success) {
                logger.info("Driver card detais saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddDriverCardBtnOnclick() ? "update" : "add")
                                + ".card.success.desc"));
                setAddDriverCardBtnOnclick(true);
            } else {
                logger.error("Driver card details not saved");
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddDriverCardBtnOnclick() ? "update" : "add")
                                + ".card.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addDriverCard: " + e);

            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("driver.card.title"),
                    getBundlePropertyFile().getString("driver."
                            + (isAddDriverCardBtnOnclick() ? "update" : "add")
                            + ".card.exception.desc"));
        }
    }

    public void addDriverAval() {
        logger.info("addDriverAval");
        try {
            boolean success = getController().updateDriverAvalDetails(
                    getDriver().getNameEndorsement(), getDriver().getParentescoEndorsement(),
                    getDriver().getPhoneEndorsement(),
                    getDriver().getId(), getLoggedUser().getId());

            if (success) {
                logger.info("Driver aval detais saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddDriverCardBtnOnclick() ? "update" : "add")
                                + ".card.success.desc"));
                setAddDriverCardBtnOnclick(true);
            } else {
                logger.error("Driver aval details not saved");
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddDriverCardBtnOnclick() ? "update" : "add")
                                + ".card.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addDriverAval: " + e);

            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("driver.card.title"),
                    getBundlePropertyFile().getString("driver."
                            + (isAddDriverCardBtnOnclick() ? "update" : "add")
                            + ".card.exception.desc"));
        }
    }

    /**
     * Save personal references from taxi driver.
     */
    public void addReferences() {
        logger.info("addReferences");
        try {
            if (!isAddReferenceBtnOnclick()) {
                getReferences().stream().map((Reference ref) -> {
                    ref.setId(UUID.randomUUID().toString());
                    return ref;
                }).forEachOrdered((Reference ref) -> {
                    ref.setPerson(new Person(getDriver().getId()));
                    ref.setCreatedBy(new User(getLoggedUser().getId(), ""));
                });
            } else {
                getReferences().forEach((Reference ref) -> {
                    ref.setLastUpdatedBy(new User(getLoggedUser().getId(), ""));
                });
            }

            boolean success = getController().saveOrUpdateReference(
                    getReferences(), !isAddReferenceBtnOnclick());

            if (success) {
                logger.info("Driver card references saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddReferenceBtnOnclick() ? "update" : "add")
                                + ".card.success.desc"));
                setAddReferenceBtnOnclick(true);
            } else {
                logger.error("Driver card references not saved");
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("driver.card.title"),
                        getBundlePropertyFile().getString("driver."
                                + (isAddReferenceBtnOnclick() ? "update" : "add")
                                + ".card.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("addReferences: " + e);

            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("driver.card.title"),
                    getBundlePropertyFile().getString("driver."
                            + (isAddReferenceBtnOnclick() ? "update" : "add")
                            + ".card.exception.desc"));
        }
    }

    /**
     *
     * @param event
     */
    public void handleFileUpload(FileUploadEvent event) {
        logger.info("handleFileUpload.");
        try {
            UploadedFile file = event.getFile();

            List<Document> documents = new ArrayList<Document>();

            getDocument().setPath(file.getContentType());
            getDocument().setFileName(file.getFileName());
            getDocument().setContent(file.getContents());

            if (!isAddPhotoBtnOnclick()) {
                getDocument().setId(UUID.randomUUID().toString());
                getDocument().setPerson(new Person(getDriver().getId()));
                getDocument().setCreatedBy(new User(getLoggedUser().getId(), ""));
            } else {
                getDocument().setLastUpdatedBy(new User(getLoggedUser().getId(), ""));
            }

            documents.add(getDocument());

            boolean success = getController().saveOrUpdatePhotos(documents, !isAddPhotoBtnOnclick());

            if (success) {
                setAddPhotoBtnOnclick(true);
                setPhotoName(getBundlePropertyFile().getString("document.title")
                        + " " + file.getFileName()
                        + " " + getBundlePropertyFile().getString("driver.document.add.success.desc"));

                logger.info("Driver photo saved.");
                showMessage(FacesMessage.SEVERITY_INFO,
                        getBundlePropertyFile().getString("person.add.photo.title"),
                        getBundlePropertyFile().getString("person.add.photo.success.desc"));
            } else {
                setPhotoName(getBundlePropertyFile().getString("document.title")
                        + " " + file.getFileName()
                        + " " + getBundlePropertyFile().getString("driver.document.add.fail.desc"));

                logger.error("Driver photo not saved " + getDocument());
                showMessage(FacesMessage.SEVERITY_ERROR,
                        getBundlePropertyFile().getString("person.add.photo.title"),
                        getBundlePropertyFile().getString("person.add.photo.fail.desc"));
            }
        } catch (Exception e) {
            logger.error("handleFileUpload: " + e);

            setPhotoName(getBundlePropertyFile().getString("document.exception.desc"));
            showMessage(FacesMessage.SEVERITY_FATAL,
                    getBundlePropertyFile().getString("person.add.photo.title"),
                    getBundlePropertyFile().getString("person.add.photo.exception.desc"));
        }
    }

    private List<ToCollect> prepareToCollectForActiveDriver(List<Person> drivers, Calendar startDate) {
        logger.info("prepareToCollectForActiveDriver");

        List<ToCollect> collects = new ArrayList<>();

        try {
            //Calendar startDate = Calendar.getInstance();
            Calendar endDate = Calendar.getInstance();

            //startDate.setTime(DateWrapper.today().addHours(-6).firstDateForMonth().midnigthTime().asDate());
            endDate.setTime(DateWrapper.today().addHours(-6).lastDateForMonth().midnigthTime().asDate());

            List<Holiday> holidays = getController().findHolidaysByRangeOfDates(
                    startDate.getTime(), endDate.getTime());

            List<Date> dates = ToCollectUtility.daysToCollect(holidays,
                    startDate.get(Calendar.DAY_OF_MONTH), endDate.get(Calendar.DAY_OF_MONTH));

            collects = ToCollectUtility.fillToCollects(
                    dates, drivers, new User(getLoggedUser().getId(), ""));
        } catch (Exception e) {
            logger.error(e);
        }

        return collects;
    }

    private static final long serialVersionUID = 6339867552734009276L;

    final Logger logger = LogManager.getLogger(DriverAddBean.class);

    private DriverController controller;
    private SanctionController sanctionController;
    private Person driver;
    private List<ContactNumber> contactNumbers;
    private Address address;
    private List<Reference> references;
    private List<ReferenceType> referenceTypes;
    private Document document;
    private String photoName;

    private boolean addDriverBtnOnclick;
    private boolean addContactBtnOnclick;
    private boolean addAddressBtnOnclick;
    private boolean addDriverCardBtnOnclick;
    private boolean addReferenceBtnOnclick;
    private boolean addPhotoBtnOnclick;

    private double ingreso;
    private double estudio;

    private Date sixteenYearsOld;

    private LocationController locationController;
    private String locationId;
    private List<Location> locations;

    @PostConstruct
    public void init() {
        logger.info("init");
        try {
            Calendar calendar = Calendar.getInstance();

            calendar.add(Calendar.YEAR, -15);
            setSixteenYearsOld(calendar.getTime());

            loadBundlePropertyFile();

            setController(new DriverController());
            setLocationController(new LocationController());
            setLocations(getLocationController().fillLocationDatatable());
            setSanctionController(new SanctionController());
            setDriver(new Person(PersonType.DRIVER));
            setAddress(new Address(AddressType.HOME));
            setDocument(new Document(DocumentType.SELFIE));

            getContactNumbers().add(new ContactNumber(PhoneType.HOME));
            getContactNumbers().add(new ContactNumber(PhoneType.MOBILE));
            getReferenceTypes().addAll(Arrays.asList(ReferenceType.values()));
            getReferences().add(new Reference());
            getReferences().add(new Reference());

            setAddDriverBtnOnclick(false);
            setAddContactBtnOnclick(false);
            setAddAddressBtnOnclick(false);
            setAddDriverCardBtnOnclick(false);
            setAddReferenceBtnOnclick(false);
            setAddPhotoBtnOnclick(false);
        } catch (Exception e) {
            logger.error("init", e);
        }
    }

    public LocationController getLocationController() {
        return locationController;
    }

    public void setLocationController(LocationController locationController) {
        this.locationController = locationController;
    }

    public String getLocationId() {
        return locationId;
    }

    public void setLocationId(String locationId) {
        this.locationId = locationId;
    }

    public List<Location> getLocations() {
        return locations;
    }

    public void setLocations(List<Location> locations) {
        this.locations = locations;
    }

    public SanctionController getSanctionController() {
        return sanctionController;
    }

    public void setSanctionController(SanctionController sanctionController) {
        this.sanctionController = sanctionController;
    }

    public double getIngreso() {
        return ingreso;
    }

    public void setIngreso(double ingreso) {
        this.ingreso = ingreso;
    }

    public double getEstudio() {
        return estudio;
    }

    public void setEstudio(double estudio) {
        this.estudio = estudio;
    }

    public DriverController getController() {
        return controller;
    }

    public void setController(DriverController controller) {
        this.controller = controller;
    }

    public Person getDriver() {
        return driver;
    }

    public void setDriver(Person driver) {
        this.driver = driver;
    }

    public List<ContactNumber> getContactNumbers() {
        if (null == contactNumbers) {
            contactNumbers = new ArrayList<ContactNumber>();
        }
        return contactNumbers;
    }

    public void setContactNumbers(List<ContactNumber> contactNumbers) {
        this.contactNumbers = contactNumbers;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public List<Reference> getReferences() {
        if (null == references) {
            references = new ArrayList<Reference>();
        }
        return references;
    }

    public void setReferences(List<Reference> references) {
        this.references = references;
    }

    public List<ReferenceType> getReferenceTypes() {
        if (null == referenceTypes) {
            referenceTypes = new ArrayList<ReferenceType>();
        }
        return referenceTypes;
    }

    public void setReferenceTypes(List<ReferenceType> referenceTypes) {
        this.referenceTypes = referenceTypes;
    }

    public Document getDocument() {
        return document;
    }

    public void setDocument(Document document) {
        this.document = document;
    }

    public String getPhotoName() {
        return photoName;
    }

    public void setPhotoName(String photoName) {
        this.photoName = photoName;
    }

    public boolean isAddDriverBtnOnclick() {
        return addDriverBtnOnclick;
    }

    public void setAddDriverBtnOnclick(boolean addDriverBtnOnclick) {
        this.addDriverBtnOnclick = addDriverBtnOnclick;
    }

    public boolean isAddContactBtnOnclick() {
        return addContactBtnOnclick;
    }

    public void setAddContactBtnOnclick(boolean addContactBtnOnclick) {
        this.addContactBtnOnclick = addContactBtnOnclick;
    }

    public boolean isAddAddressBtnOnclick() {
        return addAddressBtnOnclick;
    }

    public void setAddAddressBtnOnclick(boolean addAddressBtnOnclick) {
        this.addAddressBtnOnclick = addAddressBtnOnclick;
    }

    public boolean isAddDriverCardBtnOnclick() {
        return addDriverCardBtnOnclick;
    }

    public void setAddDriverCardBtnOnclick(boolean addDriverCardBtnOnclick) {
        this.addDriverCardBtnOnclick = addDriverCardBtnOnclick;
    }

    public boolean isAddReferenceBtnOnclick() {
        return addReferenceBtnOnclick;
    }

    public void setAddReferenceBtnOnclick(boolean addReferenceBtnOnclick) {
        this.addReferenceBtnOnclick = addReferenceBtnOnclick;
    }

    public Date getSixteenYearsOld() {
        return sixteenYearsOld;
    }

    public void setSixteenYearsOld(Date sixteenYearsOld) {
        this.sixteenYearsOld = sixteenYearsOld;
    }

    public boolean isAddPhotoBtnOnclick() {
        return addPhotoBtnOnclick;
    }

    public void setAddPhotoBtnOnclick(boolean addPhotoBtnOnclick) {
        this.addPhotoBtnOnclick = addPhotoBtnOnclick;
    }

}
