<?php

namespace Database\Seeders;

use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Permission;

class PermissionSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $permissions = [
            'view permissions',
            'create permissions',
            'edit permissions',
            'delete permissions',
            'restore permissions',
            'force-delete permissions',
            // Add role permissions if needed
            'view roles',
            'create roles',
            'edit roles',
            'delete roles',
            'restore roles',
            'force-delete roles',
        ];

        foreach ($permissions as $permission) {
            Permission::updateOrCreate(['name' => $permission]); // firstOrCreate
        }

        // Master and Transaction Pages
        Permission::updateOrCreate(['name' => 'view import user']);
        Permission::updateOrCreate(['name' => 'view export user']);

        Permission::updateOrCreate(['name' => 'view import company']);
        Permission::updateOrCreate(['name' => 'view export company']);

        Permission::updateOrCreate(['name' => 'view import plant']);
        Permission::updateOrCreate(['name' => 'view export plant']);

        Permission::updateOrCreate(['name' => 'view import block']);
        Permission::updateOrCreate(['name' => 'view export block']);

        Permission::updateOrCreate(['name' => 'view import shift']);
        Permission::updateOrCreate(['name' => 'view export shift']);

        Permission::updateOrCreate(['name' => 'view import line']);
        Permission::updateOrCreate(['name' => 'view export line']);

        Permission::updateOrCreate(['name' => 'view import item']);
        Permission::updateOrCreate(['name' => 'view export item']);

        Permission::updateOrCreate(['name' => 'view import line stop']);
        Permission::updateOrCreate(['name' => 'view export line stop']);

        Permission::updateOrCreate(['name' => 'view import sticker master']);
        Permission::updateOrCreate(['name' => 'view export sticker master']);

        Permission::updateOrCreate(['name' => 'view import locator']);
        Permission::updateOrCreate(['name' => 'view export locator']);

        Permission::updateOrCreate(['name' => 'view import configuration']);
        Permission::updateOrCreate(['name' => 'view export configuration']);

        Permission::updateOrCreate(['name' => 'view import work group master']);
        Permission::updateOrCreate(['name' => 'view export work group master']);

        Permission::updateOrCreate(['name' => 'view import machine']);
        Permission::updateOrCreate(['name' => 'view export machine']);

        Permission::updateOrCreate(['name' => 'view import motor testing master']);
        Permission::updateOrCreate(['name' => 'view export motor testing master']);

        Permission::updateOrCreate(['name' => 'view import guard name']);
        Permission::updateOrCreate(['name' => 'view export guard name']);

        Permission::updateOrCreate(['name' => 'view import check point name']);
        Permission::updateOrCreate(['name' => 'view export check point name']);

        Permission::updateOrCreate(['name' => 'view import check point time']);
        Permission::updateOrCreate(['name' => 'view export check point time']);

        Permission::updateOrCreate(['name' => 'view import guard patrol entry']);
        Permission::updateOrCreate(['name' => 'view export guard patrol entry']);
        Permission::updateOrCreate(['name' => 'view import guard patrol entries']);

        Permission::updateOrCreate(['name' => 'view import serial invoice']);
        Permission::updateOrCreate(['name' => 'view import material invoice']);
        Permission::updateOrCreate(['name' => 'view import invoice']);
        Permission::updateOrCreate(['name' => 'view import sap invoice']);
        Permission::updateOrCreate(['name' => 'view export serial invoice']);
        Permission::updateOrCreate(['name' => 'view export material invoice']);
        Permission::updateOrCreate(['name' => 'view export asn invoice']);

        Permission::updateOrCreate(['name' => 'view import locator invoice validation']);
        Permission::updateOrCreate(['name' => 'view export locator invoice validation']);
        Permission::updateOrCreate(['name' => 'view import dispatch serial invoice validation']);

        Permission::updateOrCreate(['name' => 'view import pallet validation']);
        Permission::updateOrCreate(['name' => 'view export pallet validation']);

        Permission::updateOrCreate(['name' => 'view import production line stop']);
        Permission::updateOrCreate(['name' => 'view export production line stop']);

        Permission::updateOrCreate(['name' => 'view import production plan']);
        Permission::updateOrCreate(['name' => 'view export production plan']);

        Permission::updateOrCreate(['name' => 'view import production quantities']);
        Permission::updateOrCreate(['name' => 'view export production quantities']);

        Permission::updateOrCreate(['name' => 'view import quality validation']);
        Permission::updateOrCreate(['name' => 'view export quality validation']);

        Permission::updateOrCreate(['name' => 'view import testing panel reading']);
        Permission::updateOrCreate(['name' => 'view export testing panel reading']);

        Permission::updateOrCreate(['name' => 'view import obd number validations']);
        Permission::updateOrCreate(['name' => 'view import weight validation']);
        Permission::updateOrCreate(['name' => 'view export weight validation']);

        Permission::updateOrCreate(['name' => 'view import rework invoice validation']);
        Permission::updateOrCreate(['name' => 'view export rework invoice validation']);

        Permission::updateOrCreate(['name' => 'create ProductionQuantities']);

        Permission::updateOrCreate(['name' => 'view invoice finder page']);
        Permission::updateOrCreate(['name' => 'create locator validation page']);
        Permission::updateOrCreate(['name' => 'create pallet from locator page']);
        Permission::updateOrCreate(['name' => 'create serial locator page']);
        Permission::updateOrCreate(['name' => 'view reprint pallet number']);

        Permission::updateOrCreate(['name' => 'view import mfm parameter']);
        Permission::updateOrCreate(['name' => 'view export mfm parameter']);

        Permission::updateOrCreate(['name' => 'view import mfm meter']);
        Permission::updateOrCreate(['name' => 'view export mfm meter']);

        Permission::updateOrCreate(['name' => 'view import serial validation invoice']);
        Permission::updateOrCreate(['name' => 'view export serial validation invoice']);

        Permission::updateOrCreate(['name' => 'view import sticker mapping master']);
        Permission::updateOrCreate(['name' => 'view export sticker mapping master']);

        // Dashboard Permissions
        Permission::updateOrCreate(['name' => 'view invoice dashboard']); // invoice dashboard
        Permission::updateOrCreate(['name' => 'view production hourly count dashboard']); // hourly production
        Permission::updateOrCreate(['name' => 'view production line count dashboard']);
        Permission::updateOrCreate(['name' => 'view production order count dashboard']);
        Permission::updateOrCreate(['name' => 'view production line stop count dashboard']);
        Permission::updateOrCreate(['name' => 'view guard patrol entry status dashboard']);
        Permission::updateOrCreate(['name' => 'view guard patrol day count dashboard']);
        Permission::updateOrCreate(['name' => 'view guard patrol hourly count dashboard']);
        Permission::updateOrCreate(['name' => 'view invoice serial quantity dashboard']);
        Permission::updateOrCreate(['name' => 'create production sticker reprint page']);
        Permission::updateOrCreate(['name' => 'view ems trend line analysis dashboard']);
        Permission::updateOrCreate(['name' => 'view ems trend chart analysis dashboard']);

        // Send To Sap Permissions
        Permission::updateOrCreate(['name' => 'view quality data send to sap']);
        Permission::updateOrCreate(['name' => 'view production data send to sap']);
        Permission::updateOrCreate(['name' => 'create production sticker reject reason page']);
        Permission::updateOrCreate(['name' => 'create web capture page']);

        Permission::updateOrCreate(['name' => 'view invoice pending reason']);
        Permission::updateOrCreate(['name' => 'view file manager page']);

        Permission::updateOrCreate(['name' => 'view import invoice out validation']);
        Permission::updateOrCreate(['name' => 'view export invoice out validation']);
        Permission::updateOrCreate(['name' => 'view import invoice data validation']);
        Permission::updateOrCreate(['name' => 'view export invoice data validation']);

        Permission::updateOrCreate(['name' => 'view import process order']);
        Permission::updateOrCreate(['name' => 'view export process order']);

        Permission::updateOrCreate(['name' => 'view import sticker printing']);
        Permission::updateOrCreate(['name' => 'view export sticker printing']);

        Permission::updateOrCreate(['name' => 'view import invoice master']);
        Permission::updateOrCreate(['name' => 'view export invoice master']);

        Permission::updateOrCreate(['name' => 'view import invoice in transit']);
        Permission::updateOrCreate(['name' => 'view export invoice in transit']);

        Permission::updateOrCreate(['name' => 'view import characteristic value']);
        Permission::updateOrCreate(['name' => 'view export characteristic value']);

        Permission::updateOrCreate(['name' => 'view import request characteristic']);
        Permission::updateOrCreate(['name' => 'view export request characteristic']);

        Permission::updateOrCreate(['name' => 'view import characteristic approver master']);
        Permission::updateOrCreate(['name' => 'view export characteristic approver master']);

        Permission::updateOrCreate(['name' => 'view production calender page']);
        Permission::updateOrCreate(['name' => 'view production target page']);

        Permission::updateOrCreate(['name' => 'view wire master print page']);
        Permission::updateOrCreate(['name' => 'view cycle count page']);

        Permission::updateOrCreate(['name' => 'view import stock data master']);
        Permission::updateOrCreate(['name' => 'view export stock data master']);

        Permission::updateOrCreate(['name' => 'view import duplicate stock']);
        Permission::updateOrCreate(['name' => 'view export duplicate stock']);

        Permission::updateOrCreate(['name' => 'view import production characteristics']);
        Permission::updateOrCreate(['name' => 'view export production characteristics']);

        Permission::updateOrCreate(['name' => 'view import temp class characteristic']);
        Permission::updateOrCreate(['name' => 'view export temp class characteristic']);

        Permission::updateOrCreate(['name' => 'view import production temp']);
        Permission::updateOrCreate(['name' => 'view export production temp']);

        Permission::updateOrCreate(['name' => 'view import production orders']);
        Permission::updateOrCreate(['name' => 'view export production orders']);

        Permission::updateOrCreate(['name' => 'view import transit']);
        Permission::updateOrCreate(['name' => 'view export import transit']);

        Permission::updateOrCreate(['name' => 'view reprint production order']);
        Permission::updateOrCreate(['name' => 'create osp production sticker reprint page']);

        Permission::updateOrCreate(['name' => 'view print production order button']);
        Permission::updateOrCreate(['name' => 'view save production order button']);
        Permission::updateOrCreate(['name' => 'view print panel production order button']);

        Permission::updateOrCreate(['name' => 'view import asrs item validation']);
        Permission::updateOrCreate(['name' => 'view export asrs item validation']);

        Permission::updateOrCreate(['name' => 'view import employee master']);
        Permission::updateOrCreate(['name' => 'view export employee master']);
        Permission::updateOrCreate(['name' => 'view import visitor entries']);
        Permission::updateOrCreate(['name' => 'view export visitor entries']);
        Permission::updateOrCreate(['name' => 'view gate entry page']);

        Permission::updateOrCreate(['name' => 'view import locator validation']);
        Permission::updateOrCreate(['name' => 'view export locator validation']);

        Permission::updateOrCreate(['name' => 'view import panel gr master']);
        Permission::updateOrCreate(['name' => 'view export panel gr master']);

        Permission::updateOrCreate(['name' => 'view sticker print page']);

    }
}
