import UserMiddleware from "../Middleware/UserAuthorization";
import WorkspaceNotificationRuleService from "../Services/WorkspaceNotificationRuleService";
import Response from "../Utils/Response";
import BaseAPI from "./BaseAPI";
import CommonAPI from "./CommonAPI";
import WorkspaceNotificationRule from "../../Models/DatabaseModels/WorkspaceNotificationRule";
import ObjectID from "../../Types/ObjectID";
export default class WorkspaceNotificationRuleAPI extends BaseAPI {
    constructor() {
        var _a;
        super(WorkspaceNotificationRule, WorkspaceNotificationRuleService);
        this.router.get(`${(_a = new this.entityType().getCrudApiPath()) === null || _a === void 0 ? void 0 : _a.toString()}/test/:workspaceNotifcationRuleId`, UserMiddleware.getUserMiddleware, async (req, res, next) => {
            try {
                const databaseProps = await CommonAPI.getDatabaseCommonInteractionProps(req);
                await this.service.testRule({
                    ruleId: new ObjectID(req.params["workspaceNotifcationRuleId"]),
                    props: databaseProps,
                    projectId: databaseProps.tenantId,
                    testByUserId: databaseProps.userId,
                });
                return Response.sendEmptySuccessResponse(req, res);
            }
            catch (e) {
                next(e);
            }
        });
    }
}
//# sourceMappingURL=WorkspaceNotificationRuleAPI.js.map