package com.intland.codebeamer.functionaltest.page.trackers;

import com.intland.codebeamer.functionaltest.page.BasePage;
import org.openqa.selenium.By;

import static com.codeborne.selenide.Selenide.$;

/**
 * Copyright by Intland Software
 * <p>
 * All rights reserved.
 * <p>
 * This software is the confidential and proprietary information
 * of Intland Software. ("Confidential Information"). You
 * shall not disclose such Confidential Information and shall use
 * it only in accordance with the terms of the license agreement
 * you entered into with Intland.
 */
public class AssociationTypeSelectionDialogPage extends BasePage {

    public enum AssociationType {
        NONE("None"),
        DEPENDS("depends");

        private final String text;

        AssociationType(String s) {
            text = s;
        }

        public boolean equalsName(String otherSelector) {
            return (otherSelector == null) ? false : text.equals(otherSelector);
        }

        public String toString() {
            return this.text;
        }
    }

    public void selectAssociationType(AssociationType associationType){
        $("select[name='assocType']").selectOption(associationType.text);
    }

    public void clickOnOk(){
        $(By.xpath(".//div[@id='issueCopyMovePopup']/following-sibling::div//button[text()='OK']")).click();
    }
}
