<?php

namespace App\Classes\Modules\Currencies\Services\Rates;

use App\Classes\General\Eloquent\AbstractUpdateRecord;
use App\Models\CurrencyRate;

class CalculatesRate extends AbstractUpdateRecord
{

    public function execute(CurrencyRate $conversion_currency_rate, CurrencyRate $convertable_currency_rate, $amount)
    {
        return $convert_amount = ($conversion_currency_rate->selling / $convertable_currency_rate->selling) * $amount;
    }
    
    public function execute_rate(CurrencyRate $conversion_currency_rate, CurrencyRate $convertable_currency_rate)
    {
        return $convert_rate = ($conversion_currency_rate->selling / $convertable_currency_rate->selling);
    }
}