<?php

namespace Modules\Dummy\Database\Seeders\Core\Versions\V2_1_0;

use App\Models\Permission;
use App\Models\PermissionRole;
use Illuminate\Database\Seeder;

class PermissionsTableSeeder extends Seeder
{
    public function run()
    {
        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Settings\\SmsConfigurationController@index')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsConfigurationController@index',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsConfigurationController',
                'controller_name' => 'SmsConfigurationController',
                'method_name' => 'index',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@index')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@index',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController',
                'controller_name' => 'SmsTemplateController',
                'method_name' => 'index',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@edit')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@edit',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController',
                'controller_name' => 'SmsTemplateController',
                'method_name' => 'edit',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@update')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController@update',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Settings\\SmsTemplateController',
                'controller_name' => 'SmsTemplateController',
                'method_name' => 'update',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@index')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@index',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'index',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@destroy')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@destroy',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'destroy',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsRead')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsRead',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'markAsRead',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsUnread')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsUnread',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'markAsUnread',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsReadAll')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@markAsReadAll',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'markAsReadAll',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@index')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@index',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'index',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@destroy')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@destroy',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'destroy',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsRead')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsRead',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'markAsRead',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsUnread')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsUnread',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'markAsUnread',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsReadAll')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@markAsReadAll',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'markAsReadAll',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }
        if (! Permission::where('name', 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@headerNotification')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController@headerNotification',
                'controller_path' => 'App\\Http\\Controllers\\Vendor\\Notification\\VendorNotificationController',
                'controller_name' => 'VendorNotificationController',
                'method_name' => 'headerNotification',
            ]);

            PermissionRole::insert([
                'permission_id' => $permissionId,
                'role_id' => 2,
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Site\\Account\\NotificationController@index')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController@index',
                'controller_path' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController',
                'controller_name' => 'NotificationController',
                'method_name' => 'index',
            ]);

            PermissionRole::insert([
                [
                    'permission_id' => $permissionId,
                    'role_id' => 2,
                ], [
                    'permission_id' => $permissionId,
                    'role_id' => 3,
                ],
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Site\\Account\\NotificationController@destroy')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController@destroy',
                'controller_path' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController',
                'controller_name' => 'NotificationController',
                'method_name' => 'destroy',
            ]);

            PermissionRole::insert([
                [
                    'permission_id' => $permissionId,
                    'role_id' => 2,
                ], [
                    'permission_id' => $permissionId,
                    'role_id' => 3,
                ],
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Site\\Account\\NotificationController@markAsRead')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController@markAsRead',
                'controller_path' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController',
                'controller_name' => 'NotificationController',
                'method_name' => 'markAsRead',
            ]);

            PermissionRole::insert([
                [
                    'permission_id' => $permissionId,
                    'role_id' => 2,
                ], [
                    'permission_id' => $permissionId,
                    'role_id' => 3,
                ],
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Site\\Account\\NotificationController@markAsUnread')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController@markAsUnread',
                'controller_path' => 'App\\Http\\Controllers\\Site\\Account\\NotificationController',
                'controller_name' => 'NotificationController',
                'method_name' => 'markAsUnread',
            ]);

            PermissionRole::insert([
                [
                    'permission_id' => $permissionId,
                    'role_id' => 2,
                ], [
                    'permission_id' => $permissionId,
                    'role_id' => 3,
                ],
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@log')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@log',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'log',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@destroyLog')->first()) {
            Permission::insert([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@destroyLog',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'destroyLog',
            ]);
        }

        if (! Permission::where('name', 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@setting')->first()) {
            $permissionId = Permission::insertGetId([
                'name' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController@setting',
                'controller_path' => 'App\\Http\\Controllers\\Admin\\Notification\\AdminNotificationController',
                'controller_name' => 'AdminNotificationController',
                'method_name' => 'setting',
            ]);
        }
    }
}
