<?php

namespace App\Modules\Leads\WebChannel\Infrastructure;

use App\Modules\Leads\WebChannel\Domain\IdWebChannel;
use App\Modules\Leads\WebChannel\Domain\WebChannel;
use App\Modules\Leads\WebChannel\Domain\WebChannelRepository;
use App\Modules\Shared\Domain\Storage\Criteria\StorageCriteria;
use App\Modules\Shared\Infraestructure\DBRequester;

class MysqlWebChannelRepository implements WebChannelRepository
{
    public function find(StorageCriteria $criteria)
    {
        return $criteria->run();
    }

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

    public function insert(WebChannel $value): IdWebChannel
    {
        return new IdWebChannel(DBRequester::requestInsert($value));
    }

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