dfdb()

/**
 * Global database function.
 *
 * @return Database
 */
function dfdb(): Database;

options()

/**
 * Return Options instance.
 *
 * @return Options
 */
function option(): Options;

get_option()

/**
 * @param string $key
 * @param mixed $default
 * @return mixed
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws ReflectionException
 */
function get_option(string $key, mixed $default = ''): mixed;

update_option()

/**
 * @param string $key
 * @param mixed $value
 * @return mixed
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws ReflectionException
 * @throws TypeException
 */
function update_option(string $key, mixed $value): bool

delete_option()

/**
 * @param string $key
 * @return bool
 * @throws \Exception
 */
function delete_option(string $key): bool;

get_object_subtype()

/**
 * Returns the object subtype for a given array ID of a specific type.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $type Type of array to request attribute for. (e.g. content, user, product).
 * @param string $id ID of the array to retrieve its subtype.
 * @return string The array subtype or an empty string if unspecified subtype.
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws TypeException
 * @throws UnresolvableQueryHandlerException
 */
function get_object_subtype(string $type, string $id): string;

cms_slugify()

/**
 * Creates unique slug based on string.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $title Text to be slugified.
 * @param string $table Table the text is saved to (i.e. content, contenttype, site, product)
 * @return string Slug.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function cms_slugify(string $title, string $table): string;
/**
 * Returns a list of internal links for TinyMCE.
 * 
 * @access private
 *
 * @file core/Shared/Helpers/db.php
 * @return object[]
 * @throws ReflectionException
 * @throws UnresolvableQueryHandlerException
 */
function tinymce_link_list(): array;

if_content_type_slug_exists()

/**
 * Checks if a slug exists among records from the content type table.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $contentTypeId Content Type id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if content type slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_type_slug_exists(string $contentTypeId, string $slug): bool;

if_content_slug_exists()

/**
 * Checks if a slug exists among records from the content table.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $contentId Content id to check against or null.
 * @param string $slug Slug to search for.
 * @param string $contentType The content type to filter.
 * @return bool Returns true if content slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_slug_exists(string $contentId, string $slug, string $contentType): bool;

if_site_slug_exists()

/**
 * Checks if a site slug exists.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $siteId Site id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if site slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_site_slug_exists(string $siteId, string $slug): bool;

if_product_slug_exists()

/**
 * Checks if a product slug exists.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $productId Product id to check against.
 * @param string $slug Slug to search for.
 * @return bool Returns true if site slug exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_product_slug_exists(string $productId, string $slug): bool;

is_content_parent()

/**
 * Checks if content has any children.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $contentId Content id to check.
 * @return bool|array| False if content has no children or array of children if true.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function is_content_parent(string $contentId): bool|array;

if_content_type_exists()

/**
 * Checks if a given content type exists on content.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $contentType Content Type slug to check for.
 * @return bool Returns true if content type exists or false otherwise.
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function if_content_type_exists(string $contentType): bool;

reassign_content()

/**
 * System function: Reassigns content to a different user.
 * 
 * @access private
 *
 * @file core/Shared/Helpers/db.php
 * @param string $userId ID of user being removed.
 * @param string $assignId ID of user to whom content will be assigned.
 * @param string $contentId ID of the content.
 * @return bool
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 * @throws TypeException
 * @throws CommandCouldNotBeHandledException
 * @throws UnresolvableCommandHandlerException
 */
function reassign_content(string $userId, string $assignId, string $contentId): bool;

reassign_sites()

/**
 * System function: Reassigns sites to a different user.
 * 
 * @access private
 *
 * @file core/Shared/Helpers/db.php
 * @param string $userId ID of user being removed.
 * @param array $params User parameters (assign_id and role).
 * @return bool
 * @throws CommandCouldNotBeHandledException
 * @throws CommandPropertyNotFoundException
 * @throws ContainerExceptionInterface
 * @throws Exception
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 * @throws TypeException
 * @throws UnresolvableCommandHandlerException
 */
function reassign_sites(string $userId, array $params = []): bool;

if_user_has_sites()

/**
 * Checks if the requested user is an admin of any sites or has any admin roles.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $userId ID of user to check.
 * @return bool Returns true if user has sites and false otherwise.
 * @throws CommandPropertyNotFoundException
 * @throws Exception
 * @throws ReflectionException
 * @throws TypeException
 * @throws UnresolvableQueryHandlerException
 * @throws ContainerExceptionInterface
 * @throws NotFoundExceptionInterface
 */
function if_user_has_sites(string $userId): bool;

get_owner_sites()

/**
 * Get an array of sites by owner.
 *
 * @file core/Shared/Helpers/db.php
 * @param string $userId The owner's id.
 * @return array
 * @throws CommandPropertyNotFoundException
 * @throws ReflectionException
 * @throws UnresolvableQueryHandlerException
 */
function get_owner_sites(string $userId): array;

populate_options_cache()

/**
 * System function: Populate the option cache.
 *
 * @access private
 * 
 * @file core/Shared/Helpers/db.php
 * @return bool
 * @throws ContainerExceptionInterface
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function populate_options_cache(): bool;

cms_nodeq_login_details()

/**
 * System function: Login Details Email.
 * 
 * @access private
 *
 * Function used to send login details to new
 * user.
 *
 * @file core/Shared/Helpers/db.php
 * @throws ContainerExceptionInterface
 * @throws EnvironmentIsBrokenException
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 * @throws SessionException
 */
function cms_nodeq_login_details(): void;

cms_nodeq_reset_password()

/**
 * System function: Reset Password Email.
 * 
 * @access private
 *
 * Function used to send reset password to a user.
 *
 * @file core/Shared/Helpers/db.php
 * @throws ContainerExceptionInterface
 * @throws EnvironmentIsBrokenException
 * @throws Exception
 * @throws InvalidArgumentException
 * @throws NotFoundExceptionInterface
 * @throws ReflectionException
 */
function cms_nodeq_reset_password(): void;

collection()

/**
 * Creates a new collection based on value (user(s), product(s), content, contenttype, site(s))
 *
 * @file core/Shared/Helpers/db.php
 * @param string|null $value
 * @return Collection
 * @throws CommandPropertyNotFoundException
 * @throws ReflectionException
 * @throws UnresolvableQueryHandlerException
 */
function collection(?string $value = null): Collection;

generate_site_key()

/**
 * A private function for generating unique site key.
 *
 * @access private
 * @param int $length
 * @return string
 */
function generate_site_key(int $length = 6): string;

get_super_admins()

/**
 * Retrieve a list of super admins from site_user.
 *
 * @return array
 * @throws Exception
 */
function get_super_admins(): array;

is_super_admin()

/**
 * Checks whether a user is a super admin.
 *
 * @param string|null $userId
 * @return bool
 * @throws ReflectionException
 * @throws Exception
 */
function is_super_admin(?string $userId = null): bool;