package com.atlassian.webdriver.bitbucket.page;

import com.atlassian.pageobjects.elements.ElementBy;
import com.atlassian.webdriver.bitbucket.element.RepositoryTable;
import com.atlassian.webdriver.bitbucket.element.UserRepositoryTable;

import java.util.List;
import java.util.Locale;

public class UserProfileRepositoriesTabPage extends BitbucketPage {

    @ElementBy(id = "repositories-table", pageElementClass = UserRepositoryTable.class)
    private UserRepositoryTable repositoriesTable;

    private String username;

    public UserProfileRepositoriesTabPage(String username) {
        this.username = username;
    }

    @Override
    public String getUrl() {
        return "/users/" + username.toLowerCase(Locale.US);
    }

    public List<RepositoryTable.RepositoryRow> getRepositories() {
        return repositoriesTable.getRepositories();
    }

    public String getUsername() {
        return username;
    }

}
