<?php

namespace App\Modules\NiubizPurchase\CashMovementTemp\Infrastructure;

use App\Modules\NiubizPurchase\CashMovementTemp\Domain\CashMovementTemp;
use App\Modules\NiubizPurchase\CashMovementTemp\Domain\CashMovementTempRepository;
use App\Modules\NiubizPurchase\CashMovementTemp\Domain\IdCashMovementTemp;
use App\Modules\Shared\Domain\Storage\Criteria\ConcreteStorageCriteria;
use App\Modules\Shared\Infraestructure\DBRequester;
use App\Modules\Shared\Infraestructure\Storage\Criteria\LaravelCriteriaMatcher;

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

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

    public function insert(CashMovementTemp $model)
    {
        return new IdCashMovementTemp(DBRequester::requestInsert($model));
    }

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