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

import com.atlassian.pageobjects.binder.WaitUntil;
import com.atlassian.pageobjects.elements.ElementBy;
import com.atlassian.pageobjects.elements.PageElement;
import com.atlassian.pageobjects.elements.query.Poller;

/**
 * The {@link MirrorsAdminPage} with a mirroring request selected
 */
public class MirrorRequestPage extends MirrorsAdminPage {

    @ElementBy(id = "approve-mirror-button")
    private PageElement approveButton;
    @ElementBy(id = "decline-mirror-button")
    private PageElement declineButton;

    @WaitUntil
    public void ensureButtonsVisible() {
        Poller.waitUntilTrue(approveButton.timed().isVisible());
    }

    public MirrorConfigPage clickApprove() {
        approveButton.click();

        return pageBinder.bind(MirrorConfigPage.class);
    }
}
