package com.atlassian.stash.internal.web.auth;

import com.atlassian.bitbucket.validation.annotation.FieldEquals;
import com.atlassian.bitbucket.validation.annotation.RequiredString;
import org.apache.commons.lang3.StringUtils;
import org.hibernate.validator.constraints.Email;

@FieldEquals(fields = {"password", "confirmPassword"}, reportingField = "confirmPassword", message = "{com.atlassian.bitbucket.validation.passwords.notequals.message}")
public class UserForm {
    private String username;
    private String password;
    private String confirmPassword;
    private String fullname;
    private String email;

    @RequiredString(size = 255)
    public String getUsername() {
        return username;
    }

    @RequiredString(size = 255)
    public String getPassword() {
        return password;
    }

    @RequiredString(size = 255)
    public String getConfirmPassword() {
        return confirmPassword;
    }

    @RequiredString(size = 255)
    public String getFullname() {
        return fullname;
    }

    @RequiredString(size = 255) @Email
    public String getEmail() {
        return email;
    }

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

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

    public void setConfirmPassword(String confirmPassword) {
        this.confirmPassword = confirmPassword;
    }

    public void setFullname(String fullname) {
        this.fullname = fullname;
    }

    public void setEmail(String email) {
        this.email = email;
    }

}
