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

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

@JsonSerialize
public class UserPasswordUpdate extends PasswordUpdate {
    @JsonProperty
    private final String oldPassword;

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

    public UserPasswordUpdate(String oldPassword, String password, String passwordConfirm) {
        super(password, passwordConfirm);
        this.oldPassword = oldPassword;
    }

    @RequiredString(size = 255)
    public String getOldPassword() {
        return oldPassword;
    }

    public static final UserPasswordUpdate EXAMPLE = new UserPasswordUpdate("faithless", "secret", "secret");
}
