import 'package:intl/intl.dart';
import 'package:krow/features/profile/wages_forms/domain/entities/edd_form_entity.dart';
import 'package:krow/features/profile/wages_forms/domain/entities/i_nine_entity.dart';
import 'package:krow/features/profile/wages_forms/domain/entities/offer_letter_entity.dart';
import 'package:krow/features/profile/wages_forms/domain/entities/w_four_entity.dart';
import 'package:krow/features/profile/wages_forms/domain/utils/wage_form_visitor.dart';

class PreviewWageFormVisitor implements WageFormVisitor<Map<String, String>> {
  const PreviewWageFormVisitor();

  @override
  Map<String, String> visitEddForm(EddFormEntity entity) {
    return {
      'Last Name': entity.lastName,
      'First Name': entity.firstName,
      'Address': entity.address,
      'Apt. number': entity.aptNumber?.toString() ?? '',
      'City': entity.city,
      'State': entity.state,
      'ZIP code': entity.zipCode,
      'Social Number': entity.socialNumber,
    };
  }

  @override
  Map<String, String> visitINineForm(INineEntity entity) {
    return {
      'Last Name': entity.lastName,
      'First Name': entity.firstName,
      'Middle Name': entity.middleName,
      'Address': entity.address,
      'Apt. number': entity.aptNumber?.toString() ?? '',
      'City': entity.city,
      'State': entity.state,
      'ZIP code': entity.zipCode,
      'Date of birth': entity.dateOfBirth != null
          ? DateFormat('M/d/y').format(entity.dateOfBirth!)
          : '',
      'Social Number': entity.socialNumber,
      'Email': entity.email,
      'Phone Number': entity.phoneNumber,
    };
  }

  @override
  Map<String, String> visitOfferLetterFrom(OfferLetterEntity entity) {
    return {
      'Full Name': entity.fullName,
      'City': entity.city,
    };
  }

  @override
  Map<String, String> visitWFourForm(WFourEntity entity) {
    return {
      'Last Name': entity.lastName,
      'First Name': entity.firstName,
      'Middle Name': entity.middleName,
      'Address': entity.address,
      'City': entity.city,
      'State': entity.state,
      'ZIP code': entity.zipCode,
      'Social Number': entity.socialNumber,
    };
  }
}
