<?php

namespace Modules\Supplier\Repositories;

use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Collection;
use Modules\Supplier\Interfaces\SupplierRepositoryInterface;
use Modules\Supplier\Models\Supplier;

class SupplierRepository implements SupplierRepositoryInterface
{
    public function get(array $request): Builder
    {
        return Supplier::query();
    }

    public function create(string $image): Supplier
    {
        return Supplier::create(['image' => $image]);
    }

    public function insert(array $data): bool
    {
        return Supplier::insert($data);
    }

    public function getAll(): ?Collection
    {
        return Supplier::select('id', 'image')->get();
    }

    public function deleteAll(array $ids): void
    {
        Supplier::whereIn('id', $ids)->delete();
    }
}
