import 'media_model.dart'; // Asegúrate de importar tu modelo Media

class MediaTopingCategoria {
  int? idTopingCategoria;
  int? idMedia;
  bool? principal;
  String? tipo;
  Media? media;

  MediaTopingCategoria({
    this.idTopingCategoria,
    this.idMedia,
    this.principal,
    this.tipo,
    this.media,
  });

  factory MediaTopingCategoria.fromJson(Map<String, dynamic> json) {
    return MediaTopingCategoria(
      idTopingCategoria: json['idTopingCategoria'] as int?,
      idMedia: json['idMedia'] as int?,
      principal: json['principal'] as bool?,
      tipo: json['tipo'] as String?,
      media: json['media'] != null
          ? Media.fromJson(json['media'] as Map<String, dynamic>)
          : null,
    );
  }

  Map<String, dynamic> toJson() => {
        'idTopingCategoria': idTopingCategoria,
        'idMedia': idMedia,
        'principal': principal,
        'tipo': tipo,
        'media': media?.toJson(),
      };
}
