"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.IssueHistoryQuery = void 0;
const tslib_1 = require("tslib");
const type_graphql_1 = require("type-graphql");
const shell_1 = require("@things-factory/shell");
const issue_history_type_1 = require("./issue-history-type");
const issue_history_model_1 = require("./issue-history-model");
let IssueHistoryQuery = class IssueHistoryQuery {
    async issueHistories(powerPlantId, fromDate, toDate, page, limit, context) {
        const { user, domain } = context.state;
        const issueHistories = await (0, issue_history_model_1.getIssueHistoriesByPowerPlantId)(powerPlantId, fromDate, toDate, { page, limit });
        return issueHistories;
    }
    async issueHistorySummary(powerPlantId, fromDate, toDate, context) {
        const { user, domain } = context.state;
        const issueHistorySummary = await (0, issue_history_model_1.getIssueHistorySummaryByPowerPlantId)(powerPlantId, fromDate, toDate);
        return issueHistorySummary;
    }
};
exports.IssueHistoryQuery = IssueHistoryQuery;
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => [issue_history_type_1.IssueHistory], { nullable: true, description: '' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('powerPlantId')),
    tslib_1.__param(1, (0, type_graphql_1.Arg)('fromDate')),
    tslib_1.__param(2, (0, type_graphql_1.Arg)('toDate')),
    tslib_1.__param(3, (0, type_graphql_1.Arg)('page')),
    tslib_1.__param(4, (0, type_graphql_1.Arg)('limit')),
    tslib_1.__param(5, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, String, Number, Number, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], IssueHistoryQuery.prototype, "issueHistories", null);
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => issue_history_type_1.IssueHistorySummary, { nullable: true, description: '' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('powerPlantId')),
    tslib_1.__param(1, (0, type_graphql_1.Arg)('fromDate')),
    tslib_1.__param(2, (0, type_graphql_1.Arg)('toDate')),
    tslib_1.__param(3, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, String, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], IssueHistoryQuery.prototype, "issueHistorySummary", null);
exports.IssueHistoryQuery = IssueHistoryQuery = tslib_1.__decorate([
    (0, type_graphql_1.Resolver)(shell_1.Domain)
], IssueHistoryQuery);
//# sourceMappingURL=issue-history-query.js.map