import MonitorCriteriaExpectationBuilder from "./MonitorCriteriaExpectationBuilder";
import MonitorCriteriaObservationBuilder from "./MonitorCriteriaObservationBuilder";
export default class MonitorCriteriaMessageBuilder {
    static buildCriteriaFilterMessage(input) {
        if (input.matchMessage) {
            return input.matchMessage;
        }
        if (input.didMeetCriteria) {
            const description = MonitorCriteriaExpectationBuilder.getCriteriaFilterDescription(input.criteriaFilter);
            return `${description} condition met.`;
        }
        const failureMessage = MonitorCriteriaMessageBuilder.buildCriteriaFilterFailureMessage({
            monitor: input.monitor,
            criteriaFilter: input.criteriaFilter,
            dataToProcess: input.dataToProcess,
            monitorStep: input.monitorStep,
        });
        if (failureMessage) {
            return failureMessage;
        }
        const description = MonitorCriteriaExpectationBuilder.getCriteriaFilterDescription(input.criteriaFilter);
        return `${description} condition was not met.`;
    }
    static buildCriteriaFilterFailureMessage(input) {
        const expectation = MonitorCriteriaExpectationBuilder.describeCriteriaExpectation(input.criteriaFilter);
        const observation = MonitorCriteriaObservationBuilder.describeFilterObservation({
            monitor: input.monitor,
            criteriaFilter: input.criteriaFilter,
            dataToProcess: input.dataToProcess,
            monitorStep: input.monitorStep,
        });
        if (observation) {
            if (expectation) {
                return `${observation} (expected ${expectation}).`;
            }
            return `${observation}; configured filter was not met.`;
        }
        if (expectation) {
            const description = MonitorCriteriaExpectationBuilder.getCriteriaFilterDescription(input.criteriaFilter);
            return `${description} did not satisfy the configured condition (${expectation}).`;
        }
        return null;
    }
}
//# sourceMappingURL=MonitorCriteriaMessageBuilder.js.map