<?php

namespace Database\Factories;

use Illuminate\Database\Eloquent\Factories\Factory;

/**
 * @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Application>
 */
class ApplicationFactory extends Factory
{
    /**
     * Define the model's default state.
     *
     * @return array<string, mixed>
     */
    public function definition(): array
    {
        // Popular apps that likely have icons in selfh.st/icons
        $apps = [
            'Nextcloud',
            'Plex',
            'Jellyfin',
            'Home Assistant',
            'Grafana',
            'Portainer',
            'Sonarr',
            'Radarr',
            'Lidarr',
            'Bazarr',
            'Overseerr',
            'Tautulli',
            'Ombi',
            'Jackett',
            'qBittorrent',
            'Transmission',
            'SABnzbd',
            'NZBGet',
            'Synology',
            'FreeNAS',
            'UniFi',
            'pfSense',
            'OPNsense',
            'Pi-hole',
            'AdGuard',
            'Bitwarden',
            'Vaultwarden',
            'PhotoPrism',
            'Immich',
            'Paperless',
            'Bookstack',
            'TiddlyWiki',
            'Joplin',
            'Standard Notes',
            'Trilium',
            'Monica',
            'Firefly III',
            'Invoice Ninja',
            'Crater',
            'Akaunting',
            'Ghost',
            'WordPress',
            'Discourse',
            'Flarum',
            'NodeBB',
            'Rocket.Chat',
            'Mattermost',
            'Element',
            'Synapse',
            'Jitsi',
            'BigBlueButton',
            'Jami',
            'Mumble',
            'TeamSpeak',
            'Discord',
            'Gitea',
            'GitLab',
            'Forgejo',
            'Gogs',
            'Sourcehut',
            'Drone',
            'Jenkins',
            'Buildbot',
            'TeamCity',
            'Bamboo',
            'SonarQube',
            'Sentry',
            'Uptime Kuma',
            'Healthchecks',
            'Cachet',
            'Zabbix',
            'Nagios',
            'Icinga',
            'LibreNMS',
            'PRTG',
            'Proxmox',
            'ESXi',
            'XCP-ng',
            'Harvester',
            'Rancher'
        ];

        $appName = fake()->randomElement($apps);
        $kebabName = str($appName)->kebab()->toString();

        return [
            'name' => $appName,
            'client_id' => fake()->uuid(),
            'client_secret' => fake()->regexify('[A-Za-z0-9]{40}'),
            'redirect_uri' => fake()->url() . '/auth/callback',
            'icon' => "https://cdn.jsdelivr.net/gh/selfhst/icons/webp/{$kebabName}.webp",
        ];
    }
}
