<?php

namespace App\Domain\Website\Blocks\Types;

use App\Domain\Website\Blocks\BlockField;
use App\Domain\Website\Blocks\BlockType;
use App\Domain\Website\Enums\BlockCategory;

/** Mobile-app promotion with store badges — every academy with an app needs this. */
class AppDownloadBlock extends BlockType
{
    public function key(): string
    {
        return 'app_download';
    }

    public function label(): string
    {
        return 'تحميل التطبيق';
    }

    public function icon(): string
    {
        return 'device-phone-mobile';
    }

    public function category(): BlockCategory
    {
        return BlockCategory::Action;
    }

    public function variants(): array
    {
        return [
            'split' => 'مقسّم مع لقطة',
            'centered' => 'وسط',
            'banner' => 'شريط',
            'floating_mockup' => 'لقطة عائمة',
        ];
    }

    public function fields(): array
    {
        return [
            BlockField::text('eyebrow', 'نص علوي صغير'),
            BlockField::text('title', 'العنوان')->required(),
            BlockField::richText('description', 'الوصف'),
            BlockField::image('screenshot', 'لقطة من التطبيق'),
            BlockField::text('ios_url', 'رابط App Store'),
            BlockField::text('android_url', 'رابط Google Play'),
            BlockField::text('huawei_url', 'رابط AppGallery'),
            // Official store badges are supplied as artwork by the stores
            // themselves; upload them rather than approximating the marks.
            BlockField::image('ios_badge', 'صورة شارة App Store'),
            BlockField::image('android_badge', 'صورة شارة Google Play'),
            BlockField::image('huawei_badge', 'صورة شارة AppGallery'),
            BlockField::repeater('features', 'مميزات التطبيق', [
                BlockField::icon('icon', 'أيقونة'),
                BlockField::text('title', 'العنوان'),
                BlockField::text('body', 'الوصف'),
            ]),
        ];
    }
}
