sealed class PlatformContentType {
  String toJson();
}

final class PlatformAutoContentType extends PlatformContentType {
  final String urlPath;

  PlatformAutoContentType({required this.urlPath});

  @override
  String toJson() {
    return '{"type": "auto", "url": "$urlPath"}';
  }
}

final class PlatformHlsContentType extends PlatformContentType {
  final String urlPath;
  final bool isLive;

  PlatformHlsContentType({required this.urlPath, required this.isLive});

  @override
  String toJson() {
    return '{"type": "hls", "url": "$urlPath", "automaticallyReduceStalling": ${!isLive} }';
  }
}

final class PlatformDashContentType extends PlatformContentType {
  final String urlPath;

  PlatformDashContentType({required this.urlPath});

  @override
  String toJson() {
    return '{"type": "dash", "url": "$urlPath"}';
  }
}

final class PlatformMp4ContentType extends PlatformContentType {
  final String urlPath;
  final bool isLoop;

  PlatformMp4ContentType({required this.urlPath, this.isLoop = false});

  @override
  String toJson() {
    return '{"type": "mp4", "url": "$urlPath", "isLoop": $isLoop}';
  }
}