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

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 SettingsDialog {

    public enum OptionType {
        WORK_ITEM_IDS("Work Item IDs"),
        NUMBERING("Numbering"),
        ADD_REVIEW_RATING("Add Review / Rating option");

        private final String text;

        OptionType(String s) {
            text = s;
        }

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

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

    public void tickOption(OptionType optionType, boolean isSelected) {
        $(By.xpath(".//label[contains(., '" + optionType.text + "')]/input")).setSelected(isSelected);
    }

    public void clickOnSave(){
        $(By.xpath(".//input[@name='submit']")).click();
    }
}
