package ru.otus.mobile.component;

import com.codeborne.selenide.SelenideElement;

import static com.codeborne.selenide.Condition.text;

public final class WishlistItemComponent extends BaseMobileComponent {
    private final SelenideElement title;
    private final SelenideElement editButton;

    public WishlistItemComponent(SelenideElement root) {
        super(root);
        this.title = byIdInRoot("title");
        this.editButton = byIdInRoot("edit_button");
    }

    public String titleText() {
        return title.getText();
    }

    public void shouldHaveTitle(String value) {
        title.shouldHave(text(value));
    }

    public void open() {
        title.click();
    }

    public void edit() {
        editButton.click();
    }
}
