<?php

namespace App\Http\Controllers\Concerns;

use Inertia\Inertia;

trait FlashesEntityMessage
{
    protected function flashCreated(string $entity): void
    {
        Inertia::flash('success', "{$entity} berhasil ditambahkan.");
    }

    protected function flashUpdated(string $entity): void
    {
        Inertia::flash('success', "{$entity} berhasil diperbarui.");
    }

    protected function flashDeleted(string $entity): void
    {
        Inertia::flash('success', "{$entity} berhasil dihapus.");
    }

    protected function flashStatusUpdated(string $entity): void
    {
        Inertia::flash('success', "Status {$entity} berhasil diperbarui.");
    }

    protected function flashSuccess(string $message): void
    {
        Inertia::flash('success', $message);
    }

    protected function flashError(string $message): void
    {
        Inertia::flash('error', $message);
    }
}
