/*
 * 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_ACCOUNT_SETTING_STRING_LIST_H
#define PURPLE_ACCOUNT_SETTING_STRING_LIST_H

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

#include "purpleaccountsetting.h"
#include "purpleversion.h"

G_BEGIN_DECLS

/**
 * PurpleAccountSettingStringList:
 *
 * A string list setting for an account.
 *
 * The list contains [class@Birb.LocalizedString] objects and does not allow
 * duplicate ids.
 *
 * Since: 3.0
 */

#define PURPLE_TYPE_ACCOUNT_SETTING_STRING_LIST (purple_account_setting_string_list_get_type())

PURPLE_AVAILABLE_IN_3_0
G_DECLARE_FINAL_TYPE(PurpleAccountSettingStringList,
                     purple_account_setting_string_list,
                     PURPLE,
                     ACCOUNT_SETTING_STRING_LIST,
                     PurpleAccountSetting)

/**
 * purple_account_setting_string_list_add_item:
 * @id: the id
 * @label: the localized string
 *
 * Adds an item with the given id and localized string.
 *
 * Items with duplicate ids are not allowed.
 *
 * Returns: true if the item was added successfully.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
gboolean purple_account_setting_string_list_add_item(PurpleAccountSettingStringList *list, const char *id, const char *label);

/**
 * purple_account_setting_string_list_get_active_item:
 *
 * Gets the id of the active item.
 *
 * Returns: (nullable): The id of the active item or %NULL if there is no
 *          active item.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
const char *purple_account_setting_string_list_get_active_item(PurpleAccountSettingStringList *setting);

/**
 * purple_account_setting_string_list_new:
 * @id: the id
 * @label: (nullable): the label
 *
 * Creates a new string list account setting.
 *
 * Returns: (type PurpleAccountSettingStringList): The new setting.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
PurpleAccountSetting *purple_account_setting_string_list_new(const char *id, const char *label);

/**
 * purple_account_setting_string_list_set_active_item:
 * @id: (transfer none) (nullable): the id of the new active item
 *
 * Sets the active item.
 *
 * If @id is %NULL any previously active item will be deactivated.
 *
 * If @id is not %NULL and an item with @id can not be found, the active item
 * will not be changed.
 *
 * Since: 3.0
 */
PURPLE_AVAILABLE_IN_3_0
void purple_account_setting_string_list_set_active_item(PurpleAccountSettingStringList *setting, const char *id);

G_END_DECLS

#endif /* PURPLE_ACCOUNT_SETTING_STRING_LIST_H */
