import 'package:p_tits_pas/models/user.dart';

class AssistanteMaternelleModel {
  final AppUser user;
  final String? approvalNumber;
  final String? residenceCity;
  final int? maxChildren;
  final int? placesAvailable;

  AssistanteMaternelleModel({
    required this.user,
    this.approvalNumber,
    this.residenceCity,
    this.maxChildren,
    this.placesAvailable,
  });

  factory AssistanteMaternelleModel.fromJson(Map<String, dynamic> json) {
    final userJson = json['user'] ?? json;
    final user = AppUser.fromJson(userJson);
    
    return AssistanteMaternelleModel(
      user: user,
      approvalNumber: json['numero_agrement'] as String?,
      residenceCity: json['ville_residence'] as String?,
      maxChildren: json['nb_max_enfants'] as int?,
      placesAvailable: json['place_disponible'] as int?,
    );
  }
}
