package gov.va.med.esr.common.model.party;

import java.math.BigDecimal;
import java.util.Date;

import org.apache.commons.lang.builder.ToStringBuilder;

import gov.va.med.fw.model.AbstractKeyedEntity;

import gov.va.med.esr.common.model.lookup.EmailSourceOfChange;
import gov.va.med.esr.common.model.lookup.EmailType;
import gov.va.med.esr.common.model.lookup.VAFacility;
import gov.va.med.esr.common.model.person.Person;

public class Email
    extends AbstractKeyedEntity
{
	private static final long serialVersionUID = 3923439702711246149L;
    private Person person;
    private EmailType type = null;
    private String address = null;
    private VAFacility siteOfChange;
    private EmailSourceOfChange sourceOfChange;
    private Date changeDate;

    /**
     * Creates a new Email object.
     */
    public Email()
    {
        super();
    }

    //----------------------------------------------------------------------------
    // Public method(s)
    //----------------------------------------------------------------------------

    public EmailType getType()
    {
        return this.type;
    }

    public void setType(EmailType type)
    {
        this.type = type;
    }

    public EmailSourceOfChange getSourceOfChange() {
        return this.sourceOfChange;
    }
    
    public void setSourceOfChange(EmailSourceOfChange sourceOfChange) {
        this.sourceOfChange = sourceOfChange;
    }
    
    public VAFacility getSiteOfChange() {
        return this.siteOfChange;
    }
    
    public void setSiteOfChange(VAFacility site) {
        this.siteOfChange = site;
    }
        
    
    public Date getChangeDate() {
        return this.changeDate;
    }

    public void setChangeDate(Date changeDate) {
        this.changeDate = changeDate;
    }

    public String getAddress()
    {
        return this.address;
    }

    public void setAddress(String address)
    {
        this.address = address;
    }
    
    public void setPerson(Person person) 
    {
        validateOwner(this.person, person);
        this.person = person;
    }
    
    public Person getPerson() {
        return person;
    }
    
    /*
     * (non-Javadoc)
     * 
     * @see gov.va.med.fw.model.AbstractKeyedEntity#buildToString(org.apache.commons.lang.builder.ToStringBuilder)
     */
    protected void buildToString(ToStringBuilder builder)
    {
        super.buildToString(builder);

        builder.append("type", this.type);
        builder.append("address", this.address);
        builder.append("changeDate", this.changeDate);
   }
}
