@tool
extends TwitchData

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

class_name TwitchGetUnbanRequests
	


## 
## #/components/schemas/GetUnbanRequestsResponse
class Response extends TwitchData:

	## A list that contains information about the channel's unban requests.
	@export var data: Array[ResponseData]:
		set(val): 
			data = val
			track_data(&"data", val)
	
	## Contains information used to page through a list of results. The object is empty if there are no more pages left to page through.
	@export var pagination: ResponsePagination:
		set(val): 
			pagination = val
			track_data(&"pagination", val)
	var response: BufferedHTTPClient.ResponseData
	
	
	## Constructor with all required fields.
	static func create(_data: Array[ResponseData]) -> Response:
		var response: Response = Response.new()
		response.data = _data
		return response
	
	
	static func from_json(d: Dictionary) -> Response:
		var result: Response = Response.new()
		if d.get("data", null) != null:
			for value in d["data"]:
				result.data.append(ResponseData.from_json(value))
		if d.get("pagination", null) != null:
			result.pagination = ResponsePagination.from_json(d["pagination"])
		return result
	
	
	
	func _has_pagination() -> bool:
		if pagination == null: return false
		if pagination.cursor == null || pagination.cursor == "": return false
		return true
	
	var _next_page: Callable
	var _cur_iter: int = 0
	
	
	func next_page() -> Response:
		var response: Response = await _next_page.call()
		_cur_iter = 0
		_next_page = response._next_page
		data = response.data
		pagination = response.pagination
	
		return response
	
	
	func _iter_init(iter: Array) -> bool:
		if data.is_empty(): return false
		iter[0] = data[0]
		return data.size() > 0
		
		
	func _iter_next(iter: Array) -> bool:
		if data.size() - 1 > _cur_iter:
			_cur_iter += 1
			iter[0] = data[_cur_iter]
		if data.size() - 1 == _cur_iter && not _has_pagination(): 
			return false
		return true
		
		
	func _iter_get(iter: Variant) -> Variant:
		if data.size() - 1 == _cur_iter && _has_pagination():
			await next_page()
		return iter


## A list that contains information about the channel's unban requests.
## #/components/schemas/GetUnbanRequestsResponse/Data
class ResponseData extends TwitchData:

	## Unban request ID.
	@export var id: String:
		set(val): 
			id = val
			track_data(&"id", val)
	
	## User ID of broadcaster whose channel is receiving the unban request.
	@export var broadcaster_id: String:
		set(val): 
			broadcaster_id = val
			track_data(&"broadcaster_id", val)
	
	## The broadcaster's display name.
	@export var broadcaster_name: String:
		set(val): 
			broadcaster_name = val
			track_data(&"broadcaster_name", val)
	
	## The broadcaster's login name.
	@export var broadcaster_login: String:
		set(val): 
			broadcaster_login = val
			track_data(&"broadcaster_login", val)
	
	## User ID of moderator who approved/denied the request.
	@export var moderator_id: String:
		set(val): 
			moderator_id = val
			track_data(&"moderator_id", val)
	
	## The moderator's login name.
	@export var moderator_login: String:
		set(val): 
			moderator_login = val
			track_data(&"moderator_login", val)
	
	## The moderator's display name.
	@export var moderator_name: String:
		set(val): 
			moderator_name = val
			track_data(&"moderator_name", val)
	
	## User ID of the requestor who is asking for an unban.
	@export var user_id: String:
		set(val): 
			user_id = val
			track_data(&"user_id", val)
	
	## The user's login name.
	@export var user_login: String:
		set(val): 
			user_login = val
			track_data(&"user_login", val)
	
	## The user's display name.
	@export var user_name: String:
		set(val): 
			user_name = val
			track_data(&"user_name", val)
	
	## Text of the request from the requesting user.
	@export var text: String:
		set(val): 
			text = val
			track_data(&"text", val)
	
	## Status of the request. One of:  
	##   
	## * pending
	## * approved
	## * denied
	## * acknowledged
	## * canceled
	@export var status: String:
		set(val): 
			status = val
			track_data(&"status", val)
	
	## Timestamp of when the unban request was created.
	@export var created_at: String:
		set(val): 
			created_at = val
			track_data(&"created_at", val)
	
	## Timestamp of when moderator/broadcaster approved or denied the request.
	@export var resolved_at: String:
		set(val): 
			resolved_at = val
			track_data(&"resolved_at", val)
	
	## Text input by the resolver (moderator) of the unban. request
	@export var resolution_text: String:
		set(val): 
			resolution_text = val
			track_data(&"resolution_text", val)
	
	
	
	## Constructor with all required fields.
	static func create(_id: String, _broadcaster_id: String, _broadcaster_name: String, _broadcaster_login: String, _moderator_id: String, _moderator_login: String, _moderator_name: String, _user_id: String, _user_login: String, _user_name: String, _text: String, _status: String, _created_at: String, _resolved_at: String, _resolution_text: String) -> ResponseData:
		var response_data: ResponseData = ResponseData.new()
		response_data.id = _id
		response_data.broadcaster_id = _broadcaster_id
		response_data.broadcaster_name = _broadcaster_name
		response_data.broadcaster_login = _broadcaster_login
		response_data.moderator_id = _moderator_id
		response_data.moderator_login = _moderator_login
		response_data.moderator_name = _moderator_name
		response_data.user_id = _user_id
		response_data.user_login = _user_login
		response_data.user_name = _user_name
		response_data.text = _text
		response_data.status = _status
		response_data.created_at = _created_at
		response_data.resolved_at = _resolved_at
		response_data.resolution_text = _resolution_text
		return response_data
	
	
	static func from_json(d: Dictionary) -> ResponseData:
		var result: ResponseData = ResponseData.new()
		if d.get("id", null) != null:
			result.id = d["id"]
		if d.get("broadcaster_id", null) != null:
			result.broadcaster_id = d["broadcaster_id"]
		if d.get("broadcaster_name", null) != null:
			result.broadcaster_name = d["broadcaster_name"]
		if d.get("broadcaster_login", null) != null:
			result.broadcaster_login = d["broadcaster_login"]
		if d.get("moderator_id", null) != null:
			result.moderator_id = d["moderator_id"]
		if d.get("moderator_login", null) != null:
			result.moderator_login = d["moderator_login"]
		if d.get("moderator_name", null) != null:
			result.moderator_name = d["moderator_name"]
		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("text", null) != null:
			result.text = d["text"]
		if d.get("status", null) != null:
			result.status = d["status"]
		if d.get("created_at", null) != null:
			result.created_at = d["created_at"]
		if d.get("resolved_at", null) != null:
			result.resolved_at = d["resolved_at"]
		if d.get("resolution_text", null) != null:
			result.resolution_text = d["resolution_text"]
		return result
	


## Contains information used to page through a list of results. The object is empty if there are no more pages left to page through.
## #/components/schemas/GetUnbanRequestsResponse/Pagination
class ResponsePagination extends TwitchData:

	## The cursor used to get the next page of results. Use the cursor to set the request’s after query parameter.
	@export var cursor: String:
		set(val): 
			cursor = val
			track_data(&"cursor", val)
	
	
	
	## Constructor with all required fields.
	static func create() -> ResponsePagination:
		var response_pagination: ResponsePagination = ResponsePagination.new()
		return response_pagination
	
	
	static func from_json(d: Dictionary) -> ResponsePagination:
		var result: ResponsePagination = ResponsePagination.new()
		if d.get("cursor", null) != null:
			result.cursor = d["cursor"]
		return result
	


## All optional parameters for TwitchAPI.get_unban_requests
## #/components/schemas/GetUnbanRequestsOpt
class Opt extends TwitchData:

	## The ID used to filter what unban requests are returned.
	@export var user_id: String:
		set(val): 
			user_id = val
			track_data(&"user_id", val)
	
	## Cursor used to get next page of results. Pagination object in response contains cursor value.
	@export var after: String:
		set(val): 
			after = val
			track_data(&"after", val)
	
	## The maximum number of items to return per page in response
	@export var first: int:
		set(val): 
			first = val
			track_data(&"first", val)
	
	
	
	## Constructor with all required fields.
	static func create() -> Opt:
		var opt: Opt = Opt.new()
		return opt
	
	
	static func from_json(d: Dictionary) -> Opt:
		var result: Opt = Opt.new()
		if d.get("user_id", null) != null:
			result.user_id = d["user_id"]
		if d.get("after", null) != null:
			result.after = d["after"]
		if d.get("first", null) != null:
			result.first = d["first"]
		return result
	