"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
    function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
    return new (P || (P = Promise))(function (resolve, reject) {
        function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
        function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
        function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
        step((generator = generator.apply(thisArg, _arguments || [])).next());
    });
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.MorphoSupplyContractPositionFetcher = void 0;
const display_item_present_1 = require("../../../app-toolkit/helpers/presentation/display-item.present");
const image_present_1 = require("../../../app-toolkit/helpers/presentation/image.present");
const position_interface_1 = require("../../../position/position.interface");
const contract_position_template_position_fetcher_1 = require("../../../position/template/contract-position.template.position-fetcher");
class MorphoSupplyContractPositionFetcher extends contract_position_template_position_fetcher_1.ContractPositionTemplatePositionFetcher {
    getLabel({ contractPosition }) {
        return __awaiter(this, void 0, void 0, function* () {
            return (0, image_present_1.getLabelFromToken)(contractPosition.tokens[0]);
        });
    }
    getImages({ contractPosition }) {
        return __awaiter(this, void 0, void 0, function* () {
            return (0, image_present_1.getImagesFromToken)(contractPosition.tokens[0]);
        });
    }
    getStatsItems({ contractPosition, }) {
        return __awaiter(this, void 0, void 0, function* () {
            const { supplyApy, borrowApy, supply, supplyUSD, borrow, borrowUSD, matchedUSD } = contractPosition.dataProps;
            return [
                { label: 'Supply APY', value: (0, display_item_present_1.buildPercentageDisplayItem)(supplyApy * 100) },
                { label: 'Total Supply', value: (0, display_item_present_1.buildNumberDisplayItem)(supply) },
                { label: 'Total Supply USD', value: (0, display_item_present_1.buildDollarDisplayItem)(supplyUSD) },
                { label: 'Borrow APY', value: (0, display_item_present_1.buildPercentageDisplayItem)(borrowApy * 100) },
                { label: 'Total Borrow', value: (0, display_item_present_1.buildNumberDisplayItem)(borrow) },
                { label: 'Total Borrow USD', value: (0, display_item_present_1.buildDollarDisplayItem)(borrowUSD) },
                { label: 'Total USD Value Matched P2P', value: (0, display_item_present_1.buildDollarDisplayItem)(matchedUSD) },
            ];
        });
    }
    getTokenDefinitions({ definition }) {
        return __awaiter(this, void 0, void 0, function* () {
            return [
                {
                    metaType: position_interface_1.MetaType.SUPPLIED,
                    address: definition.supplyTokenAddress,
                    network: this.network,
                },
                {
                    metaType: position_interface_1.MetaType.BORROWED,
                    address: definition.supplyTokenAddress,
                    network: this.network,
                },
            ];
        });
    }
}
exports.MorphoSupplyContractPositionFetcher = MorphoSupplyContractPositionFetcher;
//# sourceMappingURL=morpho.supply.contract-position-fetcher.js.map