package com.atlassian.bitbucket.internal.importer;

import javax.annotation.Nonnull;

import static java.util.Objects.requireNonNull;

/**
 * Credentials for authenticating to the external repository source.
 */
public class Credential {

    private final String password;
    private final String username;

    private Credential(@Nonnull Builder builder) {
        password = builder.password;
        username = builder.username;
    }

    @Nonnull
    public String getPassword() {
        return password;
    }

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

    public static class Builder {
        private final String password;
        private final String username;

        public Builder(@Nonnull String username, @Nonnull String password) {
            this.username = requireNonNull(username, "username");
            this.password = requireNonNull(password, "password");
        }

        @Nonnull
        public Credential build() {
            return new Credential(this);
        }
    }
}
