/*
 * 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_TYPES_H
#define PURPLE_ZULIP_TYPES_H

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

#include <purple.h>

G_BEGIN_DECLS

/******************************************************************************
 * Enums
 *****************************************************************************/
typedef enum {
	PURPLE_ZULIP_BOT_TYPE_NONE = 0,
	PURPLE_ZULIP_BOT_TYPE_GENERIC,
	PURPLE_ZULIP_BOT_TYPE_INCOMING_WEBHOOK,
	PURPLE_ZULIP_BOT_TYPE_OUTGOING_WEBHOOK,
	PURPLE_ZULIP_BOT_TYPE_EMBEDDED,
} PurpleZulipBotType;

typedef enum {
	PURPLE_ZULIP_ROLE_ORGANIZATION_OWNER = 100,
	PURPLE_ZULIP_ROLE_ORGANIZATION_ADMINISTRATOR = 200,
	PURPLE_ZULIP_ROLE_ORGANIZATION_MODERATOR = 300,
	PURPLE_ZULIP_ROLE_MEMBER = 400,
	PURPLE_ZULIP_ROLE_GUEST = 600,
} PurpleZulipRole;

/******************************************************************************
 * Message
 *****************************************************************************/
typedef struct {
	char *avatar_url;
	char *client;
	char *content;
	char *content_type;
	/* Object? *display_recipient; */
	/* GList *reactions; */
	char *sender_email;
	char *sender_full_name;
	char *sender_realm_str;
	char *subject;
	/* GList *submessages; */
	/* GList *topic_links; */
	char *type;
	gboolean is_me_message;
	int id;
	int recipient_id;
	int sender_id;
	int stream_id;
	int timestamp;
} PurpleZulipMessage;

#define PURPLE_ZULIP_TYPE_MESSAGE (purple_zulip_message_get_type())

G_GNUC_INTERNAL PurpleZulipMessage *purple_zulip_message_copy(PurpleZulipMessage *message);
G_GNUC_INTERNAL void purple_zulip_message_free(PurpleZulipMessage *message);
G_GNUC_INTERNAL GType purple_zulip_message_get_type(void);

/******************************************************************************
 * User
 *****************************************************************************/
typedef struct {
	char *avatar_url;
	int avatar_version;
	int bot_owner_id;
	PurpleZulipBotType bot_type;
	char *date_joined;
	char *delivery_email;
	char *email;
	char *full_name;
	gboolean is_active;
	gboolean is_admin;
	gboolean is_bot;
	gboolean is_guest;
	gboolean is_imported_stub;
	gboolean is_owner;
	/* Object? profile_data; */
	PurpleZulipRole role;
	char *timezone;
	int user_id;
} PurpleZulipUser;

#define PURPLE_ZULIP_TYPE_USER (purple_zulip_user_get_type())

G_GNUC_INTERNAL PurpleZulipUser *purple_zulip_user_copy(PurpleZulipUser *response);
G_GNUC_INTERNAL void purple_zulip_user_free(PurpleZulipUser *response);
G_GNUC_INTERNAL GType purple_zulip_user_get_type(void);
G_GNUC_INTERNAL PurpleContact *purple_zulip_user_to_contact(PurpleZulipUser *user, PurpleAccount *account);

G_END_DECLS

#endif /* PURPLE_ZULIP_TYPES_H */
