<?php

namespace App\Classes\Modules\ServiceTypes\DataTransferObjects;

use App\Classes\General\Interfaces\DataTransferObject;
use App\Classes\Modules\Currencies\DataTransferObjects\RateObject;

class ServiceCurrenciesObject implements DataTransferObject
{

    /** @var int */
    private $id;

    /** @var boolean */
    private $isActive;

    /** @var array */
    private $maxLimit;

    /** @var array */
    private $minLimit;

    /** @var array */
    private $rates;

    /**
     * ServiceCurrenciesObject constructor.
     * @param int $id
     * @param bool $isActive
     * @param array $maxLimit
     * @param array $minLimit
     * @param array $rates
     */
    public function __construct(int $id, bool $isActive, array $maxLimit, array $minLimit, array $rates)
    {
        $this->id = $id;
        $this->isActive = $isActive;
        $this->maxLimit = $maxLimit;
        $this->minLimit = $minLimit;
        $this->rates = $rates;
    }


    /**
     * @return int
     */
    public function getId(): int
    {
        return $this->id;
    }

    /**
     * @return bool
     */
    public function isActive(): bool
    {
        return $this->isActive;
    }

    /**
     * @return array
     */
    public function getMaxLimit(): array
    {
        return $this->maxLimit;
    }

    /**
     * @return array
     */
    public function getMinLimit(): array
    {
        return $this->minLimit;
    }


    /**
     * @return array
     */
    public function getRates(): array
    {
        return array_map(function($rate){
            return new RateObject($rate['selling'], $rate['payment_method']);
        }, $this->rates);
    }




}