<?php

use Illuminate\Database\Migrations\Migration;
use Spatie\Permission\Models\Permission;

class AddVetAiPermissions extends Migration
{
    public function up()
    {
        foreach ([
            'vet_ai.access_module',
            'vet_ai.use_assistant',
            'vet_ai.view_history',
            'vet_ai.manage_settings',
        ] as $perm) {
            Permission::findOrCreate($perm, 'web');
        }
    }

    public function down()
    {
        Permission::whereIn('name', [
            'vet_ai.access_module',
            'vet_ai.use_assistant',
            'vet_ai.view_history',
            'vet_ai.manage_settings',
        ])->delete();
    }
}
