<?php
declare(strict_types=1);

use App\Core\Registries\MenuRegistry;
use App\Core\Registries\PermissionRegistry;

MenuRegistry::register('membership', [
    'label_ar'   => 'شئون العضوية',
    'label_en'   => 'Membership',
    'icon'       => 'users',
    'route'      => '/members',
    'permission' => 'member.view',
    'parent'     => null,
    'order'      => 100,
    'children'   => [
        // ── Core Members ────────────────────────────
        ['label_ar' => 'كل الأعضاء',          'label_en' => 'All Members',          'route' => '/members',               'permission' => 'member.view',           'order' => 1],
        ['label_ar' => 'عضو جديد',            'label_en' => 'New Member',           'route' => '/members/create',         'permission' => 'member.create',         'order' => 2],
        ['label_ar' => 'إدخال بأثر رجعي',     'label_en' => 'Retroactive Wizard',   'route' => '/members/retroactive-wizard', 'permission' => 'member.create',  'order' => 3],
        ['label_ar' => 'بحث الأعضاء',         'label_en' => 'Search Members',       'route' => '/members/search',         'permission' => 'member.search',         'order' => 3],
        // ── Membership Types ────────────────────────
        ['label_ar' => 'الأعضاء المؤقتون',     'label_en' => 'Temporary Members',    'route' => '/temporary',              'permission' => 'temp.view',             'order' => 10],
        ['label_ar' => 'العضوية الموسمية',     'label_en' => 'Seasonal Memberships', 'route' => '/seasonal',               'permission' => 'temp.view',             'order' => 11],
        ['label_ar' => 'العضوية الرياضية',     'label_en' => 'Sports Membership',    'route' => '/sports',                 'permission' => 'temp.view',             'order' => 12],
        ['label_ar' => 'العضوية الشرفية',      'label_en' => 'Honorary Membership',  'route' => '/honorary',               'permission' => 'member.view',           'order' => 13],
        ['label_ar' => 'الأعضاء الأجانب',      'label_en' => 'Foreign Members',      'route' => '/foreign',                'permission' => 'member.view',           'order' => 14],
        // ── Subscriptions & Financial ───────────────
        ['label_ar' => 'الاشتراكات السنوية',   'label_en' => 'Annual Subscriptions', 'route' => '/subscriptions',          'permission' => 'subscription.view',     'order' => 20],
        ['label_ar' => 'توليد اشتراكات',       'label_en' => 'Batch Generate',       'route' => '/subscriptions/batch-generate', 'permission' => 'subscription.generate_batch', 'order' => 21],
        ['label_ar' => 'الأقساط',              'label_en' => 'Installments',         'route' => '/installments',           'permission' => 'installment.view',      'order' => 22],
        ['label_ar' => 'المخالفات والغرامات',  'label_en' => 'Violations & Fines',   'route' => '/violations',             'permission' => 'fine.view',             'order' => 23],
        // ── Procedures ──────────────────────────────
        ['label_ar' => 'المقابلات',            'label_en' => 'Interviews',           'route' => '/interviews',             'permission' => 'interview.view',        'order' => 30],
        ['label_ar' => 'الكارنيهات',           'label_en' => 'Carnets',              'route' => '/carnets',                'permission' => 'carnet.view_log',       'order' => 31],
        ['label_ar' => 'المستندات',            'label_en' => 'Documents',            'route' => '/documents',              'permission' => 'document.view',         'order' => 32],
        // ── Transfers & Separations ─────────────────
        ['label_ar' => 'طلبات التحويل',        'label_en' => 'Transfer Requests',    'route' => '/transfers',              'permission' => 'transfer.view',         'order' => 40],
        ['label_ar' => 'حالات الطلاق',         'label_en' => 'Divorce Cases',        'route' => '/divorce',                'permission' => 'transfer.view',         'order' => 41],
        ['label_ar' => 'حالات الوفاة',         'label_en' => 'Death Cases',          'route' => '/death',                  'permission' => 'transfer.view',         'order' => 42],
        ['label_ar' => 'طلبات التنازل',        'label_en' => 'Waiver Requests',      'route' => '/waivers',                'permission' => 'waiver.view',           'order' => 43],
        // ── Archive ─────────────────────────────────
        ['label_ar' => 'الأرشيف',              'label_en' => 'Archive',              'route' => '/members/archive',        'permission' => 'member.archive',        'order' => 45],
        // ── Reports ─────────────────────────────────
        ['label_ar' => 'التقارير',             'label_en' => 'Reports',              'route' => '/reports',                'permission' => 'member.reports',        'order' => 50],
    ],
]);

PermissionRegistry::register('members', [
    'member.view'            => ['ar' => 'عرض الأعضاء',        'en' => 'View Members'],
    'member.create'          => ['ar' => 'إنشاء عضو',          'en' => 'Create Member'],
    'member.edit'            => ['ar' => 'تعديل عضو',          'en' => 'Edit Member'],
    'member.archive'         => ['ar' => 'أرشفة عضو',          'en' => 'Archive Member'],
    'member.search'          => ['ar' => 'بحث الأعضاء',        'en' => 'Search Members'],
    'member.view_financial'  => ['ar' => 'عرض البيانات المالية', 'en' => 'View Financial Data'],
    'member.change_status'   => ['ar' => 'تغيير حالة العضوية',  'en' => 'Change Member Status'],
    'member.pay_form_fee'    => ['ar' => 'دفع رسوم النموذج',    'en' => 'Pay Form Fee'],
    'member.pay_membership'  => ['ar' => 'دفع رسوم العضوية',    'en' => 'Pay Membership Fee'],
    'member.fill_form'       => ['ar' => 'تعبئة نموذج العضو',   'en' => 'Fill Member Form'],
    'member.reports'         => ['ar' => 'تقارير العضوية',      'en' => 'Membership Reports'],
]);