"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.matchesRecurringChildIssueForParent = matchesRecurringChildIssueForParent;
exports.isSameParentRecurringChildDependency = isSameParentRecurringChildDependency;
exports.findActiveRecurringChildDependencies = findActiveRecurringChildDependencies;
const recurring_1 = require("../../workflows/recurring");
const child_issue_title_1 = require("./child-issue-title");
function matchesRecurringChildIssueForParent(input) {
    return ((0, recurring_1.hasRecurringChildIssueTitlePrefix)(input.title) &&
        (0, child_issue_title_1.hasParentIssueTitleSuffix)(input.title, input.parentDisplayId));
}
function isSameParentRecurringChildDependency(input) {
    return matchesRecurringChildIssueForParent({
        title: input.dependency.title,
        parentDisplayId: input.parentDisplayId,
    });
}
function findActiveRecurringChildDependencies(input) {
    return input.dependencies.filter((dependency) => dependency.isOpen &&
        isSameParentRecurringChildDependency({
            dependency,
            parentDisplayId: input.parentDisplayId,
        }));
}
