<?php

namespace App\View\Components\Checkout;

use App\Repositories\Member\VoucherEvent\VoucherEventRepository;
use App\Repositories\Member\Voucher\VoucherRepository;
use Illuminate\View\Component;
use Illuminate\View\View;

class PromoCode extends Component
{
    public $voucher_events;
    public $vouchers;

    /**
     * Create the component instance.
     *
     * @param VoucherEventRepository $voucherEventRepository
     * @return void
     */
    public function __construct(VoucherRepository $voucherRepository, VoucherEventRepository $voucherEventRepository)
    {
        $this->voucher_events = $voucherEventRepository->getList([]);
        $this->vouchers = $voucherRepository->getList([]);
    }

    /**
     * Get the view / contents that represent the component.
     *
     * @return View|string
     */
    public function render()
    {
        return view('components.checkout.promo-code', [
            'voucher_events' => $this->voucher_events,
            'vouchers' => $this->vouchers
        ]);
    }
}
