<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // Dashboard Module
        Permission::create(['name' => 'view dashboard']);

        // Borrowers Module
        Permission::create(['name' => 'view borrowers']);
        Permission::create(['name' => 'store borrowers']);
        Permission::create(['name' => 'update borrowers']);
        Permission::create(['name' => 'delete borrowers']);

        // Lenders Module
        Permission::create(['name' => 'view lenders']);
        Permission::create(['name' => 'store lenders']);
        Permission::create(['name' => 'update lenders']);
        Permission::create(['name' => 'delete lenders']);

        // Loans Module
        Permission::create(['name' => 'view loans']);
        Permission::create(['name' => 'valid loans']);
        Permission::create(['name' => 'store loans']);
        Permission::create(['name' => 'store loans email']);
        Permission::create(['name' => 'update loans']);
        Permission::create(['name' => 'delete loans']);

        // Credits Module
        Permission::create(['name' => 'view credits']);
        Permission::create(['name' => 'valid credits']);
        Permission::create(['name' => 'store credits']);
        Permission::create(['name' => 'store credits email']);
        Permission::create(['name' => 'update credits']);
        Permission::create(['name' => 'delete credits']);

        // Restitutions Module
        Permission::create(['name' => 'view restitutions']);
        Permission::create(['name' => 'valid restitutions']);
        Permission::create(['name' => 'store restitutions']);
        Permission::create(['name' => 'store restitutions email']);
        Permission::create(['name' => 'update restitutions']);
        Permission::create(['name' => 'delete restitutions']);

        // Repayments Module
        Permission::create(['name' => 'view repayments']);
        Permission::create(['name' => 'valid repayments']);
        Permission::create(['name' => 'store repayments']);
        Permission::create(['name' => 'store repayments email']);
        Permission::create(['name' => 'update repayments']);
        Permission::create(['name' => 'delete repayments']);

        // Treasury Module
        Permission::create(['name' => 'view treasury']);
        Permission::create(['name' => 'view treasury categories']);
        Permission::create(['name' => 'store treasury categories']);
        Permission::create(['name' => 'view entries']);
        Permission::create(['name' => 'valid entries']);
        Permission::create(['name' => 'store entries']);
        Permission::create(['name' => 'update entries']);
        Permission::create(['name' => 'delete entries']);
        Permission::create(['name' => 'view exits']);
        Permission::create(['name' => 'valid exits']);
        Permission::create(['name' => 'store exits']);
        Permission::create(['name' => 'update exits']);
        Permission::create(['name' => 'delete exits']);

        // Appointments Module
        Permission::create(['name' => 'view appointments']);
        Permission::create(['name' => 'store appointments']);
        Permission::create(['name' => 'update appointments']);
        Permission::create(['name' => 'delete appointments']);

        // Boards Module
        Permission::create(['name' => 'view boards']);
        Permission::create(['name' => 'store boards']);
        Permission::create(['name' => 'update boards']);
        Permission::create(['name' => 'delete boards']);
    }
}
