@tool
extends TwitchData

# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.

## 
## #/components/schemas/Video
class_name TwitchVideo
	
## An ID that identifies the video.
@export var id: String:
	set(val): 
		id = val
		track_data(&"id", val)

## The ID of the stream that the video originated from if the video's type is "archive;" otherwise, **null**.
@export var stream_id: String:
	set(val): 
		stream_id = val
		track_data(&"stream_id", val)

## The ID of the broadcaster that owns the video.
@export var user_id: String:
	set(val): 
		user_id = val
		track_data(&"user_id", val)

## The broadcaster's login name.
@export var user_login: String:
	set(val): 
		user_login = val
		track_data(&"user_login", val)

## The broadcaster's display name.
@export var user_name: String:
	set(val): 
		user_name = val
		track_data(&"user_name", val)

## The video's title.
@export var title: String:
	set(val): 
		title = val
		track_data(&"title", val)

## The video's description.
@export var description: String:
	set(val): 
		description = val
		track_data(&"description", val)

## The date and time, in UTC, of when the video was created. The timestamp is in RFC3339 format.
@export var created_at: String:
	set(val): 
		created_at = val
		track_data(&"created_at", val)

## The date and time, in UTC, of when the video was published. The timestamp is in RFC3339 format.
@export var published_at: String:
	set(val): 
		published_at = val
		track_data(&"published_at", val)

## The video's URL.
@export var url: String:
	set(val): 
		url = val
		track_data(&"url", val)

## A URL to a thumbnail image of the video. Before using the URL, you must replace the `%{width}` and `%{height}` placeholders with the width and height of the thumbnail you want returned. Due to current limitations, `${width}` must be 320 and `${height}` must be 180.
@export var thumbnail_url: String:
	set(val): 
		thumbnail_url = val
		track_data(&"thumbnail_url", val)

## The video's viewable state. Always set to **public**.
@export var viewable: String:
	set(val): 
		viewable = val
		track_data(&"viewable", val)

## The number of times that users have watched the video.
@export var view_count: int:
	set(val): 
		view_count = val
		track_data(&"view_count", val)

## The ISO 639-1 two-letter language code that the video was broadcast in. For example, the language code is DE if the video was broadcast in German. For a list of supported languages, see [Supported Stream Language](https://help.twitch.tv/s/article/languages-on-twitch#streamlang). The language value is "other" if the video was broadcast in a language not in the list of supported languages.
@export var language: String:
	set(val): 
		language = val
		track_data(&"language", val)

## The video's type. Possible values are:  
##   
## * archive — An on-demand video (VOD) of one of the broadcaster's past streams.
## * highlight — A highlight reel of one of the broadcaster's past streams. See [Creating Highlights](https://help.twitch.tv/s/article/creating-highlights-and-stream-markers).
## * upload — A video that the broadcaster uploaded to their video library. See Upload under [Video Producer](https://help.twitch.tv/s/article/video-on-demand?language=en%5FUS#videoproducer).
@export var type: String:
	set(val): 
		type = val
		track_data(&"type", val)

## The video's length in ISO 8601 duration format. For example, 3m21s represents 3 minutes, 21 seconds.
@export var duration: String:
	set(val): 
		duration = val
		track_data(&"duration", val)

## The segments that Twitch Audio Recognition muted; otherwise, **null**.
@export var muted_segments: Array[MutedSegments]:
	set(val): 
		muted_segments = val
		track_data(&"muted_segments", val)
var response: BufferedHTTPClient.ResponseData


## Constructor with all required fields.
static func create(_id: String, _stream_id: String, _user_id: String, _user_login: String, _user_name: String, _title: String, _description: String, _created_at: String, _published_at: String, _url: String, _thumbnail_url: String, _viewable: String, _view_count: int, _language: String, _type: String, _duration: String, _muted_segments: Array[MutedSegments]) -> TwitchVideo:
	var twitch_video: TwitchVideo = TwitchVideo.new()
	twitch_video.id = _id
	twitch_video.stream_id = _stream_id
	twitch_video.user_id = _user_id
	twitch_video.user_login = _user_login
	twitch_video.user_name = _user_name
	twitch_video.title = _title
	twitch_video.description = _description
	twitch_video.created_at = _created_at
	twitch_video.published_at = _published_at
	twitch_video.url = _url
	twitch_video.thumbnail_url = _thumbnail_url
	twitch_video.viewable = _viewable
	twitch_video.view_count = _view_count
	twitch_video.language = _language
	twitch_video.type = _type
	twitch_video.duration = _duration
	twitch_video.muted_segments = _muted_segments
	return twitch_video


static func from_json(d: Dictionary) -> TwitchVideo:
	var result: TwitchVideo = TwitchVideo.new()
	if d.get("id", null) != null:
		result.id = d["id"]
	if d.get("stream_id", null) != null:
		result.stream_id = d["stream_id"]
	if d.get("user_id", null) != null:
		result.user_id = d["user_id"]
	if d.get("user_login", null) != null:
		result.user_login = d["user_login"]
	if d.get("user_name", null) != null:
		result.user_name = d["user_name"]
	if d.get("title", null) != null:
		result.title = d["title"]
	if d.get("description", null) != null:
		result.description = d["description"]
	if d.get("created_at", null) != null:
		result.created_at = d["created_at"]
	if d.get("published_at", null) != null:
		result.published_at = d["published_at"]
	if d.get("url", null) != null:
		result.url = d["url"]
	if d.get("thumbnail_url", null) != null:
		result.thumbnail_url = d["thumbnail_url"]
	if d.get("viewable", null) != null:
		result.viewable = d["viewable"]
	if d.get("view_count", null) != null:
		result.view_count = d["view_count"]
	if d.get("language", null) != null:
		result.language = d["language"]
	if d.get("type", null) != null:
		result.type = d["type"]
	if d.get("duration", null) != null:
		result.duration = d["duration"]
	if d.get("muted_segments", null) != null:
		for value in d["muted_segments"]:
			result.muted_segments.append(MutedSegments.from_json(value))
	return result



## The segments that Twitch Audio Recognition muted; otherwise, **null**.
## #/components/schemas/Video/MutedSegments
class MutedSegments extends TwitchData:

	## The duration of the muted segment, in seconds.
	@export var duration: int:
		set(val): 
			duration = val
			track_data(&"duration", val)
	
	## The offset, in seconds, from the beginning of the video to where the muted segment begins.
	@export var offset: int:
		set(val): 
			offset = val
			track_data(&"offset", val)
	
	
	
	## Constructor with all required fields.
	static func create(_duration: int, _offset: int) -> MutedSegments:
		var muted_segments: MutedSegments = MutedSegments.new()
		muted_segments.duration = _duration
		muted_segments.offset = _offset
		return muted_segments
	
	
	static func from_json(d: Dictionary) -> MutedSegments:
		var result: MutedSegments = MutedSegments.new()
		if d.get("duration", null) != null:
			result.duration = d["duration"]
		if d.get("offset", null) != null:
			result.offset = d["offset"]
		return result
	