<?php

// config for DefStudio/GameEngine

use DefStudio\GameEngine\Enums\Role;
use DefStudio\GameEngine\Models\Map;
use DefStudio\GameEngine\Models\Run;
use DefStudio\GameEngine\Models\Task;
use DefStudio\GameEngine\Models\Team;
use DefStudio\GameEngine\Models\Award;
use DefStudio\GameEngine\Models\Story;
use DefStudio\GameEngine\Enums\Feature;
use DefStudio\GameEngine\Models\Mission;
use DefStudio\GameEngine\Decorators\Tasks;
use DefStudio\GameEngine\Enums\Permission;
use DefStudio\GameEngine\Models\Organization;
use DefStudio\GameEngine\Models\Storytelling;
use DefStudio\GameEngine\Enums\StorytellingType;
use DefStudio\GameEngine\Actions\Missions\Extractor\DefaultTaskExtractor;

return [
    'route_prefix' => 'game-engine',
    'users' => [
        'morph_class' => 'user',
        'roles' => [
            Role::super_admin->value => [
                'color' => 'bg-orange-500',
            ],
            Role::admin->value => [
                'color' => 'bg-red-500',
                'permissions' => [
                    Permission::view_users->for_role(Role::admin),
                    Permission::view_users->for_role(Role::master),
                    Permission::view_users->for_role(Role::player),
                    Permission::create_users->for_role(Role::master),
                    Permission::create_users->for_role(Role::player),
                    Permission::edit_users->for_role(Role::master),
                    Permission::edit_users->for_role(Role::player),
                    Permission::delete_users->for_role(Role::master),
                    Permission::delete_users->for_role(Role::player),

                    Permission::view_organizations->value,
                    Permission::edit_organizations->value,

                    Permission::view_teams->value,
                    Permission::create_teams->value,
                    Permission::edit_teams->value,
                    Permission::delete_teams->value,

                    Permission::view_stories->value,
                    Permission::create_stories->value,
                    Permission::edit_stories->value,
                    Permission::delete_stories->value,

                    Permission::manage_awards->value,
                ],
            ],
            Role::master->value => [
                'color' => 'bg-blue-500',
                'permissions' => [
                    Permission::view_teams->value,
                    Permission::edit_teams->value,

                    Permission::view_stories->value,
                ],
            ],
            Role::player->value => [
                'color' => 'bg-purple-500',
                'permissions' => [

                ],
            ],
        ],
    ],
    'organizations' => [
        'model' => Organization::class,
        'table' => 'organizations',
        'subscriptions_table' => 'organization_user',
        'morph_class' => 'organization',
    ],
    'teams' => [
        'model' => Team::class,
        'table' => 'teams',
        'subscriptions_table' => 'team_user',
        'morph_class' => 'team',
    ],
    'stories' => [
        'model' => Story::class,
        'table' => 'stories',
        'subscriptions_table' => 'story_team',
        'morph_class' => 'story',
    ],
    'maps' => [
        'model' => Map::class,
        'table' => 'maps',
        'morph_class' => 'map',
    ],
    'missions' => [
        'model' => Mission::class,
        'table' => 'missions',
        'morph_class' => 'mission',
        'task_extractor' => DefaultTaskExtractor::class,
    ],
    'tasks' => [
        'model' => Task::class,
        'table' => 'tasks',
        'morph_class' => 'task',
        'types' => [
            Tasks\MultipleChoiceQuestion::class,
            Tasks\DragAndDrop::class,
        ],
    ],
    'storytelling' => [
        'model' => Storytelling::class,
        'table' => 'storytellings',
        'morph_class' => 'storytelling',
        'types' => [
            StorytellingType::activation,
            StorytellingType::prologue,
            StorytellingType::epilogue,
        ],
        'available_in' => [
            Story::class,
            Map::class,
            Mission::class,
            Task::class,
        ],
    ],
    'awards' => [
        'model' => Award::class,
        'table' => 'awards',
        'morph_class' => 'award',
        'scopes' => [
            Organization::class,
            Story::class,
            Map::class,
            Mission::class,
        ],
    ],
    'runs' => [
        'model' => Run::class,
        'table' => 'runs',
    ],
    'features' => [
        Feature::impersonate,
        Feature::welcome_email,
        Feature::storytelling,

        //Awards
        Feature::awards_hierarchy,
        Feature::scoped_awards,
    ],
    'tables' => [
        'organizations' => 'organizations',
        'organization_user' => 'organization_user',
        'teams' => 'teams',
        'team_user' => 'team_user',
        'stories' => 'stories',
        'story_team' => 'story_team',
        'maps' => 'maps',
        'missions' => 'missions',
        'tasks' => 'tasks',
        'storytellings' => 'storytellings',
        'awards' => 'awards',
        'runs' => 'runs',
    ],
    'assets' => [
        'admin' => [
            'js' => [
                'vendor/game-engine/ckeditor.js',
                'vendor/game-engine/livewire-sortable.js',
            ],
            'css' => [
                'vendor/game-engine/ckeditor.css',
                'vendor/game-engine/styles.css',
            ],
        ],
        'runner' => [
            'js' => [
                'vendor/game-engine/tasks.js',
            ],
            'css' => [
                'vendor/game-engine/ckeditor.css',
                'vendor/game-engine/styles.css',
            ],
        ],
    ],
];
