<?php

use Phinx\Seed\AbstractSeed;

class MenuSeeder extends AbstractSeed
{
    /**
     * Run Method.
     *
     * Write your database seeder using this method.
     *
     * More information on writing seeders is available here:
     * https://book.cakephp.org/phinx/0/en/seeding.html
     */
    public function run(): void
    {
        $data = [
            [
                'name' => 'Main Menu',
                'module' => 'menu',
            ],
            [
                'name' => 'Account Menu',
                'module' => 'menu',
            ],
        ];

        $this->table('menus')
            ->insert($data)
            ->saveData();

        $data = [
            [
                "title" => "Home",
                "routeName" => 'home',
                "href" => '/',
                "icon" => "home",
                "mid" => 1,
            ],
            [
                "title" => "Settings",
                "routeName" => 'user.display.settings',
                "href" => '/user/settings',
                "icon" => "cogs",
                "mid" => 2,
            ],
            [
                "title" => "Logout",
                "routeName" => 'user.logout',
                "href" => '/logout',
                "icon" => "sign-out",
                "mid" => 2,
            ],
        ];

        $this->table('menu_links')
            ->insert($data)
            ->saveData();
    }
}
