export default class Action {

    kind: string;
    value: string;
    index: number;

    constructor(kind: string, value: string, index: number= 0) {
        if (kind === undefined || kind === null) {
            throw new Error('cannot create action without a kind');
        }
        this.kind = kind;
        this.value = value;
        this.index = index;
    }

    toString() {
        if (this.value) {
            return `${this.kind}$${this.value}`
        } else {
            return this.kind
        }
    }

}