<?php

namespace App\Support;

class PermissionCatalog
{
    public const DASHBOARD = ['view-dashboard'];

    public const MASTER = [
        'view-academic-terms', 'create-academic-terms', 'update-academic-terms', 'delete-academic-terms', 'update-academic-terms-status',
        'view-departments', 'create-departments', 'update-departments', 'delete-departments',
        'view-courses', 'create-courses', 'update-courses', 'delete-courses',
    ];

    public const ACADEMIC_CLASSES = [
        'view-materials', 'create-materials', 'update-materials', 'delete-materials',
        'view-assignments', 'create-assignments', 'update-assignments', 'delete-assignments',
        'view-assignment-submissions', 'create-assignment-submissions', 'update-assignment-submissions', 'delete-assignment-submissions',
        'view-schedules', 'create-schedules', 'update-schedules', 'delete-schedules',
        'view-attendances', 'create-attendances', 'delete-attendances',
    ];

    public const MANAGE = [
        'view-course-classes', 'create-course-classes', 'update-course-classes', 'delete-course-classes',
        'view-course-class-enrollments', 'create-course-class-enrollments', 'delete-course-class-enrollments',
        'view-course-registrations', 'create-course-registrations', 'approve-course-registrations', 'reject-course-registrations',
        'view-announcements', 'create-announcements', 'update-announcements', 'delete-announcements',
    ];

    public const FINANCES = [
        'view-tuition-invoices', 'create-tuition-invoices', 'update-tuition-invoices', 'delete-tuition-invoices',
        'view-tuition-payments', 'create-tuition-payments', 'update-tuition-payments', 'delete-tuition-payments',
    ];

    public const SERVICES = [
        'view-letter-requests', 'create-letter-requests', 'update-letter-requests', 'update-letter-requests-status', 'delete-letter-requests',
        'view-academic-advising-logs', 'create-academic-advising-logs', 'update-academic-advising-logs', 'delete-academic-advising-logs',
    ];

    public const USERS = [
        'view-lecturers', 'create-lecturers', 'update-lecturers', 'delete-lecturers', 'reset-lecturers-password', 'update-lecturers-status', 'export-lecturers',
        'view-students', 'create-students', 'update-students', 'delete-students', 'reset-students-password', 'update-students-academic-status', 'update-students-account-status', 'export-students',
        'view-administrators', 'create-administrators', 'update-administrators', 'delete-administrators', 'reset-administrators-password', 'update-administrators-status',
    ];

    public const DEVELOPER = [
        'view-logs',
        'view-roles', 'update-roles',
    ];

    public const FEEDBACK = [
        'view-feedback', 'create-feedback', 'update-feedback', 'delete-feedback', 'update-feedback-status',
    ];

    /**
     * @return array<string, array<int, string>>
     */
    public static function groups(): array
    {
        return [
            'Dashboard' => self::DASHBOARD,
            'Master' => self::MASTER,
            'Kelas' => self::ACADEMIC_CLASSES,
            'Kelola' => self::MANAGE,
            'Keuangan' => self::FINANCES,
            'Layanan' => self::SERVICES,
            'Pengguna' => self::USERS,
            'Kritik & Saran' => self::FEEDBACK,
            'Pengembang' => self::DEVELOPER,
        ];
    }

    /**
     * @return array<int, string>
     */
    public static function all(): array
    {
        return array_merge(...array_values(self::groups()));
    }
}
