<?php

namespace App\Repositories\Contracts;

use App\Enums\SettingGroup;
use App\Models\Setting;
use Illuminate\Database\Eloquent\Collection;

/**
 * @extends BaseRepositoryInterface<Setting>
 */
interface SettingRepositoryInterface extends BaseRepositoryInterface
{
    /**
     * @return Collection<int, Setting>
     */
    public function all(): Collection;

    /**
     * Get all public settings grouped by group name (nested key-value format).
     *
     * @return array<string, array<string, mixed>>
     */
    public function publicGrouped(): array;

    /**
     * Get public settings for a single group (key-value format).
     *
     * @return array<string, mixed>
     */
    public function publicByGroup(SettingGroup $group): array;

    public function findByKey(string $key): ?Setting;

    /**
     * @return Collection<int, Setting>
     */
    public function getByGroup(SettingGroup $group): Collection;

    /**
     * Bulk update settings using dot notation keys (e.g. "general.site_name").
     *
     * @param  array<string, mixed>  $settings
     */
    public function bulkUpdate(array $settings): void;

    /**
     * Clear all setting caches.
     */
    public function clearCache(): void;
}
