@tool
extends TwitchData

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

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

## The UTC date and time (in RFC3339 format) of the transaction.
@export var timestamp: String:
	set(val): 
		timestamp = val
		track_data(&"timestamp", val)

## The ID of the broadcaster that owns the channel where the transaction occurred.
@export var broadcaster_id: String:
	set(val): 
		broadcaster_id = val
		track_data(&"broadcaster_id", val)

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

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

## The ID of the user that purchased the digital product.
@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)

## The type of transaction. Possible values are:  
##   
## * BITS\_IN\_EXTENSION
@export var product_type: String:
	set(val): 
		product_type = val
		track_data(&"product_type", val)

## Contains details about the digital product.
@export var product_data: ProductData:
	set(val): 
		product_data = val
		track_data(&"product_data", val)
var response: BufferedHTTPClient.ResponseData


## Constructor with all required fields.
static func create(_id: String, _timestamp: String, _broadcaster_id: String, _broadcaster_login: String, _broadcaster_name: String, _user_id: String, _user_login: String, _user_name: String, _product_type: String, _product_data: ProductData) -> TwitchExtensionTransaction:
	var twitch_extension_transaction: TwitchExtensionTransaction = TwitchExtensionTransaction.new()
	twitch_extension_transaction.id = _id
	twitch_extension_transaction.timestamp = _timestamp
	twitch_extension_transaction.broadcaster_id = _broadcaster_id
	twitch_extension_transaction.broadcaster_login = _broadcaster_login
	twitch_extension_transaction.broadcaster_name = _broadcaster_name
	twitch_extension_transaction.user_id = _user_id
	twitch_extension_transaction.user_login = _user_login
	twitch_extension_transaction.user_name = _user_name
	twitch_extension_transaction.product_type = _product_type
	twitch_extension_transaction.product_data = _product_data
	return twitch_extension_transaction


static func from_json(d: Dictionary) -> TwitchExtensionTransaction:
	var result: TwitchExtensionTransaction = TwitchExtensionTransaction.new()
	if d.get("id", null) != null:
		result.id = d["id"]
	if d.get("timestamp", null) != null:
		result.timestamp = d["timestamp"]
	if d.get("broadcaster_id", null) != null:
		result.broadcaster_id = d["broadcaster_id"]
	if d.get("broadcaster_login", null) != null:
		result.broadcaster_login = d["broadcaster_login"]
	if d.get("broadcaster_name", null) != null:
		result.broadcaster_name = d["broadcaster_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("product_type", null) != null:
		result.product_type = d["product_type"]
	if d.get("product_data", null) != null:
		result.product_data = ProductData.from_json(d["product_data"])
	return result



## Contains details about the digital product.
## #/components/schemas/ExtensionTransaction/ProductData
class ProductData extends TwitchData:

	## An ID that identifies the digital product.
	@export var sku: String:
		set(val): 
			sku = val
			track_data(&"sku", val)
	
	## Set to `twitch.ext.` \+ `<the extension's ID>`.
	@export var domain: String:
		set(val): 
			domain = val
			track_data(&"domain", val)
	
	## Contains details about the digital product’s cost.
	@export var cost: Cost:
		set(val): 
			cost = val
			track_data(&"cost", val)
	
	## A Boolean value that determines whether the product is in development. Is **true** if the digital product is in development and cannot be exchanged.
	@export var inDevelopment: bool:
		set(val): 
			inDevelopment = val
			track_data(&"inDevelopment", val)
	
	## The name of the digital product.
	@export var displayName: String:
		set(val): 
			displayName = val
			track_data(&"displayName", val)
	
	## This field is always empty since you may purchase only unexpired products.
	@export var expiration: String:
		set(val): 
			expiration = val
			track_data(&"expiration", val)
	
	## A Boolean value that determines whether the data was broadcast to all instances of the extension. Is **true** if the data was broadcast to all instances.
	@export var broadcast: bool:
		set(val): 
			broadcast = val
			track_data(&"broadcast", val)
	
	
	
	## Constructor with all required fields.
	static func create(_sku: String, _domain: String, _cost: Cost, _inDevelopment: bool, _displayName: String, _expiration: String, _broadcast: bool) -> ProductData:
		var product_data: ProductData = ProductData.new()
		product_data.sku = _sku
		product_data.domain = _domain
		product_data.cost = _cost
		product_data.inDevelopment = _inDevelopment
		product_data.displayName = _displayName
		product_data.expiration = _expiration
		product_data.broadcast = _broadcast
		return product_data
	
	
	static func from_json(d: Dictionary) -> ProductData:
		var result: ProductData = ProductData.new()
		if d.get("sku", null) != null:
			result.sku = d["sku"]
		if d.get("domain", null) != null:
			result.domain = d["domain"]
		if d.get("cost", null) != null:
			result.cost = Cost.from_json(d["cost"])
		if d.get("inDevelopment", null) != null:
			result.inDevelopment = d["inDevelopment"]
		if d.get("displayName", null) != null:
			result.displayName = d["displayName"]
		if d.get("expiration", null) != null:
			result.expiration = d["expiration"]
		if d.get("broadcast", null) != null:
			result.broadcast = d["broadcast"]
		return result
	


## Contains details about the digital product’s cost.
## #/components/schemas/ExtensionTransaction/ProductData/Cost
class Cost extends TwitchData:

	## The amount exchanged for the digital product.
	@export var amount: int:
		set(val): 
			amount = val
			track_data(&"amount", val)
	
	## The type of currency exchanged. Possible values are:  
	##   
	## * bits
	@export var type: String:
		set(val): 
			type = val
			track_data(&"type", val)
	
	
	
	## Constructor with all required fields.
	static func create(_amount: int, _type: String) -> Cost:
		var cost: Cost = Cost.new()
		cost.amount = _amount
		cost.type = _type
		return cost
	
	
	static func from_json(d: Dictionary) -> Cost:
		var result: Cost = Cost.new()
		if d.get("amount", null) != null:
			result.amount = d["amount"]
		if d.get("type", null) != null:
			result.type = d["type"]
		return result
	