<?php

namespace App\Http\Resources;

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

class RateCalculateCurrencyResource extends JsonResource
{
    
    public function __construct(Currency $conversion_currency, Currency $convertable_currency, $convert_amount)
    {
        $this->conversion_currency = $conversion_currency;
        $this->convertable_currency = $convertable_currency;
        $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' => $this->conversion_currency->id,
            'convertable_currency' => $this->conversion_currency->id,
            'convert_amount' => $this->convert_amount,
        ];
    }
}
