// SPDX-License-Identifier: MIT
pragma solidity ^0.8.10;

import {ReserveConfiguration} from '../../protocol/libraries/configuration/ReserveConfiguration.sol';
import {DataTypes} from '../../protocol/libraries/types/DataTypes.sol';

contract MockReserveConfiguration {
  using ReserveConfiguration for DataTypes.ReserveConfigurationMap;

  DataTypes.ReserveConfigurationMap public configuration;

  function setLtv(uint256 ltv) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setLtv(ltv);
    configuration = config;
  }

  function getLtv() external view returns (uint256) {
    return configuration.getLtv();
  }

  function setLiquidationBonus(uint256 bonus) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setLiquidationBonus(bonus);
    configuration = config;
  }

  function getLiquidationBonus() external view returns (uint256) {
    return configuration.getLiquidationBonus();
  }

  function setLiquidationThreshold(uint256 threshold) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setLiquidationThreshold(threshold);
    configuration = config;
  }

  function getLiquidationThreshold() external view returns (uint256) {
    return configuration.getLiquidationThreshold();
  }

  function setDecimals(uint256 decimals) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setDecimals(decimals);
    configuration = config;
  }

  function getDecimals() external view returns (uint256) {
    return configuration.getDecimals();
  }

  function setFrozen(bool frozen) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setFrozen(frozen);
    configuration = config;
  }

  function getFrozen() external view returns (bool) {
    return configuration.getFrozen();
  }

  function setBorrowingEnabled(bool enabled) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setBorrowingEnabled(enabled);
    configuration = config;
  }

  function getBorrowingEnabled() external view returns (bool) {
    return configuration.getBorrowingEnabled();
  }

  function setReserveFactor(uint256 reserveFactor) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setReserveFactor(reserveFactor);
    configuration = config;
  }

  function getReserveFactor() external view returns (uint256) {
    return configuration.getReserveFactor();
  }

  function setBorrowCap(uint256 borrowCap) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setBorrowCap(borrowCap);
    configuration = config;
  }

  function getBorrowCap() external view returns (uint256) {
    return configuration.getBorrowCap();
  }

  function setFlashLoanEnabled(bool enabled) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setFlashLoanEnabled(enabled);
    configuration = config;
  }

  function getFlashLoanEnabled() external view returns (bool) {
    return configuration.getFlashLoanEnabled();
  }

  function setSupplyCap(uint256 supplyCap) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setSupplyCap(supplyCap);
    configuration = config;
  }

  function getSupplyCap() external view returns (uint256) {
    return configuration.getSupplyCap();
  }

  function setLiquidationProtocolFee(uint256 liquidationProtocolFee) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setLiquidationProtocolFee(liquidationProtocolFee);
    configuration = config;
  }

  function getLiquidationProtocolFee() external view returns (uint256) {
    return configuration.getLiquidationProtocolFee();
  }

  function setUnbackedMintCap(uint256 unbackedMintCap) external {
    DataTypes.ReserveConfigurationMap memory config = configuration;
    config.setUnbackedMintCap(unbackedMintCap);
    configuration = config;
  }

  function getUnbackedMintCap() external view returns (uint256) {
    return configuration.getUnbackedMintCap();
  }

  function getFlags() external view returns (bool, bool, bool, bool) {
    return configuration.getFlags();
  }

  function getParams() external view returns (uint256, uint256, uint256, uint256, uint256) {
    return configuration.getParams();
  }

  function getCaps() external view returns (uint256, uint256) {
    return configuration.getCaps();
  }
}
