// Copyright 2020 Oath Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.vespa.hosted.controller.api.integration.user;

import java.time.LocalDate;
import java.util.Objects;

/**
 * @author smorgrav
 */
public class User {

    public static final String ATTRIBUTE_NAME = "vespa.user.attributes";
    public static final LocalDate NO_LOGIN_DATE = LocalDate.ofEpochDay(0);

    private final String email;
    private final String name;
    private final String nickname;
    private final String picture;
    private final boolean isVerified;
    private final int loginCount;
    private final LocalDate lastLogin;

    public User(String email, String name, String nickname, String picture) {
        this.email = Objects.requireNonNull(email);
        this.name = name;
        this.nickname = nickname;
        this.picture = picture;
        this.isVerified = false;
        this.loginCount = -1;
        this.lastLogin = NO_LOGIN_DATE;
    }

    public User(String email, String name, String nickname, String picture, boolean isVerified, int loginCount, LocalDate lastLogin) {
        this.email = Objects.requireNonNull(email);
        this.name = name;
        this.nickname = nickname;
        this.picture = picture;
        this.isVerified = isVerified;
        this.loginCount = loginCount;
        this.lastLogin = lastLogin;
    }

    public String name() {
        return name;
    }

    public String email() {
        return email;
    }

    public String nickname() {
        return nickname;
    }

    public String picture() {
        return picture;
    }

    public LocalDate lastLogin() { return lastLogin; }

    public boolean isVerified() { return isVerified; }

    public int loginCount() { return loginCount; }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;
        User user = (User) o;
        return Objects.equals(name, user.name) &&
                Objects.equals(email, user.email) &&
                Objects.equals(nickname, user.nickname) &&
                Objects.equals(picture, user.picture) &&
                Objects.equals(lastLogin, user.lastLogin) &&
                loginCount == user.loginCount &&
                isVerified == user.isVerified;
    }

    @Override
    public int hashCode() {
        return Objects.hash(name, email, nickname, picture, lastLogin, loginCount, isVerified);
    }
}

@@ -381,30 +381,24 @@
 ocalDate NO_
-LOGIN_
 DATE = Local
@@ -406,21 +406,13 @@
 ate.
-ofEpochDay(0)
+EPOCH
 ;%0A%0A 
@@ -971,14 +971,8 @@
  NO_
-LOGIN_
 DATE

Use pre defined EPOC and rename no date