import 'channel.dart';

class Store {
  final String id;
  String name;
  List<Channel> channels;

  Store({
    required this.id,
    required this.name,
    required this.channels,
  });

  Map<String, dynamic> toJson() => {
    'id': id,
    'name': name,
    'channels': channels.map((c) => c.toJson()).toList(),
  };

  factory Store.fromJson(Map<String, dynamic> json) {
    return Store(
      id: json['id'],
      name: json['name'],
      channels: (json['channels'] as List)
          .map((c) => Channel.fromJson(c))
          .toList(),
    );
  }
}
