<?php

namespace App\Http\Resources;

use Illuminate\Http\Resources\Json\JsonResource;
use App\Models\CurrencyRate;

class CalculateCurrencyRateResource extends JsonResource
{
    
    public function __construct(CurrencyRate $conversion_currency_rate, CurrencyRate $convertable_currency_rate, $convert_amount)
    {
        $this->conversion_currency_rate = $conversion_currency_rate;
        $this->convertable_currency_rate = $convertable_currency_rate;
        $this->convert_amount = $convert_amount;
    }

    /**
     * Transform the resource into an array.
     *
     * @param  \Illuminate\Http\Request  $request
     * @return array
     */
    public function toArray($request)
    {
        return [
            'conversion_currency_rate' => $this->conversion_currency_rate->id,
            'convertable_currency_rate' => $this->conversion_currency_rate->id,
            'convert_amount' => $this->convert_amount,
        ];
    }
}
