/*
 * Purple Zulip - Zulip Protocol Plugin
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple Zulip is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the COPYRIGHT file distributed with
 * this source distribution.
 *
 * This plugin is free software; you can redistribute it and/or modify it
 * under the terms of the GNU General Public License as published by the Free
 * Software Foundation; either version 2 of the License, or (at your option)
 * any later version.
 *
 * This plugin is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this plugin; if not, see <https://www.gnu.org/licenses/>.
 */

#ifndef PURPLE_ZULIP_RESPONSES_H
#define PURPLE_ZULIP_RESPONSES_H

#include <glib.h>
#include <glib-object.h>

G_BEGIN_DECLS

/* BasicResponse contains all the fields that are common in all responses. */
typedef struct {
	char *code;
	GStrv ignored_parameters;
	char *message;
	char *parameters;
	char *result;
	double retry_after;
	char *var_name;
} PurpleZulipBasicResponse;

#define PURPLE_ZULIP_TYPE_BASIC_RESPONSE (purple_zulip_basic_response_get_type())

G_GNUC_INTERNAL PurpleZulipBasicResponse *purple_zulip_basic_response_copy(PurpleZulipBasicResponse *response);
G_GNUC_INTERNAL void purple_zulip_basic_response_free(PurpleZulipBasicResponse *response);
G_GNUC_INTERNAL GType purple_zulip_basic_response_get_type(void);

/* GetEventsResponse is the response from GET /api/v1/events. */
typedef struct {
	GList *events;
} PurpleZulipGetEventsResponse;

#define PURPLE_ZULIP_TYPE_GET_EVENTS_RESPONSE (purple_zulip_get_events_response_get_type())

G_GNUC_INTERNAL PurpleZulipGetEventsResponse *purple_zulip_get_events_response_copy(PurpleZulipGetEventsResponse *response);
G_GNUC_INTERNAL void purple_zulip_get_events_response_free(PurpleZulipGetEventsResponse *response);
G_GNUC_INTERNAL GType purple_zulip_get_events_response_get_type(void);

/* FetchApiKeyResponse is the response from /api/v1/fetch_api_key */
typedef struct {
	char *api_key;
	char *email;
	char *user_id;
} PurpleZulipFetchApiKeyResponse;

#define PURPLE_ZULIP_TYPE_FETCH_API_KEY_RESPONSE (purple_zulip_fetch_api_key_response_get_type())

G_GNUC_INTERNAL PurpleZulipFetchApiKeyResponse *purple_zulip_fetch_api_key_response_copy(PurpleZulipFetchApiKeyResponse *response);
G_GNUC_INTERNAL void purple_zulip_fetch_api_key_response_free(PurpleZulipFetchApiKeyResponse *response);
G_GNUC_INTERNAL GType purple_zulip_fetch_api_key_response_get_type(void);

/* RegisterEventQueueResponse is the response from POST /api/v1/register */
typedef struct {
	/* GList *alert_words; */
	char *avatar_source;
	char *avatar_url;
	char *avatar_url_medium;
	gboolean can_create_private_streams;
	gboolean can_create_public_streams;
	gboolean can_create_streams;
	gboolean can_create_web_public_streams;
	gboolean can_invite_others_to_realm;
	gboolean can_subscribe_other_users;
	/* GList *channel_folders; */
	/* GList *cross_realm_bots; */
	/* PurpleZulipCustomProfileFields *custom_profile_fields; */
	/* PurpleZulipCustomProfileFieldTypes *custom_profile_field_types; */
	char *delivery_email;
	gint64 demo_organization_scheduled_deletion_date;
	gboolean development_environment;
	/* Object? devices; */
	/* GList *drafts; */
	char *email;
	gint64 event_queue_longpoll_timeout_seconds;
	char *full_name;
	char *giphy_api_key;
	/* Object? gif_rating_policy_options; */
	gboolean has_zoom_token;
	gboolean is_admin;
	gboolean is_guest;
	gboolean is_moderator;
	gboolean is_owner;
	char *jitsi_server_url;
	gint64 last_event_id;
	gint64 max_avatar_file_size_mib;
	gint64 max_bulk_new_subscription_messages;
	gint64 max_channel_folder_description_length;
	gint64 max_channel_folder_name_length;
	gint64 max_file_upload_size_mib;
	gint64 max_icon_file_size_mib;
	gint64 max_logo_file_size_mib;
	gint64 max_message_id;
	gint64 max_message_length;
	gint64 max_reminder_note_length;
	gint64 max_stream_description_length;
	gint64 max_stream_name_length;
	gint64 max_topic_length;
	/* GList *muted_topics; */
	/* GList *muted_users; */
	char *navigation_tour_video_url;
	/* GList *navigation_views; */
	/* GList *never_subscribed; */
	/* GList *onboarding_steps; */
	gint64 password_max_length;
	gint64 password_min_guesses;
	gint64 password_min_length;
	/* Object? presences; */
	gint64 presence_last_update_id;
	char *queue_id;
	gboolean realm_allow_edit_history;
	gboolean realm_allow_message_editing;
	/* Object? realm_authentication_methods; */
	/* Object? realm_available_video_chat_providers; */
	gboolean realm_avatar_changes_disabled;
	/* Object? realm_billing; */
	char *realm_bot_domain;
	/* GList *realm_bots; */
	/* Object? realm_can_access_all_users_group; */
	/* Object? realm_can_add_custom_emoji_group; */
	/* Object? realm_can_add_subscribers_group; */
	/* Object? realm_can_create_groups; */
	/* Object? realm_can_create_bots_group; */
	/* Object? realm_can_create_public_channel_group; */
	/* Object? realm_can_create_private_channel_group; */
	/* Object? realm_can_create_web_public_channel_group; */
	/* Object? realm_can_create_write_only_bots_group; */
	/* Object? realm_can_delete_any_message_group; */
	/* Object? realm_can_delete_own_message_group; */
	/* Object? realm_can_invite_users_group; */
	/* Object? realm_can_manage_all_groups; */
	/* Object? realm_can_manage_billing_group; */
	/* Object? realm_can_mention_many_users_group; */
	/* Object? realm_can_move_messages_between_channels_group; */
	/* Object? realm_can_move_messages_between_topics_group; */
	/* Object? realm_can_resolve_topics_group; */
	/* Object? realm_can_set_delete_message_policy_group; */
	/* Object? realm_can_set_topics_policy_group; */
	/* Object? realm_can_summarize_topics_group; */
	/* Object? realm_create_multiuse_invite_group; */
	gint64 realm_create_public_stream_policy;
	gint64 realm_create_private_stream_policy;
	gint64 realm_create_web_public_stream_policy;
	gint64 realm_date_created;
	char *realm_default_code_block_language;
	char *realm_description;
	gboolean realm_digest_emails_enabled;
	gint64 realm_digest_weekday;
	/* Object? realm_direct_message_initiator_group; */
	/* Object? realm_direct_message_permission_group; */
	gboolean realm_disallow_disposable_email_addresses;
	/* GList *realm_domains; */
	/* GList *realm_embedded_bots; */
	char *realm_default_avatar_source;
	/* Object? realm_default_external_accounts; */
	char *realm_default_language;
	/* GList *realm_default_streams; */
	/* GList *realm_default_stream_groups; */
	gboolean realm_email_auth_enabled;
	gboolean realm_email_changes_disabled;
	gboolean realm_emails_restricted_to_domains;
	/* Object? realm_emoji; */
	char *realm_empty_topic_display_name;
	gboolean realm_enable_guest_user_dm_warning;
	gboolean realm_enable_guest_user_indicator;
	gboolean realm_enable_read_receipts;
	gboolean realm_enable_spectator_access;
	/* GList *realm_filters; */
	gint64 realm_gif_rating_policy;
	char *realm_icon_source;
	char *realm_icon_url;
	/* GList *realm_incoming_webhook_bots; */
	gboolean realm_inline_image_preview;
	gboolean realm_inline_url_embed_preview;
	gboolean realm_invite_required;
	char *realm_jitsi_server_url;
	/* GList *realm_linkifiers; */
	char *realm_logo_source;
	char *realm_logo_url;
	gint64 realm_media_preview_size;
	gboolean realm_message_content_allowed_in_email_notifications;
	gint64 realm_message_content_delete_limit_seconds;
	gint64 realm_message_content_edit_limit_seconds;
	gboolean realm_message_edit_history_visibility_policy;
	gint64 realm_message_retention_days;
	gint64 realm_moderation_request_channel_id;
	gint64 realm_move_messages_between_streams_limit_seconds;
	gint64 realm_move_messages_within_stream_limit_seconds;
	char *realm_name;
	gboolean realm_name_changes_disabled;
	gint64 realm_new_stream_announcements_stream_id;
	char *realm_night_logo_source;
	char *realm_night_logo_url;
	/* GList *realm_non_active_users; */
	gint64 realm_org_type;
	gboolean realm_owner_full_content_access;
	gboolean realm_password_auth_enabled;
	gint64 realm_plan_type;
	/* GList *realm_playgrounds; */
	gboolean realm_presence_disabled;
	gboolean realm_push_notifications_enabled;
	gint64 realm_push_notifications_enabled_end_timestamp;
	gboolean realm_require_e2ee_push_notifications;
	gboolean realm_require_unique_names;
	gboolean realm_send_channel_events_messages;
	gboolean realm_send_welcome_emails;
	gint64 realm_signup_announcements_stream_id;
	char *realm_topics_policy;
	gint64 realm_upload_quota_mib;
	char *realm_uri;
	char *realm_url;
	/* GList *realm_user_groups; */
	/* Object? realm_user_settings_defaults; */
	GPtrArray *realm_users;
	char *realm_uuid;
	gint64 realm_video_chat_provider;
	gint64 realm_waiting_period_threshold;
	gboolean realm_want_advertise_in_communities_directory;
	char *realm_welcome_message_custom_text;
	gint64 realm_wildcard_mention_policy;
	/* Object? realm_workplace_users_group; */
	gint64 realm_zulip_update_announcements_stream_id;
	gboolean receives_typing_notifications;
	/* GList *recent_private_conversations; */
	/* GList *reminders; */
	/* GList *saved_snippets; */
	/* GList *scheduled_messages; */
	gboolean server_avatar_changes_disabled;
	gboolean server_can_summarize_topics;
	char *server_emoji_data_url;
	gint64 server_generation;
	gboolean server_inline_image_preview;
	gboolean server_inline_url_embed_preview;
	char *server_jitsi_server_url;
	gint64 server_min_deactivated_realm_deletion_days;
	gboolean server_name_changes_disabled;
	gboolean server_needs_upgrade;
	gint64 server_presence_offline_threshold_seconds;
	gint64 server_presence_ping_interval_seconds;
	/* GList *server_report_message_types; */
	/* Object? server_supported_permission_settings; */
	/* Object? server_thumbnail_formats; */
	gint64 server_timestamp;
	gint64 server_typing_started_expiry_period_milliseconds;
	gint64 server_typing_started_wait_period_milliseconds;
	gint64 server_typing_stopped_wait_period_milliseconds;
	gboolean server_web_public_streams_enabled;
	gboolean settings_send_digest_emails;
	/* GList *starred_messages; */
	/* GList *stop_words; */
	/* GList *streams; */
	/* GList *subscriptions; */
	/* Object? unread_msgs; */
	/* GList *unsubscribed; */
	char *upgrade_text_for_wide_organization_logo;
	gint64 user_id;
	/* PurpleZulipUserSettings *user_settings; */
	/* PurpleZulipUserStatus *user_status; */
	/* GList *user_topics; */
	gint64 zulip_feature_level;
	char *zulip_merge_base;
	gboolean zulip_plan_is_not_limited;
	char *zulip_version;
} PurpleZulipRegisterEventQueueResponse;

#define PURPLE_ZULIP_TYPE_REGISTER_EVENT_QUEUE_RESPONSE (purple_zulip_register_event_queue_response_get_type())

G_GNUC_INTERNAL PurpleZulipRegisterEventQueueResponse *purple_zulip_register_event_queue_response_copy(PurpleZulipRegisterEventQueueResponse *response);
G_GNUC_INTERNAL void purple_zulip_register_event_queue_response_free(PurpleZulipRegisterEventQueueResponse *response);
G_GNUC_INTERNAL GType purple_zulip_register_event_queue_response_get_type(void);

/* ServerSettingsResponse is the response from /api/v1/server_settings */
typedef struct {
	gboolean email_auth_enabled;
	gboolean is_incompatible;
	gboolean push_notifications_enabled;
	char *zulip_merge_base;
	char *zulip_version;
} PurpleZulipServerSettingsResponse;

#define PURPLE_ZULIP_TYPE_SERVER_SETTINGS_RESPONSE (purple_zulip_server_settings_response_get_type())

G_GNUC_INTERNAL PurpleZulipServerSettingsResponse *purple_zulip_server_settings_response_copy(PurpleZulipServerSettingsResponse *response);
G_GNUC_INTERNAL void purple_zulip_server_settings_response_free(PurpleZulipServerSettingsResponse *response);
G_GNUC_INTERNAL GType purple_zulip_server_settings_response_get_type(void);

G_END_DECLS

#endif /* PURPLE_ZULIP_RESPONSES_H */
