"""
PySide stub files generated by **IceSpringPySideStubs**

Home: https://baijifeilong.github.io/2022/01/06/ice-spring-pyside-stubs/index.html

Github: https://github.com/baijifeilong/IceSpringPySideStubs

PyPI(PySide2): https://pypi.org/project/IceSpringPySideStubs-PySide2

PyPI(PySide6): https://pypi.org/project/IceSpringPySideStubs-PySide6

PyPI(PyQt5): https://pypi.org/project/IceSpringPySideStubs-PyQt5

PyPI(PyQt6): https://pypi.org/project/IceSpringPySideStubs-PyQt6

Generated by BaiJiFeiLong@gmail.com

License: MIT
"""
import enum
import typing
import PyQt6.sip
from PyQt6.QtCore import *
import enum


class QJsonDocument(PyQt6.sip.simplewrapper):
    """
    https://doc.qt.io/qt-6/qjsondocument.html

    **Detailed Description**

    QJsonDocument is a class that wraps a complete JSON document and can read
    this document from, and write it to, a UTF-8 encoded text-based
    representation.

    A JSON document can be converted from its text-based representation to a
    QJsonDocument using **QJsonDocument::fromJson** (). **toJson** () converts
    it back to text. The parser is very fast and efficient and converts the JSON
    to the binary representation used by Qt.

    Validity of the parsed document can be queried with !**isNull** ()

    A document can be queried as to whether it contains an array or an object
    using **isArray** () and **isObject** (). The array or object contained in
    the document can be retrieved using **array** () or **object** () and then
    read or manipulated.

    **See also** **JSON Support in Qt**  and **JSON Save Game Example** .
    """

    class JsonFormat(enum.Enum):
        Indented: QJsonDocument = ...
        Compact: QJsonDocument = ...

    @typing.overload
    def __init__(self) -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#QJsonDocument

        **QJsonDocument::QJsonDocument()**

        Constructs an empty and invalid document.
        """
        ...

    @typing.overload
    def __init__(
        self,
        object: typing.Dict[
            str,
            typing.Union[
                "QJsonValue",
                "QJsonValue.Type",
                typing.Iterable["QJsonValue"],
                bool,
                int,
                float,
                None,
                str,
            ],
        ],
    ) -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#QJsonDocument-1

        **QJsonDocument::QJsonDocument(const QJsonObject & object )**

        Creates a QJsonDocument from **object**.
        """
        ...

    @typing.overload
    def __init__(self, array: typing.Iterable["QJsonValue"]) -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#QJsonDocument-2

        **QJsonDocument::QJsonDocument(const QJsonArray & array )**

        Constructs a QJsonDocument from **array**.
        """
        ...

    @typing.overload
    def __init__(self, other: "QJsonDocument") -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#QJsonDocument-3

        **QJsonDocument::QJsonDocument(const QJsonDocument & other )**

        Creates a copy of the **other** document.
        """
        ...

    @typing.overload
    def __getitem__(self, i: int) -> "QJsonValue":
        ...

    @typing.overload
    def __getitem__(self, key: str) -> "QJsonValue":
        ...

    def swap(self, other: "QJsonDocument") -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#swap

        **[since 5.10] void QJsonDocument::swap(QJsonDocument & other )**

        Swaps the document **other** with this. This operation is very fast and
        never fails.

        This function was introduced in Qt 5.10.
        """
        ...

    def isNull(self) -> bool:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#isNull

        **bool QJsonDocument::isNull() const**

        returns `true` if this document is null.

        Null documents are documents created through the default constructor.

        Documents created from UTF-8 encoded text or the binary format are
        validated during parsing. If validation fails, the returned document
        will also be null.
        """
        ...

    def setArray(self, array: typing.Iterable["QJsonValue"]) -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#setArray

        **void QJsonDocument::setArray(const QJsonArray & array )**

        Sets **array** as the main object of this document.

        **See also** **setObject** () and **array** ().
        """
        ...

    def setObject(
        self,
        object: typing.Dict[
            str,
            typing.Union[
                "QJsonValue",
                "QJsonValue.Type",
                typing.Iterable["QJsonValue"],
                bool,
                int,
                float,
                None,
                str,
            ],
        ],
    ) -> None:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#setObject

        **void QJsonDocument::setObject(const QJsonObject & object )**

        Sets **object** as the main object of this document.

        **See also** **setArray** () and **object** ().
        """
        ...

    def array(self) -> typing.List["QJsonValue"]:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#array

        **QJsonArray QJsonDocument::array() const**

        Returns the **QJsonArray**  contained in the document.

        Returns an empty array if the document contains an object.

        **See also** **isArray** (), **object** (), and **setArray** ().
        """
        ...

    def object(
        self,
    ) -> typing.Dict[
        str,
        typing.Union[
            "QJsonValue",
            "QJsonValue.Type",
            typing.Iterable["QJsonValue"],
            bool,
            int,
            float,
            None,
            str,
        ],
    ]:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#object

        **QJsonObject QJsonDocument::object() const**

        Returns the **QJsonObject**  contained in the document.

        Returns an empty object if the document contains an array.

        **See also** **isObject** (), **array** (), and **setObject** ().
        """
        ...

    def isObject(self) -> bool:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#isObject

        **bool QJsonDocument::isObject() const**

        Returns `true` if the document contains an object.

        **See also** **object** () and **isArray** ().
        """
        ...

    def isArray(self) -> bool:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#isArray

        **bool QJsonDocument::isArray() const**

        Returns `true` if the document contains an array.

        **See also** **array** () and **isObject** ().
        """
        ...

    def isEmpty(self) -> bool:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#isEmpty

        **bool QJsonDocument::isEmpty() const**

        Returns `true` if the document doesn't contain any data.
        """
        ...

    def toJson(self, format: "QJsonDocument.JsonFormat" = ...) -> QByteArray:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#toJson

        **[since 5.1] QByteArray QJsonDocument::toJson(QJsonDocument::JsonFormat
        format = Indented) const**

        Converts the **QJsonDocument**  to a UTF-8 encoded JSON document in the
        provided **format**.

        This function was introduced in Qt 5.1.

        **See also** **fromJson** () and **JsonFormat** .
        """
        ...

    @staticmethod
    def fromJson(
        json: QByteArray, error: typing.Optional[QJsonParseError] = ...
    ) -> "QJsonDocument":
        """
        https://doc.qt.io/qt-6/qjsondocument.html#fromJson

        **[static] QJsonDocument QJsonDocument::fromJson(const QByteArray & json
        , QJsonParseError * error = nullptr)**

        Parses **json** as a UTF-8 encoded JSON document, and creates a
        **QJsonDocument**  from it.

        Returns a valid (non-null) **QJsonDocument**  if the parsing succeeds.
        If it fails, the returned document will be null, and the optional
        **error** variable will contain further details about the error.

        **See also** **toJson** (), **QJsonParseError** , and **isNull** ().
        """
        ...

    def toVariant(self) -> typing.Any:
        """
        https://doc.qt.io/qt-6/qjsondocument.html#toVariant

        **QVariant QJsonDocument::toVariant() const**

        Returns a **QVariant**  representing the Json document.

        The returned variant will be a QVariantList if the document is a
        **QJsonArray**  and a QVariantMap if the document is a **QJsonObject** .

        **See also** **fromVariant** () and **QJsonValue::toVariant** ().
        """
        ...

    @staticmethod
    def fromVariant(variant: typing.Any) -> "QJsonDocument":
        """
        https://doc.qt.io/qt-6/qjsondocument.html#fromVariant

        **[static] QJsonDocument QJsonDocument::fromVariant(const QVariant &
        variant )**

        Creates a **QJsonDocument**  from the **QVariant**  **variant**.

        If the **variant** contains any other type than a QVariantMap,
        QVariantHash, QVariantList or **QStringList** , the returned document is
        invalid.

        **See also** **toVariant** ().
        """
        ...
