"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.MarketQuery = void 0;
const tslib_1 = require("tslib");
const type_graphql_1 = require("type-graphql");
const shell_1 = require("@things-factory/shell");
const market_type_1 = require("./market-type");
const market_model_1 = require("./market-model");
let MarketQuery = class MarketQuery {
    async smps(fromDate, toDate, page, limit, context) {
        const { items, total } = await (0, market_model_1.getSummaryByTypeAndMonth)('SMP', fromDate, toDate, page, limit);
        return { items, total };
    }
    async recs(fromDate, toDate, page, limit, context) {
        const { items, total } = await (0, market_model_1.getSummaryByTypeAndMonth)('REC', fromDate, toDate, page, limit);
        return { items, total };
    }
    async thisMonthSmpAndRec(context) {
        const SMP = await (0, market_model_1.getThisMonthSmpAndRec)('SMP');
        const REC = await (0, market_model_1.getThisMonthSmpAndRec)('REC');
        return { SMP, REC };
    }
};
exports.MarketQuery = MarketQuery;
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => market_type_1.SmpAndRecList, { nullable: true, description: '' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('fromDate')),
    tslib_1.__param(1, (0, type_graphql_1.Arg)('toDate')),
    tslib_1.__param(2, (0, type_graphql_1.Arg)('page')),
    tslib_1.__param(3, (0, type_graphql_1.Arg)('limit')),
    tslib_1.__param(4, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Number, Number, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], MarketQuery.prototype, "smps", null);
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => market_type_1.SmpAndRecList, { nullable: true, description: '' }),
    tslib_1.__param(0, (0, type_graphql_1.Arg)('fromDate')),
    tslib_1.__param(1, (0, type_graphql_1.Arg)('toDate')),
    tslib_1.__param(2, (0, type_graphql_1.Arg)('page')),
    tslib_1.__param(3, (0, type_graphql_1.Arg)('limit')),
    tslib_1.__param(4, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [String, String, Number, Number, Object]),
    tslib_1.__metadata("design:returntype", Promise)
], MarketQuery.prototype, "recs", null);
tslib_1.__decorate([
    (0, type_graphql_1.Query)(returns => market_type_1.ThisMonthSmpAndRec, { nullable: true, description: '' }),
    tslib_1.__param(0, (0, type_graphql_1.Ctx)()),
    tslib_1.__metadata("design:type", Function),
    tslib_1.__metadata("design:paramtypes", [Object]),
    tslib_1.__metadata("design:returntype", Promise)
], MarketQuery.prototype, "thisMonthSmpAndRec", null);
exports.MarketQuery = MarketQuery = tslib_1.__decorate([
    (0, type_graphql_1.Resolver)(shell_1.Domain)
], MarketQuery);
//# sourceMappingURL=market-query.js.map