package com.atlassian.stash.internal.rest.user.json;

import com.atlassian.bitbucket.validation.annotation.FieldEquals;
import com.atlassian.bitbucket.validation.annotation.RequiredString;
import org.codehaus.jackson.annotate.JsonProperty;
import org.codehaus.jackson.map.annotate.JsonSerialize;

@JsonSerialize
@FieldEquals(fields = {"password", "passwordConfirm"}, reportingField = "passwordConfirm", message = "{com.atlassian.bitbucket.validation.passwords.notequals.message}")
class PasswordUpdate {
    @JsonProperty
    private final String password;
    @JsonProperty
    private final String passwordConfirm;

    // for Jackson
    protected PasswordUpdate() {
        this(null, null);
    }

    public PasswordUpdate(String password, String passwordConfirm) {
        this.password = password;
        this.passwordConfirm = passwordConfirm;
    }

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

    @RequiredString(size = 255)
    public String getPasswordConfirm() {
        return passwordConfirm;
    }
}
