<?php

namespace App\Modules\Leads\WebTypeClient\Infrastructure;

use App\Modules\Leads\WebTypeClient\Domain\IdWebTypeClient;
use App\Modules\Leads\WebTypeClient\Domain\WebTypeClient;
use App\Modules\Leads\WebTypeClient\Domain\WebTypeClientRepository;
use App\Modules\Shared\Domain\Storage\Criteria\StorageCriteria;
use App\Modules\Shared\Infraestructure\DBRequester;

class MysqlWebTypeClientRepository implements WebTypeClientRepository
{
    public function find(StorageCriteria $criteria): WebTypeClient
    {
        return $criteria->run();
    }

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

    public function insert(WebTypeClient $value): IdWebTypeClient
    {
        return new IdWebTypeClient(DBRequester::requestInsert($value));
    }

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