<?php

namespace App\Modules\NiubizPurchase\BookingTemp\Infrastructure;

use App\Modules\NiubizPurchase\BookingTemp\Domain\BookingTemp;
use App\Modules\NiubizPurchase\BookingTemp\Domain\BookingTempRepository;
use App\Modules\NiubizPurchase\BookingTemp\Domain\IdBookingTemp;
use App\Modules\Shared\Domain\Storage\Criteria\ConcreteStorageCriteria;
use App\Modules\Shared\Infraestructure\DBRequester;
use App\Modules\Shared\Infraestructure\Storage\Criteria\LaravelCriteriaMatcher;

class MysqlBookingTempRepository implements BookingTempRepository
{
    public function find(ConcreteStorageCriteria $criteria)
    {
        return LaravelCriteriaMatcher::match($criteria);
    }

    public function search(ConcreteStorageCriteria $criteria)
    {
        return LaravelCriteriaMatcher::match($criteria);
    }

    public function insert(BookingTemp $model)
    {
        return new IdBookingTemp(DBRequester::requestInsert($model));
    }

    public function updatePartial(BookingTemp $model)
    {
        return DBRequester::requestUpdatePartial($model);
    }
}
