/*
 * Copyright (C) Birb Developers
 *
 * Birb is the legal property of its developers, whose names are too numerous
 * to list here. Please refer to the AUTHORS file distributed with this source
 * distribution
 *
 * This library is free software; you can redistribute it and/or modify it
 * under the terms of the GNU Lesser General Public License as published by the
 * Free Software Foundation; either version 2.1 of the License, or (at your
 * option) any later version.
 *
 * This library 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 Lesser General Public License
 * for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this library; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(BIRB_GLOBAL_HEADER_INSIDE) && !defined(BIRB_COMPILATION)
# error "only <birb.h> may be included directly"
#endif

#ifndef BIRB_ATTR_H
#define BIRB_ATTR_H

#include <glib.h>

#include <pango/pango.h>

#include "birbversion.h"

G_BEGIN_DECLS

/**
 * BirbMention:
 * @BIRB_MENTION_KEYWORD: A user specific keyword was mentioned.
 * @BIRB_MENTION_USER: A user has been mentioned directly.
 * @BIRB_MENTION_GROUP: A small group of users were mentioned.
 * @BIRB_MENTION_BROADCAST: A large group of users were mentioned. For example,
 *  @here, @channel, @all, @everyone, etc.
 * @BIRB_MENTION_CONVERSATION: A conversation was mentioned.
 *
 * The different types of mentions.
 *
 * Since: 0.8
 */
typedef enum {
	BIRB_MENTION_KEYWORD BIRB_AVAILABLE_ENUMERATOR_IN_0_8,
	BIRB_MENTION_USER BIRB_AVAILABLE_ENUMERATOR_IN_0_8,
	BIRB_MENTION_GROUP BIRB_AVAILABLE_ENUMERATOR_IN_0_8,
	BIRB_MENTION_BROADCAST BIRB_AVAILABLE_ENUMERATOR_IN_0_8,
	BIRB_MENTION_CONVERSATION BIRB_AVAILABLE_ENUMERATOR_IN_0_8,
} BirbMention;

/**
 * BIRB_ATTR_MENTION:
 *
 * The [enum@Pango.AttrType] for the mention attribute.
 *
 * Since: 0.8
 */
BIRB_VAR PangoAttrType BIRB_ATTR_MENTION;

/**
 * BirbAttrMention:
 * @attr: the common portion of the attribute
 * @type: the type of mention
 * @id: (nullable): the id of who/what was mentioned
 * @color: (nullable): an optional RGB hex color code
 *
 * Holds all data for a mention as a [struct@Pango.Attribute].
 *
 * This should be added to a [struct@Pango.AttrList] when creating or reading
 * messages to attach the mention data to the text it belongs to. The literal
 * text is what will be displayed, but this data can be used by everything
 * else.
 *
 * Since: 0.8
 */
BIRB_AVAILABLE_TYPE_IN_0_8
typedef struct {
	PangoAttribute attr;
	BirbMention type;
	char *id;
	char *color;
} BirbAttrMention;

/**
 * birb_attr_mention_new:
 * @type: the type of mention
 * @id: (nullable): the id of who/what was mentioned
 * @color: (nullable): the RGB hex code
 *
 * Creates a new [struct@Pango.Attribute] to represent a "mention"
 *
 * Returns: (transfer full): The newly allocated #PangoAttribute, which should
 *          be freed with pango_attribute_destroy().
 *
 * Since: 0.8
 */
BIRB_AVAILABLE_IN_0_8
PangoAttribute *birb_attr_mention_new(BirbMention type, const char *id, const char *color);

G_END_DECLS

#endif /* BIRB_ATTR_H */
