package com.atlassian.webdriver.bitbucket.element;

import com.atlassian.pageobjects.elements.ElementBy;
import com.atlassian.pageobjects.elements.timeout.TimeoutType;
import com.atlassian.webdriver.bitbucket.page.PullRequestPage;
import org.openqa.selenium.By;

public class PullRequestEditDialog<T extends PullRequestPage> extends Dialog {

    @ElementBy(className = "pull-request-details")
    private PullRequestDetails details;
    private final T page;

    public PullRequestEditDialog(By locatable, TimeoutType timeoutType, T page) {
        super(locatable, timeoutType);
        this.page = page;
    }

    public T save() {
        clickMainAction();
        return page;
    }

    public PullRequestDetails getDetails() {
        return details;
    }
}
