import { UserError } from "toolcraft";
export function checkUserAllow(automation, commentAuthorAssociation) {
    if (automation.allow === undefined) {
        return;
    }
    if (commentAuthorAssociation === undefined) {
        throw new UserError(`Automation "${automation.name}" requires COMMENT_AUTHOR_ASSOCIATION when "allow" frontmatter is set.`);
    }
    if (automation.allow.includes(commentAuthorAssociation)) {
        return;
    }
    throw new UserError(`Automation "${automation.name}" does not allow COMMENT_AUTHOR_ASSOCIATION "${commentAuthorAssociation}". Allowed values: ${automation.allow.join(", ")}.`);
}
