package com.atlassian.webdriver.bitbucket.page.admin;

import com.atlassian.pageobjects.elements.ElementBy;
import com.atlassian.pageobjects.elements.PageElement;
import com.atlassian.webdriver.bitbucket.page.BitbucketPage;

public class ViewDatabasePage extends BitbucketPage {

    @ElementBy(id = "type")
    private PageElement typeField;

    @ElementBy(cssSelector = ".buttons-container .aui-button.aui-button-primary")
    private PageElement migrateDatabaseButton;

    @Override
    public String getUrl() {
        return "/admin/db";
    }

    public String getDatabaseType() {
        return typeField.getText();
    }

    public ConfigureMigrationPage clickMigrationDatabase() {
        migrateDatabaseButton.click();
        return pageBinder.bind(ConfigureMigrationPage.class);
    }
}
