<?php

namespace App\Modules\Template\TourTemplate\Infrastructure;

use App\Modules\Template\TourTemplate\Domain\IdTourTemplate;
use App\Modules\Template\TourTemplate\Domain\TourTemplate;
use App\Modules\Template\TourTemplate\Domain\TourTemplateRepository;
use App\Modules\Shared\Domain\Storage\Criteria\StorageCriteria;
use App\Modules\Shared\Infraestructure\DBRequester;
use Illuminate\Support\Facades\DB;

class MysqlTourTemplateRepository implements TourTemplateRepository
{
    public function find(StorageCriteria $criteria): TourTemplate
    {
        return $criteria->run();
    }

    public function search(StorageCriteria $criteria): array
    {
        return $criteria->run();
    }

    public function insert(TourTemplate $value): IdTourTemplate
    {
        return new IdTourTemplate(DBRequester::requestInsert($value));
    }

    public function update(TourTemplate $value)
    {
        return DBRequester::requestUpdate($value);
    }
}
