/*
 * Purple - Internet Messaging Library
 * Copyright (C) Pidgin Developers <devel@pidgin.im>
 *
 * Purple 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 library 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 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 General Public License for
 * more details.
 *
 * You should have received a copy of the GNU General Public License along with
 * this library; if not, see <https://www.gnu.org/licenses/>.
 */

#if !defined(PURPLE_GLOBAL_HEADER_INSIDE) && !defined(PURPLE_COMPILATION)
# error "only <purple.h> may be included directly"
#endif

#ifndef PURPLE_ATTACHMENTS_H
#define PURPLE_ATTACHMENTS_H

#include <glib.h>
#include <gio/gio.h>

#include "purpleattachment.h"
#include "purpleversion.h"

G_BEGIN_DECLS

#define PURPLE_TYPE_ATTACHMENTS (purple_attachments_get_type())

/**
 * PurpleAttachments:
 *
 * A collection of [class@Attachment]'s.
 *
 * This implements [iface@Gio.ListModel] and should be accessed via that API.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
G_DECLARE_FINAL_TYPE(PurpleAttachments, purple_attachments, PURPLE, ATTACHMENTS,
                     GObject)

/**
 * purple_attachments_add_attachment:
 * @attachment: (transfer none): the attachment to add
 *
 * Adds an attachment to the collection.
 *
 * No sorting will be done, but if @attachment is already in the collection it
 * will not be added again.
 *
 * Returns: true if the item was added; otherwise false.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
gboolean purple_attachments_add_attachment(PurpleAttachments *attachments, PurpleAttachment *attachment);

/**
 * purple_attachments_find_with_id:
 * @id: the id
 *
 * Looks for an attachment matching the given id.
 *
 * Returns: (transfer none) (nullable): The attachment if found.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
PurpleAttachment *purple_attachments_find_with_id(PurpleAttachments *attachments, const char *id);

/**
 * purple_attachments_new:
 *
 * Creates a new instance.
 *
 * Returns: (transfer full): The new instance.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
PurpleAttachments *purple_attachments_new(void);

/**
 * purple_attachments_remove_attachment:
 * @attachment: (transfer none): the attachment to remove
 *
 * Removes an attachment from the collection.
 *
 * If @attachment is not in the collection it will be ignored.
 *
 * Returns: true if the item was removed; otherwise false.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
gboolean purple_attachments_remove_attachment(PurpleAttachments *attachments, PurpleAttachment *attachment);

/**
 * purple_attachments_remove_all:
 *
 * Removes all attachments from the collection.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
void purple_attachments_remove_all(PurpleAttachments *attachments);

G_END_DECLS

#endif /* PURPLE_ATTACHMENTS_H */
