import Action from './Action';
import Rule from './Rule';
import SimpleRule from './SimpleRule';

export default class ValueRule extends SimpleRule {
    constructor(prefix, suffix, event, css, xpath, code, key, contextURL, contextCSS, contextXPath) {
        super(prefix, suffix, event, css, xpath, code, key, contextURL, contextCSS, contextXPath);
    }

    makeAction(event): Action {
        return new Action(this.prefix, event.target.value);
    }

    actionToElements(action: Action): Element[] {
        if (action.prefix !== this.prefix) {
            return [];
        }
        if (action.suffix === undefined) {
            return super.actionToElements(action);
        }
        let elements = this.findMatchedElements();
        return elements;
    }
}
