<?php

namespace App\Repositories\Contracts;

use Illuminate\Database\Eloquent\Collection;
use Illuminate\Database\Eloquent\Model;

interface WriteRepositoryInterface
{
    public function create(array $data): Model;

    public function createMany(array $data): Collection;

    public function update(Model $model, array $data): bool;

    public function updateById(int $id, array $data): bool;

    public function upsert(array $data, array|string $uniqueBy, ?array $update = null): Collection;

    public function delete(Model $model): bool;

    public function deleteById(int $id): bool;

    public function deleteMultiple(array $ids): int;

    public function restore(Model $model): bool;

    public function restoreById(int $id): bool;

    public function forceDelete(Model $model): bool;

    public function forceDeleteById(int $id): bool;

    public function sync(Model $model, string $relation, array $ids, bool $detaching = true): array;

    public function attach(Model $model, string $relation, array $ids, array $attributes = [], bool $touch = true): void;

    public function detach(Model $model, string $relation, ?array $ids = null, bool $touch = true): int;

    public function clearCache(): void;

    public function clearCacheForModel(Model $model): void;

    public function clearCacheForCollection(Collection $models): void;
}
