/*
 * Copyright 2014 Open mHealth
 *
 * 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 org.openmhealth.dsu.domain;

import org.springframework.data.annotation.Id;

import javax.mail.internet.InternetAddress;
import java.time.OffsetDateTime;
import java.util.Optional;


/**
 * A user account.
 *
 * @author Emerson Farrugia
 */
public class User {

    private String username;
    private String password;
    private InternetAddress emailAddress;
    private String registrationKey;
    private OffsetDateTime registrationTimestamp;
    private OffsetDateTime activationTimestamp;

    @Id
    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public Optional<InternetAddress> getEmailAddress() {
        return Optional.ofNullable(emailAddress);
    }

    public void setEmailAddress(InternetAddress emailAddress) {
        this.emailAddress = emailAddress;
    }

    public String getRegistrationKey() {
        return registrationKey;
    }

    public void setRegistrationKey(String registrationKey) {
        this.registrationKey = registrationKey;
    }

    public OffsetDateTime getRegistrationTimestamp() {
        return registrationTimestamp;
    }

    public void setRegistrationTimestamp(OffsetDateTime registrationTimestamp) {
        this.registrationTimestamp = registrationTimestamp;
    }

    public Optional<OffsetDateTime> getActivationTimestamp() {
        return Optional.ofNullable(activationTimestamp);
    }

    public void setActivationTimestamp(OffsetDateTime activationTimestamp) {
        this.activationTimestamp = activationTimestamp;
    }
}

@@ -912,24 +912,28 @@
 ing password
+Hash
 ;%0A    privat
@@ -968,44 +968,8 @@
 ss;%0A
-    private String registrationKey;%0A
     
@@ -1017,56 +1017,8 @@
 amp;
-%0A    private OffsetDateTime activationTimestamp;
 %0A%0A  
@@ -1169,32 +1169,93 @@
 sername;%0A    %7D%0A%0A
+    /**%0A     * @return a hash of the user's password%0A     */%0A
     public Strin
@@ -1267,16 +1267,20 @@
 Password
+Hash
 () %7B%0A   
@@ -1291,32 +1291,36 @@
  return password
+Hash
 ;%0A    %7D%0A%0A    pub
@@ -1339,16 +1339,20 @@
 Password
+Hash
 (String 
@@ -1359,16 +1359,20 @@
 password
+Hash
 ) %7B%0A    
@@ -1388,16 +1388,20 @@
 password
+Hash
  = passw
@@ -1403,16 +1403,20 @@
 password
+Hash
 ;%0A    %7D%0A
@@ -1647,203 +1647,8 @@
  %7D%0A%0A
-    public String getRegistrationKey() %7B%0A        return registrationKey;%0A    %7D%0A%0A    public void setRegistrationKey(String registrationKey) %7B%0A        this.registrationKey = registrationKey;%0A    %7D%0A
 %0A   
@@ -1894,274 +1894,7 @@
    %7D
-%0A%0A    public Optional%3COffsetDateTime%3E getActivationTimestamp() %7B%0A        return Optional.ofNullable(activationTimestamp);%0A    %7D%0A%0A    public void setActivationTimestamp(OffsetDateTime activationTimestamp) %7B%0A        this.activationTimestamp = activationTimestamp;%0A    %7D
 %0A%7D%0A

Remove registration key and activation timestamp until they're required.