/*
 * Copyright (C) 2024 UBPorts Foundation
 *
 * WARNING: This is a generated file. Do not modify directly.
 * Any changes made to this file will be overwritten.
 * 
 * Generated on: 2024-07-26
 * Generated by: TELEports tlparser.py
 * 
 * For any modifications, please edit the source templates and regenerate this file.
 */

#include "qtdchatadministratorrights.h"

#include <QJsonObject>
#include <QJsonArray>

QTdChatAdministratorRights::QTdChatAdministratorRights(QObject *parent)
    : QTdObject(parent)
{
}

QTdChatAdministratorRights::QTdChatAdministratorRights(QObject *parent, bool canManageChat_, bool canChangeInfo_, bool canPostMessages_, bool canEditMessages_, bool canDeleteMessages_, bool canInviteUsers_, bool canRestrictMembers_, bool canPinMessages_, bool canManageTopics_, bool canPromoteMembers_, bool canManageVideoChats_, bool isAnonymous_)
    : QTdObject(parent),
    m_canManageChat(canManageChat_),
    m_canChangeInfo(canChangeInfo_),
    m_canPostMessages(canPostMessages_),
    m_canEditMessages(canEditMessages_),
    m_canDeleteMessages(canDeleteMessages_),
    m_canInviteUsers(canInviteUsers_),
    m_canRestrictMembers(canRestrictMembers_),
    m_canPinMessages(canPinMessages_),
    m_canManageTopics(canManageTopics_),
    m_canPromoteMembers(canPromoteMembers_),
    m_canManageVideoChats(canManageVideoChats_),
    m_isAnonymous(isAnonymous_) {
}

bool QTdChatAdministratorRights::canManageChat() const {
    return m_canManageChat;
}

void QTdChatAdministratorRights::setCanManageChat(bool value) {
    if (m_canManageChat != value) {
        m_canManageChat = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canChangeInfo() const {
    return m_canChangeInfo;
}

void QTdChatAdministratorRights::setCanChangeInfo(bool value) {
    if (m_canChangeInfo != value) {
        m_canChangeInfo = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canPostMessages() const {
    return m_canPostMessages;
}

void QTdChatAdministratorRights::setCanPostMessages(bool value) {
    if (m_canPostMessages != value) {
        m_canPostMessages = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canEditMessages() const {
    return m_canEditMessages;
}

void QTdChatAdministratorRights::setCanEditMessages(bool value) {
    if (m_canEditMessages != value) {
        m_canEditMessages = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canDeleteMessages() const {
    return m_canDeleteMessages;
}

void QTdChatAdministratorRights::setCanDeleteMessages(bool value) {
    if (m_canDeleteMessages != value) {
        m_canDeleteMessages = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canInviteUsers() const {
    return m_canInviteUsers;
}

void QTdChatAdministratorRights::setCanInviteUsers(bool value) {
    if (m_canInviteUsers != value) {
        m_canInviteUsers = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canRestrictMembers() const {
    return m_canRestrictMembers;
}

void QTdChatAdministratorRights::setCanRestrictMembers(bool value) {
    if (m_canRestrictMembers != value) {
        m_canRestrictMembers = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canPinMessages() const {
    return m_canPinMessages;
}

void QTdChatAdministratorRights::setCanPinMessages(bool value) {
    if (m_canPinMessages != value) {
        m_canPinMessages = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canManageTopics() const {
    return m_canManageTopics;
}

void QTdChatAdministratorRights::setCanManageTopics(bool value) {
    if (m_canManageTopics != value) {
        m_canManageTopics = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canPromoteMembers() const {
    return m_canPromoteMembers;
}

void QTdChatAdministratorRights::setCanPromoteMembers(bool value) {
    if (m_canPromoteMembers != value) {
        m_canPromoteMembers = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::canManageVideoChats() const {
    return m_canManageVideoChats;
}

void QTdChatAdministratorRights::setCanManageVideoChats(bool value) {
    if (m_canManageVideoChats != value) {
        m_canManageVideoChats = value;
        emit dataChanged();
    }
}

bool QTdChatAdministratorRights::isAnonymous() const {
    return m_isAnonymous;
}

void QTdChatAdministratorRights::setIsAnonymous(bool value) {
    if (m_isAnonymous != value) {
        m_isAnonymous = value;
        emit dataChanged();
    }
}

QJsonObject QTdChatAdministratorRights::marshalJson() {
    return QJsonObject{
        { "@type", QTdObject::typeString() },
        { "can_manage_chat", m_canManageChat },
        { "can_change_info", m_canChangeInfo },
        { "can_post_messages", m_canPostMessages },
        { "can_edit_messages", m_canEditMessages },
        { "can_delete_messages", m_canDeleteMessages },
        { "can_invite_users", m_canInviteUsers },
        { "can_restrict_members", m_canRestrictMembers },
        { "can_pin_messages", m_canPinMessages },
        { "can_manage_topics", m_canManageTopics },
        { "can_promote_members", m_canPromoteMembers },
        { "can_manage_video_chats", m_canManageVideoChats },
        { "is_anonymous", m_isAnonymous }
    };
}

void QTdChatAdministratorRights::unmarshalJson(const QJsonObject &json) {
    QJsonObject jsonObj;
    QJsonArray jsonArray;

    QTdObject::unmarshalJson(json);
    m_canManageChat = json["can_manage_chat"].toBool();
    m_canChangeInfo = json["can_change_info"].toBool();
    m_canPostMessages = json["can_post_messages"].toBool();
    m_canEditMessages = json["can_edit_messages"].toBool();
    m_canDeleteMessages = json["can_delete_messages"].toBool();
    m_canInviteUsers = json["can_invite_users"].toBool();
    m_canRestrictMembers = json["can_restrict_members"].toBool();
    m_canPinMessages = json["can_pin_messages"].toBool();
    m_canManageTopics = json["can_manage_topics"].toBool();
    m_canPromoteMembers = json["can_promote_members"].toBool();
    m_canManageVideoChats = json["can_manage_video_chats"].toBool();
    m_isAnonymous = json["is_anonymous"].toBool();

    emit dataChanged();
}

