"use strict";
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
    var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
    if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
    else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
    return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
    if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
    return function (target, key) { decorator(target, key, paramIndex); }
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.PositionController = void 0;
const common_1 = require("@nestjs/common");
const swagger_1 = require("@nestjs/swagger");
const get_positions_query_dto_1 = require("./dto/get-positions-query.dto");
const position_service_1 = require("./position.service");
let PositionController = class PositionController {
    constructor(positionService) {
        this.positionService = positionService;
    }
    getAppTokenPositions(appId, query) {
        try {
            return this.positionService.getAppTokenPositions(Object.assign(Object.assign({}, query), { appId }));
        }
        catch (e) {
            throw new common_1.NotFoundException(e.message);
        }
    }
    getAppContractPositions(appId, query) {
        try {
            return this.positionService.getAppContractPositions(Object.assign(Object.assign({}, query), { appId }));
        }
        catch (e) {
            throw new common_1.NotFoundException(e.message);
        }
    }
};
__decorate([
    (0, swagger_1.ApiTags)('Positions'),
    (0, swagger_1.ApiOperation)({
        summary: 'Application Position Tokens',
        description: 'Retrieve all application position tokens for a given application for a single network.',
    }),
    (0, common_1.Get)(`/:appId/tokens`),
    __param(0, (0, common_1.Param)('appId')),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, get_positions_query_dto_1.GetPositionsQuery]),
    __metadata("design:returntype", void 0)
], PositionController.prototype, "getAppTokenPositions", null);
__decorate([
    (0, swagger_1.ApiTags)('Positions'),
    (0, swagger_1.ApiOperation)({
        summary: 'Application Contract Positions',
        description: 'Retrieve positions (non-tokenized) for a given application.',
    }),
    (0, common_1.Get)(`/:appId/positions`),
    __param(0, (0, common_1.Param)('appId')),
    __param(1, (0, common_1.Query)()),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", [String, get_positions_query_dto_1.GetPositionsQuery]),
    __metadata("design:returntype", void 0)
], PositionController.prototype, "getAppContractPositions", null);
PositionController = __decorate([
    (0, common_1.Controller)('/apps'),
    __param(0, (0, common_1.Inject)(position_service_1.PositionService)),
    __metadata("design:paramtypes", [position_service_1.PositionService])
], PositionController);
exports.PositionController = PositionController;
//# sourceMappingURL=position.controller.js.map