<?php

namespace Database\Factories;

use App\Models\Collection;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;

class CollectionFactory extends Factory
{
    protected $model = Collection::class;

    public function definition(): array
    {
        $title = $this->faker->unique()->sentence(3);

        return [
            'user_id' => User::factory(),
            'managed_by_user_id' => null,
            'title' => $title,
            'slug' => Str::slug($title),
            'lifecycle_state' => Collection::LIFECYCLE_PUBLISHED,
            'workflow_state' => Collection::WORKFLOW_APPROVED,
            'readiness_state' => Collection::READINESS_READY,
            'health_state' => Collection::HEALTH_HEALTHY,
            'health_flags_json' => [],
            'canonical_collection_id' => null,
            'duplicate_cluster_key' => null,
            'program_key' => null,
            'partner_key' => null,
            'trust_tier' => 'standard',
            'experiment_key' => null,
            'recommendation_tier' => 'secondary',
            'ranking_bucket' => 'steady',
            'search_boost_tier' => 'standard',
            'type' => Collection::TYPE_PERSONAL,
            'editorial_owner_mode' => Collection::EDITORIAL_OWNER_CREATOR,
            'editorial_owner_user_id' => null,
            'editorial_owner_label' => null,
            'description' => $this->faker->paragraph(),
            'subtitle' => null,
            'summary' => null,
            'collaboration_mode' => Collection::COLLABORATION_CLOSED,
            'allow_submissions' => false,
            'allow_comments' => true,
            'allow_saves' => true,
            'moderation_status' => Collection::MODERATION_ACTIVE,
            'visibility' => Collection::VISIBILITY_PUBLIC,
            'mode' => Collection::MODE_MANUAL,
            'sort_mode' => Collection::SORT_MANUAL,
            'artworks_count' => 0,
            'comments_count' => 0,
            'is_featured' => false,
            'profile_order' => null,
            'views_count' => 0,
            'likes_count' => 0,
            'followers_count' => 0,
            'shares_count' => 0,
            'saves_count' => 0,
            'collaborators_count' => 1,
            'smart_rules_json' => null,
            'layout_modules_json' => null,
            'last_activity_at' => null,
            'featured_at' => null,
            'published_at' => null,
            'unpublished_at' => null,
            'event_key' => null,
            'event_label' => null,
            'season_key' => null,
            'banner_text' => null,
            'badge_label' => null,
            'spotlight_style' => Collection::SPOTLIGHT_STYLE_DEFAULT,
            'quality_score' => 52.5,
            'ranking_score' => 61.0,
            'metadata_completeness_score' => 72.0,
            'editorial_readiness_score' => 68.0,
            'freshness_score' => 64.0,
            'engagement_score' => 28.0,
            'health_score' => 66.0,
            'last_health_check_at' => now(),
            'last_recommendation_refresh_at' => now(),
            'placement_eligibility' => true,
            'analytics_enabled' => true,
            'presentation_style' => Collection::PRESENTATION_STANDARD,
            'emphasis_mode' => Collection::EMPHASIS_BALANCED,
            'theme_token' => null,
            'series_key' => null,
            'series_title' => null,
            'series_description' => null,
            'series_order' => null,
            'campaign_key' => null,
            'campaign_label' => null,
            'commercial_eligibility' => false,
            'promotion_tier' => null,
            'sponsorship_label' => null,
            'partner_label' => null,
            'monetization_ready_status' => null,
            'brand_safe_status' => null,
            'archived_at' => null,
            'expired_at' => null,
            'history_count' => 0,
        ];
    }
}
