const join = (ss) => ss.map(s => `'${s}'`).join(', ');
const ignoreStates = (collectionConfig) => {
    var _a, _b;
    return ((_a = collectionConfig.changeProgram) === null || _a === void 0 ? void 0 : _a.ignoreStates.length)
        ? `
      AND NOT [System.State] IN (${join((_b = collectionConfig.changeProgram) === null || _b === void 0 ? void 0 : _b.ignoreStates)})
    `
        : '';
};
export const getChangeProgramTasks = (collectionConfig) => {
    var _a;
    return `
  SELECT [System.Id]
  FROM workitems
  WHERE [System.WorkItemType] = "${(_a = collectionConfig.changeProgram) === null || _a === void 0 ? void 0 : _a.workItemTypeName}"
  AND [System.TeamProject] IN (${join(collectionConfig.projects.map(p => p.name))})
  ${ignoreStates(collectionConfig)}
`;
};
