package com.capgemini.reports.database.javabean;

import java.io.Serializable;
import java.sql.Timestamp;

import com.capgemini.framework.common.DateHelper;

import lombok.Getter;
import lombok.Setter;
import lombok.ToString;

/** Persisted object in table REP_USER. **/
@Getter
@Setter
@ToString
public class DbReportOwner implements Serializable, IPersistedObject {

    /** Required by serialization. **/
    private static final long serialVersionUID = 4697006911693586324L;

    /** Unique identifier recommended for using all features from Hibernate. **/
    private Long id;

    /** User ID: must be unique in database. **/
    private Long userId;

    /** Report Id: must be unique in database. **/
    private Long reportId;

    /** Date of the last connection of the user, matching with the last LDAP data synchronization. **/
    private Timestamp requestDate;

    /** Technical field only for filtering for statistics. **/
    private String monthPeriod;

    /**
     * Override of the lombok setter.
     * 
     * @param aTimestamp Set value
     **/
    public void setRequestDate(final Timestamp aTimestamp) {
        requestDate = aTimestamp;
        setMonthPeriod(DateHelper.getMonthPeriod());
    }

    /** JAVA convention requires an empty constructor for each JAVA bean. **/
    public DbReportOwner() {
        // Nothing to see, move along...
    }
}
