class FeeCalculator {
  static calculateRentalFees(totalAmount) {
    const platformFeeRate = 0.1;

    const platformFee = totalAmount * platformFeeRate;

    return {
      totalAmount: parseFloat(totalAmount.toFixed(2)),
      platformFee: parseFloat(platformFee.toFixed(2)),
      totalChargedAmount: parseFloat(totalAmount.toFixed(2)),
      payoutAmount: parseFloat((totalAmount - platformFee).toFixed(2)),
    };
  }

  static formatFeesForDisplay(fees) {
    return {
      totalAmount: `$${fees.totalAmount.toFixed(2)}`,
      platformFee: `$${fees.platformFee.toFixed(2)} (10%)`,
      totalCharge: `$${fees.totalChargedAmount.toFixed(2)}`,
      ownerPayout: `$${fees.payoutAmount.toFixed(2)}`,
    };
  }
}

module.exports = FeeCalculator;
