import 'package:krow_domain/krow_domain.dart';

/// Mock implementation of profile-related data operations.
///
/// This mock provides hardcoded staff profile data for development and testing.
/// It simulates the behavior of a real backend service without requiring
/// actual API calls or Firebase Data Connect.
///
/// In production, this will be replaced with a real implementation that
/// interacts with Firebase Data Connect.
class ProfileRepositoryMock {
  /// Fetches the staff profile for the given user ID.
  ///
  /// Returns a [Staff] entity with mock data.
  /// Simulates a network delay to mirror real API behavior.
  ///
  /// Throws an exception if the profile cannot be retrieved.
  Future<Staff> getStaffProfile(String userId) async {
    // Simulate network delay
    await Future.delayed(const Duration(milliseconds: 500));

    // Return mock staff profile data
    return const Staff(
      id: '93673c8f-91aa-405d-8647-f1aac29cc19b',
      authProviderId: 't8P3fYh4y1cPoZbbVPXUhfQCsDo3',
      name: 'Krower',
      email: 'worker@krow.com',
      phone: '555-123-4567',
      status: StaffStatus.active,
      avatar: null,
      address: null,
    );
  }

  /// Signs out the current user.
  ///
  /// Simulates the sign-out process with a delay.
  /// In a real implementation, this would clear session tokens,
  /// update Firebase auth state, etc.
  Future<void> signOut() async {
    // Simulate processing delay
    await Future.delayed(const Duration(milliseconds: 300));
  }

  /// Fetches emergency contacts for the given staff ID.
  ///
  /// Returns a list of [EmergencyContact].
  Future<List<EmergencyContact>> getEmergencyContacts(String staffId) async {
    await Future.delayed(const Duration(milliseconds: 500));
    return [
      const EmergencyContact(
        name: 'Jane Doe',
        phone: '555-987-6543',
        relationship: RelationshipType.spouse,
        id: 'contact_1',
      ),
    ];
  }

  /// Saves emergency contacts for the given staff ID.
  Future<void> saveEmergencyContacts(
    String staffId,
    List<EmergencyContact> contacts,
  ) async {
    await Future.delayed(const Duration(seconds: 1));
    // Simulate save
  }

  /// Fetches selected industries for the given staff ID.
  Future<List<String>> getStaffIndustries(String staffId) async {
    await Future.delayed(const Duration(milliseconds: 500));
    return ['hospitality', 'events'];
  }

  /// Fetches selected skills for the given staff ID.
  Future<List<String>> getStaffSkills(String staffId) async {
    await Future.delayed(const Duration(milliseconds: 500));
    return ['Bartending', 'Server'];
  }

  /// Saves experience (industries and skills) for the given staff ID.
  Future<void> saveExperience(
    String staffId,
    List<String> industries,
    List<String> skills,
  ) async {
    await Future.delayed(const Duration(seconds: 1));
    // Simulate save
  }
}
