<?php
/**
 * HVAC Test Data Generator
 * 
 * Provides methods to generate consistent test data for events, users, and roles
 */

class HVAC_Test_Data_Generator {
    /**
     * Generate test event data
     * @param array $overrides Optional field overrides
     * @return array Complete event data structure
     */
    public static function generate_event_data(array $overrides = []): array {
        $defaults = [
            'title' => 'Test Event ' . uniqid(),
            'description' => 'Automatically generated test event',
            'start_date' => date('Y-m-d H:i:s', strtotime('+1 day')),
            'end_date' => date('Y-m-d H:i:s', strtotime('+1 day +2 hours')),
            'capacity' => 20,
            'price' => 99.99,
            'location' => 'Virtual',
            'trainer_id' => 0, // Will be set during test
            'status' => 'publish'
        ];

        return array_merge($defaults, $overrides);
    }

    /**
     * Generate test user data
     * @param string $role User role (default: hvac_trainer)
     * @param array $overrides Optional field overrides
     * @return array Complete user data structure
     */
    public static function generate_user_data(string $role = 'hvac_trainer', array $overrides = []): array {
        $username = 'testuser_' . uniqid();
        $defaults = [
            'user_login' => $username,
            'user_pass' => wp_generate_password(),
            'user_email' => $username . '@example.com',
            'first_name' => 'Test',
            'last_name' => 'User',
            'role' => $role
        ];

        return array_merge($defaults, $overrides);
    }

    /**
     * Generate multiple test events
     * @param int $count Number of events to generate
     * @param array $base_overrides Base overrides for all events
     * @return array Array of event data
     */
    public static function generate_multiple_events(int $count, array $base_overrides = []): array {
        $events = [];
        for ($i = 0; $i < $count; $i++) {
            $events[] = self::generate_event_data($base_overrides);
        }
        return $events;
    }
}