"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.AdminController = void 0;
class AdminController {
    createNetworkUseCase;
    createTokenUseCase;
    updateTokenUseCase;
    deleteTokenUseCase;
    updateTokenMinimumSwapValueUseCase;
    fetchTokenDataUseCase;
    constructor(createNetworkUseCase, createTokenUseCase, updateTokenUseCase, deleteTokenUseCase, updateTokenMinimumSwapValueUseCase, fetchTokenDataUseCase) {
        this.createNetworkUseCase = createNetworkUseCase;
        this.createTokenUseCase = createTokenUseCase;
        this.updateTokenUseCase = updateTokenUseCase;
        this.deleteTokenUseCase = deleteTokenUseCase;
        this.updateTokenMinimumSwapValueUseCase = updateTokenMinimumSwapValueUseCase;
        this.fetchTokenDataUseCase = fetchTokenDataUseCase;
    }
    createNetwork = async (req, res, next) => {
        try {
            const network = await this.createNetworkUseCase.execute(req.body);
            res.status(201).json({ success: true, data: network });
        }
        catch (error) {
            next(error);
        }
    };
    createToken = async (req, res, next) => {
        try {
            const token = await this.createTokenUseCase.execute(req.body);
            res.status(201).json({ success: true, data: token });
        }
        catch (error) {
            next(error);
        }
    };
    updateToken = async (req, res, next) => {
        try {
            const token = await this.updateTokenUseCase.execute(req.params.id, req.body);
            res.status(200).json({ success: true, data: token });
        }
        catch (error) {
            next(error);
        }
    };
    deleteToken = async (req, res, next) => {
        try {
            await this.deleteTokenUseCase.execute(req.params.id);
            res.status(204).send();
        }
        catch (error) {
            next(error);
        }
    };
    updateTokenMinimumSwapValue = async (req, res, next) => {
        try {
            const token = await this.updateTokenMinimumSwapValueUseCase.execute({
                tokenId: req.params.id,
                minimumSwapValue: req.body.minimumSwapValue,
            });
            res.status(200).json({ success: true, data: token });
        }
        catch (error) {
            next(error);
        }
    };
    fetchTokenData = async (req, res, next) => {
        try {
            const data = await this.fetchTokenDataUseCase.execute(req.body);
            res.status(200).json({ success: true, data });
        }
        catch (error) {
            next(error);
        }
    };
}
exports.AdminController = AdminController;
//# sourceMappingURL=admin.controller.js.map