import 'package:didvan/models/overview_data.dart';
import 'package:didvan/models/tag.dart';

class StudioDetailsData {
  final int id;
  final int duration;
  final String title;
  final String description;
  final String image;
  final String media;
  final String createdAt;
  final int order;
  bool marked;
  int comments;
  final List<Tag> tags;
  final List<OverviewData> relatedContents = [];

  StudioDetailsData({
    required this.id,
    required this.duration,
    required this.title,
    required this.description,
    required this.image,
    required this.media,
    required this.createdAt,
    required this.order,
    required this.marked,
    required this.comments,
    required this.tags,
  });

  factory StudioDetailsData.fromJson(Map<String, dynamic> json) {
    return StudioDetailsData(
      id: json['id'],
      duration: json['duration'],
      title: json['title'],
      description: json['description'],
      image: json['image'],
      media: json['media'],
      createdAt: json['createdAt'],
      order: json['order'],
      marked: json['marked'],
      comments: json['comments'],
      tags: List<Tag>.from(json['tags'].map((e) => Tag.fromJson(e))),
    );
  }

  Map<String, dynamic> toJson() => {
        'id': id,
        'duration': duration,
        'title': title,
        'description': description,
        'image': image,
        'media': media,
        'createdAt': createdAt,
        'order': order,
        'marked': marked,
        'comments': comments,
        'tags': tags.map((e) => e.toJson()).toList(),
      };
}
