"""
AUTOGENERATED USING DOCUMENTATION FROM:
https://api-alpha.antcde.io/docs/2.0/api-docs-v2.json
AT 2024-05-31 15:10:06.889399

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


from __future__ import annotations
import requests
from typing import Optional

from ant_connect.utils import ModelBaseClass
from ant_connect.enums import HttpMethodType, DataType, Priority
from ant_connect.utils.decorators import preprocess_arguments
from ant_connect.utils.manual_functions import *



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


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

	@classmethod
	def all(cls, table_id: str) -> list[Column]:
		"""Get table columns

		Args:
			table_id(str): ID of table
		"""
		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

		Args:
			column_id(str): ID of 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
	@preprocess_arguments
	def update(cls, column_id: str, name: Optional[str] = None, required: Optional[bool] = None, default_value: Optional[str] = None, order: Optional[int] = None, hint: Optional[str] = None) -> Column:
		"""Update table column

		Args:
			column_id(str): ID of Column
			name(str): For example 'John Doe'
			required(bool): For example 'false'
			default_value(str): For example 'example'
			order(int): For example '10'
			hint(str): For example 'column 1 hint'
		"""
		parameters = {
			'name': name,
			'required': required,
			'default_value': default_value,
			'order': order,
			'hint': hint,
			}

		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

		Args:
			column_id(str): ID of 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
	@preprocess_arguments
	def create(cls, name: str, type: DataType, table_id: str, is_unique: Optional[bool] = False, required: Optional[bool] = False, default_value: Optional[str] = None, options_value: Optional[list[str]] = None, order: Optional[int] = None, hint: Optional[str] = None) -> Column:
		"""Create table column

		Args:
			name(str): For example 'column_1'
			type(DataType): For example '['text', 'text-field', 'integer', 'boolean', 'date', 'link', 'email', 'dropdown', 'document', 'float', 'sbscode', 'table']'
			is_unique(bool): For example 'false'
			required(bool): For example 'false'
			default_value(str): For example 'example'
			options_value(list): For example '['value_1', 'value_2']'
			order(int): For example '10'
			table_id(str): No example available at the moment
			hint(str): For example 'column 1 hint'
		"""
		parameters = {
			'name': name,
			'type': type,
			'is_unique': is_unique,
			'required': required,
			'default_value': default_value,
			'options_value': options_value,
			'order': order,
			'table': table_id,
			'hint': hint,
			}

		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: Optional[str] = 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) -> dict:
		"""Download file

		Args:
			download_id(str): ID of Download
		"""
		endpoint = f"downloads/{download_id}"
		response: requests.Response = Download._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 Label(ModelBaseClass):
	"""Python dataclass for the Label schema"""
	id: str
	title: str
	color: str

	@classmethod
	@preprocess_arguments
	def all(cls, license_id: str, project_id: Optional[str] = None) -> list[Label]:
		"""Get labels

		Args:
			license_id(str): ID of license
			project_id(str): Filter labels based on project id
		"""
		parameters = {
			'project': project_id,
			}

		endpoint = f"licenses/{license_id}/labels"
		response: requests.Response = Label._call_api(method_type=HttpMethodType.GET, endpoint=endpoint, parameters=parameters)
		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
	@preprocess_arguments
	def create(cls, license_id: str, title: str, color: str, project_id: Optional[str] = None, description: Optional[str] = None) -> Label:
		"""Create label

		Args:
			license_id(str): No example available at the moment
			project_id(str): No example available at the moment
			title(str): For example 'title'
			description(str): For example 'description'
			color(str): For example '#DCDCDC'
		"""
		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
	@preprocess_arguments
	def update(cls, label_id: str, title: Optional[str] = None, description: Optional[str] = None, color: Optional[str] = None) -> Label:
		"""Update label

		Args:
			label_id(str): ID of Label
			title(str): For example 'title'
			description(str): For example 'description'
			color(str): For example '#DCDCDC'
		"""
		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

		Args:
			label_id(str): ID of 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: Optional[bool] = 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

		Args:
			license_id(str): ID of 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
	@preprocess_arguments
	def add_user(cls, license_id: str, email: str) -> MessageResponse:
		"""Add a user to current license

		Args:
			license_id(str): ID of license
			email(str): For example 'user@gmail.com'
		"""
		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
	@preprocess_arguments
	def set_access(cls, license_id: str, user_id: str, access: Optional[bool] = None) -> dict:
		"""Set the license access of a user

		Args:
			license_id(str): ID of license
			user_id(str): ID of user
			access(bool): For example 'true'
		"""
		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

		Args:
			license_id(str): ID of 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

		Args:
			license_id(str): ID of License
			module_id(str): ID of Module
		"""
		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

		Args:
			license_id(str): ID of License
			module_id(str): ID of Module
		"""
		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
	@preprocess_arguments
	def update_password(cls, old_password: str, new_password: str) -> list[License]:
		"""Update user password

		Args:
			old_password(str): For example '123456'
			new_password(str): For example '123456'
		"""
		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
	@preprocess_arguments
	def reset_password(cls, email: str) -> dict:
		"""Reset user password

		Args:
			email(str): For example '
     *             '
		"""
		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
	@preprocess_arguments
	def reset_password_confirm(cls, token: str, password: str) -> dict:
		"""Confirm reset user password

		Args:
			token(str): For example ''
			password(str): For example ''
		"""
		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

		Args:
			project_id(str): ID of project
		"""
		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
	@preprocess_arguments
	def create_project(cls, project_id: str, name: Optional[str] = None, link: Optional[str] = None, color: Optional[str] = None) -> Link:
		"""Create project link

		Args:
			project_id(str): ID of project
			name(str): For example 'Google'
			link(str): For example 'https://www.google.com'
			color(str): For example '#FF0000'
		"""
		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
	@preprocess_arguments
	def update_project(cls, project_id: str, link_id: str, name: Optional[str] = None, color: Optional[str] = None) -> Link:
		"""Update project link

		Args:
			project_id(str): ID of project
			link_id(str): ID of link
			name(str): For example 'Google'
			color(str): For example '#FF0000'
		"""
		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

		Args:
			project_id(str): ID of project
			link_id(str): ID of 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: Optional[str] = None
	first_name: Optional[str] = None
	last_name: Optional[str] = None
	name: Optional[str] = None
	email: Optional[str] = None
	roles: Optional[list] = None

	@classmethod
	def all_project(cls, project_id: str) -> list[UserShort]:
		"""Get project members

		Args:
			project_id(str): ID of project
		"""
		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
	@preprocess_arguments
	def add_role_to_project(cls, project_id: str, email: str, role_id: str) -> MessageResponse:
		"""Add role to user

		Args:
			project_id(str): ID of project
			email(str): For example 'user@gmail.com'
			role_id(str): No example available at the moment
		"""
		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
	@preprocess_arguments
	def delete_role(cls, project_id: str, email: str, role_id: str) -> MessageResponse:
		"""Delete role from project member

		Args:
			project_id(str): ID of project
			email(str): For example 'user@gmail.com'
			role_id(str): No example available at the moment
		"""
		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: Optional[str] = None
	icon: str
	route: str
	category: Optional[str] = None


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


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

	@classmethod
	def all(cls, table_id: str) -> list[Permission]:
		"""Get permissions

		Args:
			table_id(str): ID of table
		"""
		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

		Args:
			permission_id(str): ID of 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 delete(cls, permission_id: str) -> MessageResponse:
		"""Delete permission

		Args:
			permission_id(str): ID of 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
	@preprocess_arguments
	def create(cls, table_id: str, role_id: str, create: Optional[bool] = None, read: Optional[bool] = None, update: Optional[bool] = None, delete: Optional[bool] = None, configure: Optional[bool] = None) -> Permission:
		"""Create permissions

		Args:
			create(bool): For example 'true'
			read(bool): For example 'true'
			update(bool): For example 'false'
			delete(bool): For example 'true'
			configure(bool): For example 'false'
			table_id(str): No example available at the moment
			role_id(str): No example available at the moment
		"""
		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: Optional[str] = None
	name: str
	description: str
	number: str
	slug: str
	image: Optional[str] = None
	is_master: bool
	modules: Optional[list] = None
	created_at: str

	@classmethod
	def all_modules(cls, project_id: str) -> list[Module]:
		"""Get all modules within project

		Args:
			project_id(str): ID of Projects
		"""
		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

		Args:
			project_id(str): ID of Projects
			module_id(str): ID of Module
		"""
		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

		Args:
			project_id(str): ID of Projects
			module_id(str): ID of Module
		"""
		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

		Args:
			license_id(str): ID of 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

		Args:
			project_id(str): ID of 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
	@preprocess_arguments
	def update(cls, project_id: str, name: Optional[str] = None, description: Optional[str] = None, number: Optional[str] = None, is_archive: Optional[str] = None) -> Project:
		"""Update project information

		Args:
			project_id(str): ID of project
			name(str): For example 'Projects 1'
			description(str): For example 'description'
			number(str): For example '1'
			is_archive(str): For example 'true'
		"""
		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

		Args:
			project_id(str): ID of 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 find_by_slug(cls, slug_id: str) -> Project:
		"""Find project by slug

		Args:
			slug_id(str): slug of project
		"""
		endpoint = f"projects/slug/{slug_id}/find"
		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
	@preprocess_arguments
	def create(cls, name: str, description: str, number: str, license: str) -> Project:
		"""Create new project

		Args:
			name(str): For example 'Projects 1'
			description(str): For example 'description'
			number(str): For example '1'
			license(str): No example available at the moment
		"""
		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
	@preprocess_arguments
	def favorite(cls, project_id: str, favorite: Optional[bool] = None) -> Project:
		"""favorite project

		Args:
			project_id(str): ID of project
			favorite(bool): For example 'true'
		"""
		parameters = {
			'favorite': favorite,
			}

		endpoint = f"projects/{project_id}/favorite"
		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 load_image(cls, project_id: str) -> dict:
		"""Fetch project image

		Args:
			project_id(str): ID of project
		"""
		endpoint = f"projects/{project_id}/image"
		response: requests.Response = Project._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 Record(ModelBaseClass):
	"""Python dataclass for the Record schema"""
	id: Optional[str] = None

	@classmethod
	@preprocess_arguments
	def create(cls, table_id: str, record: Optional[dict] = None) -> Record:
		"""Create record

		Args:
			table_id(str): ID of table
			record(dict): No example available at the moment
		"""
		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
	@preprocess_arguments
	def delete(cls, table_id: str, records: Optional[list] = None) -> BaseModel.deletedMessage:
		"""Delete multiple records

		Args:
			table_id(str): ID of table
			records(list): No example available at the moment
		"""
		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
	@preprocess_arguments
	def update(cls, table_id: str, record_id: str) -> dict:
		"""Update record

		Args:
			table_id(str): ID of table
			record_id(str): ID of 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

		Args:
			record_id(str): ID of record
			table_id(str): ID of table
		"""
		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

		Args:
			document_id(str): ID of document
			record_id(str): ID of record
			table_id(str): ID of table
		"""
		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

		Args:
			table_id(str): ID of table
		"""
		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
	@preprocess_arguments
	def create(cls, table: str, column: str, related_project: str, related_table: str, related_column: Optional[str] = None) -> Relation:
		"""Create table relation

		Args:
			table(str): No example available at the moment
			column(str): No example available at the moment
			related_project(str): No example available at the moment
			related_table(str): No example available at the moment
			related_column(str): No example available at the moment
		"""
		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

		Args:
			relation_id(str): ID of 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: Optional[str] = None
	table: Optional[str] = None
	reason: str
	version: float
	timestamp: str


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

	@classmethod
	def all_modules(cls, role_id: str) -> list[Module]:
		"""Get modules with role permission

		Args:
			role_id(str): ID of Role
		"""
		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

		Args:
			role_id(str): ID of Role
			module_id(str): ID of Module
		"""
		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

		Args:
			role_id(str): ID of Role
			module_id(str): ID of Module
		"""
		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

		Args:
			project_id(str): ID of project
		"""
		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

		Args:
			role_id(str): ID of 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
	@preprocess_arguments
	def update_project(cls, role_id: str, name: str) -> Role:
		"""Update project role name

		Args:
			role_id(str): ID of Role
			name(str): For example '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

		Args:
			role_id(str): ID of 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
	@preprocess_arguments
	def add_to_project(cls, name: str, project_id: str) -> Role:
		"""Add role to project

		Args:
			name(str): For example 'role 1'
			project_id(str): No example available at the moment
		"""
		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
	@preprocess_arguments
	def update_general_permissions(cls, role_id: str, sbs: Optional[bool] = None, workflows: Optional[bool] = None, tables: Optional[bool] = None, tasks: Optional[bool] = None, labels: Optional[bool] = None) -> dict:
		"""Update project role general permissions

		Args:
			role_id(str): ID of Role
			sbs(bool): For example 'true'
			workflows(bool): For example 'true'
			tables(bool): For example 'true'
			tasks(bool): For example 'false'
			labels(bool): For example 'false'
		"""
		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
	@preprocess_arguments
	def update_sbs_permissions(cls, role_id: str, create: Optional[bool] = None, update: Optional[bool] = None, delete: Optional[bool] = None, is_import: Optional[bool] = None) -> dict:
		"""Update project role sbs permissions

		Args:
			role_id(str): ID of Role
			create(bool): For example 'true'
			update(bool): For example 'true'
			delete(bool): For example 'true'
			is_import(bool): For example 'false'
		"""
		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
	@preprocess_arguments
	def update_workflow_permissions(cls, role_id: str, is_import: Optional[bool] = None, configure: Optional[bool] = None, start_session: Optional[bool] = None) -> dict:
		"""Update project role workflows permissions

		Args:
			role_id(str): ID of Role
			is_import(bool): For example 'false'
			configure(bool): For example 'false'
			start_session(bool): For example 'false'
		"""
		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: Optional[int] = None
	hasChildren: Optional[bool] = None

	@classmethod
	def all(cls, project_id: str) -> list[SbsRecord]:
		"""Get project sbs records

		Args:
			project_id(str): ID of project
		"""
		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
	@preprocess_arguments
	def search_sbs_records(cls, project_id: str, code_id: str) -> list[SbsRecord]:
		"""Search in sbs records

		Args:
			project_id(str): ID of project
			code_id(str): Sbscode
		"""
		parameters = {
			'code': code_id,
			}

		endpoint = f"projects/{project_id}/sbs/search"
		response: requests.Response = SbsRecord._call_api(method_type=HttpMethodType.GET, endpoint=endpoint, parameters=parameters)
		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
	@preprocess_arguments
	def update_sbs_records(cls, project_id: str, code_id: str, parent: Optional[str] = None, label: Optional[str] = None) -> SbsRecord:
		"""Update sbs record

		Args:
			project_id(str): ID of project
			code_id(str): Sbscode
			parent(str): For example '1'
			label(str): For example 'Code 2'
		"""
		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
	@preprocess_arguments
	def create_sbs_records(cls, project_id: str, code_id: str, parent: Optional[str] = None, label: Optional[str] = None) -> SbsRecord:
		"""Create sbs record

		Args:
			project_id(str): ID of project
			code_id(str): Sbscode
			parent(str): For example '1'
			label(str): For example 'Code 2'
		"""
		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

		Args:
			project_id(str): ID of project
			code_id(str): Sbscode
		"""
		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 AntPersonalAccessToken(ModelBaseClass):
	"""Python dataclass for the AntPersonalAccessToken schema"""
	id: str
	user_id: Optional[str] = None
	name: Optional[str] = None
	revoked: Optional[bool] = None
	expires_at: Optional[str] = None

	@classmethod
	def get_tokens(cls) -> list[AntPersonalAccessToken]:
		"""Get tokens
		"""
		endpoint = f"oauth/personal-access-tokens"
		response: requests.Response = AntPersonalAccessToken._call_api(method_type=HttpMethodType.GET, endpoint=endpoint)
		if response.ok:
			return [AntPersonalAccessToken._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
	@preprocess_arguments
	def create_token(cls, name: Optional[str] = None, expires_at: Optional[str] = None) -> AntPersonalAccessTokenResult:
		"""Create token

		Args:
			name(str): For example 'title'
			expires_at(str): No example available at the moment
		"""
		parameters = {
			'name': name,
			'expires_at': expires_at,
			}

		endpoint = f"tokens"
		response: requests.Response = AntPersonalAccessToken._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
	@preprocess_arguments
	def update_token(cls, token_id: str, name: str, expires_at: Optional[str] = None) -> AntPersonalAccessTokenResult:
		"""Update token

		Args:
			token_id(str): ID of token
			name(str): For example 'title'
			expires_at(str): No example available at the moment
		"""
		parameters = {
			'name': name,
			'expires_at': expires_at,
			}

		endpoint = f"tokens/{token_id}"
		response: requests.Response = AntPersonalAccessToken._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

		Args:
			token_id(str): ID of token
		"""
		endpoint = f"oauth/personal-access-tokens/{token_id}"
		response: requests.Response = AntPersonalAccessToken._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: Optional[str] = None


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

	@classmethod
	def all(cls, project_id: str) -> list[Table]:
		"""Get project tables

		Args:
			project_id(str): ID of project
		"""
		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

		Args:
			table_id(str): ID of 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
	@preprocess_arguments
	def update(cls, table_id: str, name: str) -> Table:
		"""Update project table

		Args:
			table_id(str): ID of table
			name(str): For example 'Collection 1'
		"""
		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

		Args:
			table_id(str): ID of 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
	@preprocess_arguments
	def create(cls, name: str, project_id: str) -> Table:
		"""Create project table

		Args:
			name(str): For example 'Collection 1'
			project_id(str): No example available at the moment
		"""
		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

		Args:
			table_id(str): ID of table
			revision_id(str): ID of 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: Optional[str] = None
	project: Optional[str] = None
	parent: str
	title: str
	description: str
	number: Optional[str] = None
	planned_start: str
	planned_end: str
	due: str
	status: str
	priority: Priority
	task_type: Optional[dict] = None
	task_project: Optional[dict] = None
	sbscode: dict
	assigned_to: dict
	relations: Optional[list] = None
	created_by: Optional[dict] = None
	created_at: Optional[str] = None

	@classmethod
	@preprocess_arguments
	def upload_appendix(cls, task_id: str, name: str, extension: str, data: str) -> Task:
		"""Upload task appendix

		Args:
			task_id(str): ID of task
			name(str): For example 'image'
			extension(str): For example 'jpg'
			data(str): For example 'iVBORw0KGgoAAAANSUhEUgAAADIAAAAyCAYAAAAeP4ixAAAARklEQVR42u3PQREAAAQAMP761xGNDL5ua7CsmI4=='
		"""
		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

		Args:
			task_id(str): ID of task
			appendix_id(str): ID of 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

		Args:
			task_id(str): ID of task
			appendix_id(str): ID of 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
	@preprocess_arguments
	def create_check(cls, task_id: str, title: str) -> dict:
		"""Create task check

		Args:
			task_id(str): ID of task
			title(str): For example 'Check 1'
		"""
		parameters = {
			'title': title,
			}

		endpoint = f"tasks/{task_id}/checks"
		response: requests.Response = Task._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 delete_check(cls, task_check_id: str, task_id: str) -> MessageResponse:
		"""Delete task check

		Args:
			task_check_id(str): ID of task
			task_id(str): ID of task
		"""
		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

		Args:
			task_id(str): ID of 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
	@preprocess_arguments
	def all(cls, license_id: str, advanced_filters: Optional[list[dict]] = None) -> list[Task]:
		"""Get tasks

		Args:
			license_id(str): ID of license
			advanced_filters(list): No example available at the moment
		"""
		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
	@preprocess_arguments
	def delete(cls, tasks: Optional[list[dict]] = None) -> MessageResponse:
		"""Delete multiple tasks

		Args:
			tasks(list): For example '[{'id': '54d7c0bb-a17d-44c4-8e94-f8e5b961ff7d', 'method': 'single'}, {'id': 'ca9912cf-5c59-4424-a5e6-bc86c37ab25a', 'method': 'with-subtasks'}]'
		"""
		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) -> dict:
		"""Execute task

		Args:
			task_id(str): ID of task
		"""
		endpoint = f"tasks/{task_id}/execute"
		response: requests.Response = Task._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 create_label(cls, task_id: str, label_id: str) -> Label:
		"""Add label to task

		Args:
			task_id(str): ID of task
			label_id(str): ID of label
		"""
		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

		Args:
			task_id(str): ID of task
			label_id(str): ID of label
		"""
		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
	@preprocess_arguments
	def create_message(cls, task_id: str, message: str) -> TaskActivity:
		"""Create task message

		Args:
			task_id(str): ID of task
			message(str): For example '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
	@preprocess_arguments
	def create_relation(cls, task_id: str) -> Task:
		"""Create task relation

		Args:
			task_id(str): ID of task
		"""
		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

		Args:
			task_id(str): ID of task
			relation_id(str): ID of 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: Optional[str] = None
	action: Optional[str] = None
	column: Optional[str] = None
	value: Optional[str] = None
	previous_value: Optional[str] = None
	type: Optional[str] = None
	user: Optional[dict] = None


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


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


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


class User(ModelBaseClass):
	"""Python dataclass for the User schema"""
	id: Optional[str] = None
	first_name: Optional[str] = None
	last_name: Optional[str] = None
	photo: Optional[str] = None
	name: Optional[str] = None
	email: Optional[str] = None
	task_daily_digest: Optional[bool] = None
	last_active_at: Optional[str] = None
	two_factor_enabled: Optional[bool] = None
	password_expires_in: Optional[int] = None
	licenses: Optional[list] = None
	roles: Optional[list] = None
	company: Optional[dict] = None
	created_at: Optional[str] = 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: Optional[str] = None
	first_name: Optional[str] = None
	last_name: Optional[str] = None
	name: Optional[str] = None
	email: Optional[str] = None


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


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