"""
AUTOGENERATED USING DOCUMENTATION FROM:
https://api-alpha.antcde.io/docs/2.0/api-docs-v2.json
AT 2024-04-08 12:25:51.574574

FOR AUTO UPDATE OF THE PYTHON PACKAGE, GO TO:
'./dev/generate_models.py
"""


from __future__ import annotations
import requests
from typing import Any, Union

from ant_connect.model_base_class import ModelBaseClass
from ant_connect.enums import HttpMethodType, DataType, Priority



class BaseModel(ModelBaseClass):
	"""Python dataclass for the BaseModel schema"""
	id: Union[str, None] = None
	created_at: Union[str, None] = None
	updated_at: Union[str, None] = None
	deleted_at: Union[str, None] = None
	base64: Union[str, None] = None
	deletedMessage: Union[str, None] = None
	project: Union[dict, None] = None
	table: Union[dict, None] = None
	user: Union[dict, None] = None
	userShort: Union[dict, None] = None
	record: Union[dict, None] = None


class Column(ModelBaseClass):
	"""Python dataclass for the Column schema"""
	id: str
	table: str
	name: str
	type: DataType
	is_unique: Union[bool, None] = None
	required: Union[bool, None] = None
	default_value: Union[str, None] = None
	options_value: Union[list[str], None] = None
	order: Union[int, None] = None

	@classmethod
	def all(cls, table_id: str) -> list[Column]:
		"""Get table columns"""
		endpoint = f"tables/{table_id}/columns"
		response: requests.Response = Column._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Column._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, column_id: str) -> Column:
		"""Get table column"""
		endpoint = f"columns/{column_id}"
		response: requests.Response = Column._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Column._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, column_id: str, name: Union[str, None] = None, required: Union[bool, None] = None, default_value: Union[str, None] = None, order: Union[int, None] = None) -> Column:
		"""Update table column"""
		parameters = {
			'name': name,
			'required': required,
			'default_value': default_value,
			'order': order,
			}

		endpoint = f"columns/{column_id}"
		response: requests.Response = Column._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Column._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, column_id: str) -> MessageResponse:
		"""Delete table column"""
		endpoint = f"columns/{column_id}"
		response: requests.Response = Column._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, name: str, type: DataType, table_id: str, is_unique: Union[bool, None] = False, required: Union[bool, None] = False, default_value: Union[str, None] = None, options_value: Union[list[str], None] = None, order: Union[int, None] = None) -> Column:
		"""Create table column"""
		parameters = {
			'name': name,
			'type': type,
			'is_unique': is_unique,
			'required': required,
			'default_value': default_value,
			'options_value': options_value,
			'order': order,
			'table': table_id,
			}

		endpoint = f"columns"
		response: requests.Response = Column._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Column._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Company(ModelBaseClass):
	"""Python dataclass for the Company schema"""
	id: str
	name: str
	created_at: Union[str, None] = None


class Download(ModelBaseClass):
	"""Python dataclass for the Download schema"""
	id: str
	downloaded: bool
	name: str
	extension: str
	size: float
	mimetype: str

	@classmethod
	def all(cls) -> list[Download]:
		"""Get user downloads"""
		endpoint = f"downloads"
		response: requests.Response = Download._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Download._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, download_id: str) -> Any:
		"""Download file"""
		endpoint = f"downloads/{download_id}"
		response = Download._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return response
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Label(ModelBaseClass):
	"""Python dataclass for the Label schema"""
	id: str
	title: str
	color: str

	@classmethod
	def all(cls, license_id: str, project_id: Union[str, None] = None) -> list[Label]:
		"""Get labels"""
		endpoint = f"licenses/{license_id}/labels"
		response: requests.Response = Label._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Label._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, license_id: str, title: str, color: str, project_id: Union[str, None] = None, description: Union[str, None] = None) -> Label:
		"""Create label"""
		parameters = {
			'license': license_id,
			'project': project_id,
			'title': title,
			'description': description,
			'color': color,
			}

		endpoint = f"labels"
		response: requests.Response = Label._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Label._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, label_id: str, title: Union[str, None] = None, description: Union[str, None] = None, color: Union[str, None] = None) -> Label:
		"""Update label"""
		parameters = {
			'title': title,
			'description': description,
			'color': color,
			}

		endpoint = f"labels/{label_id}"
		response: requests.Response = Label._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Label._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, label_id: str) -> BaseModel.deletedMessage:
		"""Delete label"""
		endpoint = f"labels/{label_id}"
		response: requests.Response = Label._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class License(ModelBaseClass):
	"""Python dataclass for the License schema"""
	id: str
	name: str
	theme: str
	is_admin: Union[bool, None] = None

	@classmethod
	def all(cls) -> list[License]:
		"""Get auth user active licenses"""
		endpoint = f"licenses"
		response: requests.Response = License._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [License._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get_users(cls, license_id: str) -> list[License]:
		"""Get all users on current license"""
		endpoint = f"licenses/{license_id}/users"
		response: requests.Response = License._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [License._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_user(cls, license_id: str, email: str) -> MessageResponse:
		"""Add a user to current license"""
		parameters = {
			'email': email,
			}

		endpoint = f"licenses/{license_id}/users"
		response: requests.Response = License._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def set_access(cls, license_id: str, user_id: str, access: Union[bool, None] = None) -> dict:
		"""Set the license access of a user"""
		parameters = {
			'access': access,
			}

		endpoint = f"licenses/{license_id}/users/{user_id}"
		response: requests.Response = License._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def all_modules(cls, license_id: str) -> list[Module]:
		"""Get all modules within license"""
		endpoint = f"licenses/{license_id}/modules"
		response: requests.Response = License._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Module._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_module(cls, license_id: str, module_id: str) -> MessageResponse:
		"""Add license application"""
		endpoint = f"licenses/{license_id}/modules/{module_id}"
		response: requests.Response = License._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_module(cls, license_id: str, module_id: str) -> MessageResponse:
		"""Delete module from license"""
		endpoint = f"licenses/{license_id}/modules/{module_id}"
		response: requests.Response = License._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_user(cls) -> list[License]:
		"""Update user data"""
		endpoint = f"users"
		response: requests.Response = License._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return [License._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def accept_invite(cls) -> list[License]:
		"""Accept user license invite"""
		endpoint = f"users/invite/accept"
		response: requests.Response = License._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return [License._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_password(cls, old_password: str, new_password: str) -> list[License]:
		"""Update user password"""
		parameters = {
			'old_password': old_password,
			'new_password': new_password,
			}

		endpoint = f"users/password"
		response: requests.Response = License._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return [License._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def reset_password(cls, email: str) -> dict:
		"""Reset user password"""
		parameters = {
			'email': email,
			}

		endpoint = f"users/password/reset"
		response: requests.Response = License._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def reset_password_confirm(cls, token: str, password: str) -> dict:
		"""Confirm reset user password"""
		parameters = {
			'token': token,
			'password': password,
			}

		endpoint = f"users/password/reset/confirm"
		response: requests.Response = License._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Link(ModelBaseClass):
	"""Python dataclass for the Link schema"""
	id: str
	name: str
	link: str
	color: str

	@classmethod
	def all_project(cls, project_id: str) -> list[Link]:
		"""Get project links"""
		endpoint = f"projects/{project_id}/links"
		response: requests.Response = Link._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Link._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_project(cls, project_id: str, name: Union[str, None] = None, link: Union[str, None] = None, color: Union[str, None] = None) -> Link:
		"""Create project link"""
		parameters = {
			'name': name,
			'link': link,
			'color': color,
			}

		endpoint = f"projects/{project_id}/links"
		response: requests.Response = Link._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Link._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_project(cls, project_id: str, link_id: str, name: Union[str, None] = None, color: Union[str, None] = None) -> Link:
		"""Update project link"""
		parameters = {
			'name': name,
			'link': link_id,
			'color': color,
			}

		endpoint = f"projects/{project_id}/links/{link_id}"
		response: requests.Response = Link._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Link._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_project(cls, project_id: str, link_id: str) -> MessageResponse:
		"""Delete project link"""
		endpoint = f"projects/{project_id}/links/{link_id}"
		response: requests.Response = Link._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Member(ModelBaseClass):
	"""Python dataclass for the Member schema"""
	id: Union[str, None] = None
	first_name: Union[str, None] = None
	last_name: Union[str, None] = None
	name: Union[str, None] = None
	email: Union[str, None] = None
	roles: Union[list, None] = None

	@classmethod
	def all_project(cls, project_id: str) -> list[UserShort]:
		"""Get project members"""
		endpoint = f"projects/{project_id}/members"
		response: requests.Response = Member._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [UserShort._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_role_to_project(cls, project_id: str, email: str, role_id: str) -> MessageResponse:
		"""Add role to user"""
		parameters = {
			'email': email,
			'role': role_id,
			}

		endpoint = f"projects/{project_id}/members"
		response: requests.Response = Member._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_role(cls, project_id: str, email: str, role_id: str) -> MessageResponse:
		"""Delete role from project member"""
		parameters = {
			'email': email,
			'role': role_id,
			}

		endpoint = f"projects/{project_id}/members"
		response: requests.Response = Member._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class MessageResponse(ModelBaseClass):
	"""Python dataclass for the MessageResponse schema"""
	message: str


class Module(ModelBaseClass):
	"""Python dataclass for the Module schema"""
	id: str
	name: str
	description: Union[str, None] = None
	icon: str
	route: str
	category: Union[str, None] = None


class NewsItem(ModelBaseClass):
	"""Python dataclass for the NewsItem schema"""
	name: Union[str, None] = None


class Permission(ModelBaseClass):
	"""Python dataclass for the Permission schema"""
	id: str
	group: Union[str, None] = None
	create: bool
	read: bool
	update: bool
	delete: bool
	configure: bool

	@classmethod
	def all(cls, table_id: str) -> list[Permission]:
		"""Get permissions"""
		endpoint = f"tables/{table_id}/permissions"
		response: requests.Response = Permission._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Permission._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, permission_id: str) -> Permission:
		"""Get permission"""
		endpoint = f"permissions/{permission_id}"
		response: requests.Response = Permission._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Permission._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, permission_id: str, create: Union[bool, None] = None, read: Union[bool, None] = None, update: Union[bool, None] = None, delete: Union[bool, None] = None, configure: Union[bool, None] = None) -> Permission:
		"""Update permission"""
		parameters = {
			'create': create,
			'read': read,
			'update': update,
			'delete': delete,
			'configure': configure,
			}

		endpoint = f"permissions/{permission_id}"
		response: requests.Response = Permission._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Permission._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, permission_id: str) -> MessageResponse:
		"""Delete permission"""
		endpoint = f"permissions/{permission_id}"
		response: requests.Response = Permission._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, table_id: str, role_id: str, create: Union[bool, None] = None, read: Union[bool, None] = None, update: Union[bool, None] = None, delete: Union[bool, None] = None, configure: Union[bool, None] = None) -> Permission:
		"""Create permissions"""
		parameters = {
			'create': create,
			'read': read,
			'update': update,
			'delete': delete,
			'configure': configure,
			'table': table_id,
			'role': role_id,
			}

		endpoint = f"permissions"
		response: requests.Response = Permission._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Permission._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Project(ModelBaseClass):
	"""Python dataclass for the Project schema"""
	id: str
	license: Union[str, None] = None
	name: str
	description: str
	number: str
	slug: str
	image: Union[str, None] = None
	is_master: bool
	modules: Union[list, None] = None
	created_at: str

	@classmethod
	def all_modules(cls, project_id: str) -> list[Module]:
		"""Get all modules within project"""
		endpoint = f"projects/{project_id}/modules"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Module._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_module(cls, project_id: str, module_id: str) -> MessageResponse:
		"""Add project application"""
		endpoint = f"projects/{project_id}/modules/{module_id}"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_module(cls, project_id: str, module_id: str) -> MessageResponse:
		"""Delete module from project"""
		endpoint = f"projects/{project_id}/modules/{module_id}"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def all_license(cls, license_id: str) -> list[Project]:
		"""Get all projects within license"""
		endpoint = f"licenses/{license_id}/projects"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Project._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, project_id: str) -> Project:
		"""Get project"""
		endpoint = f"projects/{project_id}"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Project._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, project_id: str, name: Union[str, None] = None, description: Union[str, None] = None, number: Union[str, None] = None, is_archive: Union[str, None] = None) -> Project:
		"""Update project information"""
		parameters = {
			'name': name,
			'description': description,
			'number': number,
			'is_archive': is_archive,
			}

		endpoint = f"projects/{project_id}"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Project._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, project_id: str) -> MessageResponse:
		"""Delete project"""
		endpoint = f"projects/{project_id}"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, name: str, description: str, number: str, license: str) -> Project:
		"""Create new project"""
		parameters = {
			'name': name,
			'description': description,
			'number': number,
			'license': license,
			}

		endpoint = f"projects"
		response: requests.Response = Project._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Project._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def load_image(cls, project_id: str) -> Any:
		"""Fetch project image"""
		endpoint = f"projects/{project_id}/image"
		response = Project._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return response
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Record(ModelBaseClass):
	"""Python dataclass for the Record schema"""
	id: Union[str, None] = None

	@classmethod
	def create(cls, table_id: str, record: Union[dict, None] = None) -> Record:
		"""Create record"""
		parameters = {
			'record': record,
			}

		endpoint = f"tables/{table_id}/records"
		response: requests.Response = Record._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Record._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, table_id: str, records: Union[list, None] = None) -> BaseModel.deletedMessage:
		"""Delete multiple records"""
		parameters = {
			'records': records,
			}

		endpoint = f"tables/{table_id}/records"
		response: requests.Response = Record._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, table_id: str, record_id: str) -> dict:
		"""Update record"""
		parameters = {
			'record': record_id,
			}

		endpoint = f"tables/{table_id}/records/{record_id}"
		response: requests.Response = Record._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get_history(cls, record_id: str, table_id: str) -> dict:
		"""Get record history"""
		endpoint = f"tables/{table_id}/records/{record_id}/history"
		response: requests.Response = Record._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def download_document(cls, document_id: str, record_id: str, table_id: str) -> dict:
		"""Download record document"""
		endpoint = f"tables/{table_id}/records/{record_id}/documents/{document_id}"
		response: requests.Response = Record._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class RecordV2(ModelBaseClass):
	"""Python dataclass for the RecordV2 schema"""


class Relation(ModelBaseClass):
	"""Python dataclass for the Relation schema"""
	id: str
	project: str
	related_project: str
	table: dict
	related_table: dict
	column: dict
	related_column: dict

	@classmethod
	def all(cls, table_id: str) -> list[Relation]:
		"""Get table relations"""
		endpoint = f"ables/{table_id}/relations"
		response: requests.Response = Relation._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Relation._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, table: str, column: str, related_project: str, related_table: str, related_column: Union[str, None] = None) -> Relation:
		"""Create table relation"""
		parameters = {
			'table': table,
			'column': column,
			'related_project': related_project,
			'related_table': related_table,
			'related_column': related_column,
			}

		endpoint = f"relations"
		response: requests.Response = Relation._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Relation._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, relation_id: str) -> MessageResponse:
		"""Delete table relation"""
		endpoint = f"relations/{relation_id}"
		response: requests.Response = Relation._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Revision(ModelBaseClass):
	"""Python dataclass for the Revision schema"""
	id: str
	project: Union[str, None] = None
	table: Union[str, None] = None
	reason: str
	version: float
	timestamp: str


class Role(ModelBaseClass):
	"""Python dataclass for the Role schema"""
	id: str
	name: str
	is_admin: Union[bool, None] = None

	@classmethod
	def all_modules(cls, role_id: str) -> list[Module]:
		"""Get modules with role permission"""
		endpoint = f"roles/{role_id}/modules"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Module._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_module(cls, role_id: str, module_id: str) -> MessageResponse:
		"""Add module to role"""
		endpoint = f"roles/{role_id}/modules/{module_id}"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_module(cls, role_id: str, module_id: str) -> MessageResponse:
		"""Delete module from role"""
		endpoint = f"roles/{role_id}/modules/{module_id}"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def all_project(cls, project_id: str) -> list[Role]:
		"""Get project roles"""
		endpoint = f"projects/{project_id}/roles"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Role._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get_project(cls, role_id: str) -> Role:
		"""Get project role"""
		endpoint = f"roles/{role_id}"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Role._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_project(cls, role_id: str, name: str) -> Role:
		"""Update project role name"""
		parameters = {
			'name': name,
			}

		endpoint = f"roles/{role_id}"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Role._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_project(cls, role_id: str) -> MessageResponse:
		"""Delete project role"""
		endpoint = f"roles/{role_id}"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def add_to_project(cls, name: str, project_id: str) -> Role:
		"""Add role to project"""
		parameters = {
			'name': name,
			'project': project_id,
			}

		endpoint = f"roles"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Role._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_general_permissions(cls, role_id: str, sbs: Union[bool, None] = None, workflows: Union[bool, None] = None, tables: Union[bool, None] = None, tasks: Union[bool, None] = None, labels: Union[bool, None] = None) -> dict:
		"""Update project role general permissions"""
		parameters = {
			'sbs': sbs,
			'workflows': workflows,
			'tables': tables,
			'tasks': tasks,
			'labels': labels,
			}

		endpoint = f"roles/{role_id}/permissions/general"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_sbs_permissions(cls, role_id: str, create: Union[bool, None] = None, update: Union[bool, None] = None, delete: Union[bool, None] = None, is_import: Union[bool, None] = None) -> dict:
		"""Update project role sbs permissions"""
		parameters = {
			'create': create,
			'update': update,
			'delete': delete,
			'is_import': is_import,
			}

		endpoint = f"roles/{role_id}/permissions/sbs"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_workflow_permissions(cls, role_id: str, is_import: Union[bool, None] = None, configure: Union[bool, None] = None, start_session: Union[bool, None] = None) -> dict:
		"""Update project role workflows permissions"""
		parameters = {
			'is_import': is_import,
			'configure': configure,
			'start_session': start_session,
			}

		endpoint = f"roles/{role_id}/permissions/workflows"
		response: requests.Response = Role._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class SbsRecord(ModelBaseClass):
	"""Python dataclass for the SbsRecord schema"""
	code: str
	parent: str
	label: str
	level: Union[int, None] = None
	hasChildren: Union[bool, None] = None

	@classmethod
	def all(cls, project_id: str) -> list[SbsRecord]:
		"""Get project sbs records"""
		endpoint = f"projects/{project_id}/sbs"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [SbsRecord._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def search_sbs_records(cls, project_id: str, code_id: str) -> list[SbsRecord]:
		"""Search in sbs records"""
		endpoint = f"projects/{project_id}/sbs/search"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [SbsRecord._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_sbs_records(cls, project_id: str, code_id: str, parent: Union[str, None] = None, label: Union[str, None] = None) -> SbsRecord:
		"""Update sbs record"""
		parameters = {
			'code': code_id,
			'parent': parent,
			'label': label,
			}

		endpoint = f"projects/{project_id}/sbs/{code_id}"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return SbsRecord._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_sbs_records(cls, project_id: str, code_id: str, parent: Union[str, None] = None, label: Union[str, None] = None) -> SbsRecord:
		"""Create sbs record"""
		parameters = {
			'parent': parent,
			'label': label,
			}

		endpoint = f"projects/{project_id}/sbs/{code_id}"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return SbsRecord._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_sbs_records(cls, project_id: str, code_id: str) -> MessageResponse:
		"""Delete sbs record"""
		endpoint = f"projects/{project_id}/sbs/{code_id}"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class SbsVersion(ModelBaseClass):
	"""Python dataclass for the SbsVersion schema"""
	id: str
	project: str
	user: str
	label: str
	created_at: str


class PersonalAccessToken(ModelBaseClass):
	"""Python dataclass for the PersonalAccessToken schema"""
	id: str
	user_id: Union[str, None] = None
	name: Union[str, None] = None
	revoked: Union[bool, None] = None
	expires_at: Union[str, None] = None

	@classmethod
	def get_tokens(cls) -> list[PersonalAccessToken]:
		"""Get tokens"""
		endpoint = f"oauth/personal-access-tokens"
		response: requests.Response = PersonalAccessToken._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [PersonalAccessToken._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_token(cls, name: Union[str, None] = None, expires_at: Union[str, None] = None) -> AntPersonalAccessTokenResult:
		"""Create token"""
		parameters = {
			'name': name,
			'expires_at': expires_at,
			}

		endpoint = f"tokens"
		response: requests.Response = PersonalAccessToken._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return AntPersonalAccessTokenResult._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update_token(cls, token_id: str, name: str, expires_at: Union[str, None] = None) -> AntPersonalAccessTokenResult:
		"""Update token"""
		parameters = {
			'name': name,
			'expires_at': expires_at,
			}

		endpoint = f"tokens/{token_id}"
		response: requests.Response = PersonalAccessToken._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return AntPersonalAccessTokenResult._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_token(cls, token_id: str) -> BaseModel.deletedMessage:
		"""Delete token"""
		endpoint = f"oauth/personal-access-tokens/{token_id}"
		response: requests.Response = PersonalAccessToken._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class AntPersonalAccessTokenResult(ModelBaseClass):
	"""Python dataclass for the AntPersonalAccessTokenResult schema"""
	token: dict
	accessToken: Union[str, None] = None


class Table(ModelBaseClass):
	"""Python dataclass for the Table schema"""
	id: str
	project: Union[str, None] = None
	name: str
	permissions: Union[dict, None] = None
	created_at: Union[str, None] = None

	@classmethod
	def all(cls, project_id: str) -> list[Table]:
		"""Get project tables"""
		endpoint = f"projects/{project_id}/tables"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [Table._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, table_id: str) -> Table:
		"""Get project table"""
		endpoint = f"tables/{table_id}"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Table._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def update(cls, table_id: str, name: str) -> Table:
		"""Update project table"""
		parameters = {
			'name': name,
			}

		endpoint = f"tables/{table_id}"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.PUT, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Table._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, table_id: str) -> MessageResponse:
		"""Delete project table"""
		endpoint = f"tables/{table_id}"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create(cls, name: str, project_id: str) -> Table:
		"""Create project table"""
		parameters = {
			'name': name,
			'project': project_id,
			}

		endpoint = f"tables"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Table._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def restore(cls, table_id: str, revision_id: str) -> MessageResponse:
		"""Restore project table to a specific revision"""
		endpoint = f"tables/{table_id}/restore/{revision_id}"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def query(cls) -> list[dict]:
		"""Queries records from multiple tables"""
		endpoint = f"tables/query"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def query_export(cls) -> dict:
		"""Queries records from a single table"""
		endpoint = f"tables/query/export"
		response: requests.Response = Table._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return response.json()
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class Task(ModelBaseClass):
	"""Python dataclass for the Task schema"""
	id: str
	license: Union[str, None] = None
	project: Union[str, None] = None
	parent: str
	title: str
	description: str
	number: Union[str, None] = None
	planned_start: str
	planned_end: str
	due: str
	status: list[str]
	priority: Priority
	task_type: Union[dict, None] = None
	task_project: Union[dict, None] = None
	sbscode: dict
	assigned_to: dict
	relations: Union[list, None] = None
	created_by: Union[dict, None] = None
	created_at: Union[str, None] = None

	@classmethod
	def upload_appendix(cls, task_id: str, name: str, extension: str, data: str) -> Task:
		"""Upload task appendix"""
		parameters = {
			'name': name,
			'extension': extension,
			'data': data,
			}

		endpoint = f"tasks/{task_id}/appendixes"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def download_appendix(cls, task_id: str, appendix_id: str) -> Task:
		"""Download task appendix"""
		endpoint = f"tasks/{task_id}/appendixes/{appendix_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_appendix(cls, task_id: str, appendix_id: str) -> Task:
		"""Delete task appendix"""
		endpoint = f"tasks/{task_id}/appendixes/{appendix_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_check(cls, task_id: str, title: str) -> Any:
		"""Create task check"""
		parameters = {
			'title': title,
			}

		endpoint = f"tasks/{task_id}/checks"
		response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return response
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_check(cls, task_check_id: str, task_id: str) -> MessageResponse:
		"""Delete task check"""
		endpoint = f"tasks/{task_id}/checks/{task_check_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def save(cls) -> Task:
		"""Create/Update one or multiple tasks"""
		endpoint = f"tasks"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def get(cls, task_id: str) -> Task:
		"""Get task"""
		endpoint = f"tasks/{task_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def all(cls, license_id: str, advanced_filters: Union[list[dict], None] = None) -> list[Task]:
		"""Get tasks"""
		parameters = {
			'advanced_filters': advanced_filters,
			}

		endpoint = f"icenses/{license_id}/tasks/query"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return [Task._from_json(i) for i in response.json()]
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete(cls, tasks: Union[list[dict], None] = None) -> MessageResponse:
		"""Delete multiple tasks"""
		parameters = {
			'tasks': tasks,
			}

		endpoint = f"tasks/delete"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def execute(cls, task_id: str) -> Any:
		"""Execute task"""
		endpoint = f"tasks/{task_id}/execute"
		response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return response
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_label(cls, task_id: str, label_id: str) -> Label:
		"""Add label to task"""
		endpoint = f"tasks/{task_id}/labels/{label_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint)
		if response.ok:
			return Label._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_label(cls, task_id: str, label_id: str) -> MessageResponse:
		"""Delete label from  task"""
		endpoint = f"tasks/{task_id}/labels/{label_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return MessageResponse._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_message(cls, task_id: str, message: str) -> TaskActivity:
		"""Create task message"""
		parameters = {
			'message': message,
			}

		endpoint = f"tasks/{task_id}/messages"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return TaskActivity._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def create_relation(cls, task_id: str) -> Task:
		"""Create task relation"""
		parameters = {
			'task': task_id,
			}

		endpoint = f"tasks/{task_id}/relations"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.POST, endpoint=endpoint, parameters=parameters)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')

	@classmethod
	def delete_relation(cls, task_id: str, relation_id: str) -> Task:
		"""Delete task relation"""
		endpoint = f"tasks/{task_id}/relations/{relation_id}"
		response: requests.Response = Task._call_api(method_type=HttpMethodType.DELETE, endpoint=endpoint)
		if response.ok:
			return Task._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class TaskActivity(ModelBaseClass):
	"""Python dataclass for the TaskActivity schema"""
	id: Union[str, None] = None
	action: Union[str, None] = None
	column: Union[str, None] = None
	value: Union[str, None] = None
	previous_value: Union[str, None] = None
	type: Union[str, None] = None
	user: Union[dict, None] = None


class TaskCheck(ModelBaseClass):
	"""Python dataclass for the TaskCheck schema"""
	id: Union[str, None] = None
	task: Union[str, None] = None
	title: Union[str, None] = None
	completed: Union[bool, None] = None


class TaskRelation(ModelBaseClass):
	"""Python dataclass for the TaskRelation schema"""
	id: Union[str, None] = None
	task: Union[str, None] = None
	previous_task: Union[str, None] = None
	type: Union[str, None] = None


class TaskType(ModelBaseClass):
	"""Python dataclass for the TaskType schema"""
	type: Union[str, None] = None
	executable: Union[bool, None] = None
	custom_1: Union[str, None] = None
	custom_2: Union[str, None] = None
	custom_3: Union[str, None] = None
	custom_4: Union[str, None] = None
	custom_5: Union[str, None] = None
	metadata: Union[str, None] = None


class User(ModelBaseClass):
	"""Python dataclass for the User schema"""
	id: Union[str, None] = None
	first_name: Union[str, None] = None
	last_name: Union[str, None] = None
	photo: Union[str, None] = None
	name: Union[str, None] = None
	email: Union[str, None] = None
	task_daily_digest: Union[bool, None] = None
	last_active_at: Union[str, None] = None
	two_factor_enabled: Union[bool, None] = None
	password_expires_in: Union[int, None] = None
	licenses: Union[list, None] = None
	roles: Union[list, None] = None
	company: Union[dict, None] = None
	created_at: Union[str, None] = None

	@classmethod
	def get_auth(cls) -> User:
		"""Get authenticated user information"""
		endpoint = f"users"
		response: requests.Response = User._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return User._from_json(response.json())
		else:
			raise ValueError(f'Could not load data from API, response code {response.status_code} with response {response.text}')


class UserShort(ModelBaseClass):
	"""Python dataclass for the UserShort schema"""
	id: Union[str, None] = None
	first_name: Union[str, None] = None
	last_name: Union[str, None] = None
	name: Union[str, None] = None
	email: Union[str, None] = None


class Workflow(ModelBaseClass):
	"""Python dataclass for the Workflow schema"""
	id: Union[str, None] = None
	name: str
	description: Union[str, None] = None
	created_by: Union[dict, None] = None
	created_at: Union[str, None] = None


class WorkflowCollection(ModelBaseClass):
	"""Python dataclass for the WorkflowCollection schema"""
	id: Union[str, None] = None
	name: str
	description: Union[str, None] = None
	created_by: Union[dict, None] = None
	license: str
	created_at: Union[str, None] = None