// SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
// SPDX-FileCopyrightText: 2024 Arjen Hiemstra <ahiemstra@heimr.nl>
//
// This file is automatically generated from property.h.j2.
// To regenerate, run `tools/propertygenerator/generate_properties.py`.

#pragma once

// clang-format off

#include <QDebug>


#include "BackgroundPropertyGroup.h"
#include "BorderPropertyGroup.h"
#include "CornersPropertyGroup.h"
#include "DisplayPropertyGroup.h"
#include "IconPropertyGroup.h"
#include "LayoutPropertyGroup.h"
#include "OutlinePropertyGroup.h"
#include "ShadowPropertyGroup.h"
#include "TextPropertyGroup.h"

#include "PropertiesTypes.h"

#include "union_export.h"

// clang-format on

namespace Union
{
namespace Properties
{

class StylePropertyGroupPrivate;

/*!
\class Union::Properties::StylePropertyGroup
\inmodule core
\ingroup core-properties

\brief The root property group for all elements.

This class contains all the properties that are used to style an element.

*/
class UNION_EXPORT StylePropertyGroup
{
public:
    /*!
     * Default constructor. Constructs a null instance.
     *
     * A null instance in this case means an instance that does not have any
     * values for its properties. This includes property groups.
     */
    StylePropertyGroup();
    /*!
     * Copy constructor.
     */
    StylePropertyGroup(const StylePropertyGroup &other);
    /*!
     * Move constructor.
     */
    StylePropertyGroup(StylePropertyGroup &&other);
    ~StylePropertyGroup();

    /*!
     * Copy assignment operator.
     */
    StylePropertyGroup &operator=(const StylePropertyGroup &other);
    /*!
     * Move assignment operator.
     */
    StylePropertyGroup &operator=(StylePropertyGroup &&other);

    /*!
     * \brief A property group containing properties related to how the element is displayed.

     */
    DisplayPropertyGroup *display() const;

    /*!
     * Set the value of display.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setDisplay(std::unique_ptr<DisplayPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties related to the layout of an element.

     */
    LayoutPropertyGroup *layout() const;

    /*!
     * Set the value of layout.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setLayout(std::unique_ptr<LayoutPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties related to the text of an element.

     */
    TextPropertyGroup *text() const;

    /*!
     * Set the value of text.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setText(std::unique_ptr<TextPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties related to an element's icon.

     */
    IconPropertyGroup *icon() const;

    /*!
     * Set the value of icon.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setIcon(std::unique_ptr<IconPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties related to an element's background.

     */
    BackgroundPropertyGroup *background() const;

    /*!
     * Set the value of background.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setBackground(std::unique_ptr<BackgroundPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties of an element's border.
     */
    BorderPropertyGroup *border() const;

    /*!
     * Set the value of border.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setBorder(std::unique_ptr<BorderPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties of an element's outline.
     */
    OutlinePropertyGroup *outline() const;

    /*!
     * Set the value of outline.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setOutline(std::unique_ptr<OutlinePropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties of a background's corners.
     */
    CornersPropertyGroup *corners() const;

    /*!
     * Set the value of corners.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setCorners(std::unique_ptr<CornersPropertyGroup> &&newValue);

    /*!
     * \brief A property group containing properties relating to an element's shadow.
     */
    ShadowPropertyGroup *shadow() const;

    /*!
     * Set the value of shadow.
     *
     * \a newValue The new value or \c{std::nullopt} to unset the value.
     */
    void setShadow(std::unique_ptr<ShadowPropertyGroup> &&newValue);

    /*!
     * Returns if this property group has any value set.
     *
     * Note that for any property that is also a property group, this will also
     * check if that group has any value.
     */
    bool hasAnyValue() const;

    /*!
     * Returns if this property is considered empty.
     *
     * A property is considered empty if it has no values or if the values it
     * contains are all considered empty values.
     */
    bool isEmpty() const;

    /*!
     * Returns a string representation of this property group.
     *
     * This is intended for debugging.
     *
     * \a indentation The amount of indentation to apply. Defaults to 0.
     * \a flags A set of flags that control conversion behavior.
     */
    QString toString(int indentation = 0, ToStringFlags flags = ToStringFlags{}) const;

    /*!
     * Copy property values from source to destination if destination does not have a property value.
     *
     * This will recursively copy property values of grouped properties.
     *
     * \a source      The source property group to copy from.
     * \a destination The destination property group to copy to.
     */
    static void resolveProperties(const StylePropertyGroup *source, StylePropertyGroup *destination);

    /*!
     * Create and return an empty StylePropertyGroup instance.
     *
     * This will create an empty StylePropertyGroup instance, which is defined as
     * an instance with all of its values default-constructed. Note that this is
     * different from a default-constructed instance which will have all its
     * values unset.
     */
    static std::unique_ptr<StylePropertyGroup> empty();

private:
    std::unique_ptr<StylePropertyGroupPrivate> d;
};

/*!
 * \relates Union::Properties::StylePropertyGroup
 * Equality comparison for StylePropertyGroup.
 */
UNION_EXPORT bool operator==(const StylePropertyGroup &left, const StylePropertyGroup &right);
}
}

/*!
 * \relates Union::Properties::StylePropertyGroup
 * QDebug support for StylePropertyGroup.
 */
UNION_EXPORT QDebug operator<<(QDebug debug, Union::Properties::StylePropertyGroup *type);

UNION_EXPORT QDataStream &operator<<(QDataStream &stream, const Union::Properties::StylePropertyGroup *type);
UNION_EXPORT QDataStream &operator>>(QDataStream &stream, std::unique_ptr<Union::Properties::StylePropertyGroup> &type);