/* Generated file (by generator) */

/*
 * SPDX-FileCopyrightText: 2015 William Yu <williamyu@gnome.org>
 *
 * SPDX-License-Identifier: LGPL-2.1-only OR MPL-2.0
 */

#ifdef HAVE_CONFIG_H
#include <config.h>
#endif

#include "i-cal-vcard-property.h"
#include "libical-glib-private.h"
#include "i-cal-vcard-derived-value.h"
#include "i-cal-vcard-parameter.h"
#include "i-cal-vcard-derived-parameter.h"
#include "i-cal-vcard-derived-property.h"
#include "i-cal-vcard-value.h"

G_DEFINE_TYPE (ICalVcardProperty, i_cal_vcard_property, I_CAL_TYPE_OBJECT)

static void i_cal_vcard_property_class_init (G_GNUC_UNUSED ICalVcardPropertyClass *klass)
{
}

static void i_cal_vcard_property_init (G_GNUC_UNUSED ICalVcardProperty *self)
{
}

/**
 * i_cal_vcard_property_new_full: (skip)
 * @native: The native libical object.
 * @owner: The parent.
 *
 * Create a new libical-glib object from the native libical object and the owner.
 *
 * Returns: (transfer full): The newly create libical-glib object.
 *
 * Since: 1.0
 **/
ICalVcardProperty *
i_cal_vcard_property_new_full (vcardproperty *native, 
                               GObject *owner)
{
    ICalVcardProperty *object;
    if (native == NULL) {
        return NULL;
    }
    
    
    object = i_cal_object_construct (I_CAL_VCARD_TYPE_PROPERTY,
                            (gpointer) native,
                            (GDestroyNotify) vcardproperty_free,
                            FALSE,
                            owner);

    return object;
}


/**
 * i_cal_vcard_property_new:
 * @kind: The kind of #ICalVcardProperty to be created
 *
 * Creates an #ICalVcardProperty of the @kind.
 *
 * Returns: (transfer full): The newly created #ICalVcardProperty with the type @kind.
 *
 * Since: 4.0
 *
 **/
ICalVcardProperty *
i_cal_vcard_property_new (ICalVcardPropertyKind kind)
{
	return i_cal_vcard_property_new_full (vcardproperty_new ((vcardproperty_kind) (kind)), NULL);
}

/**
 * i_cal_vcard_property_clone:
 * @prop: The #ICalVcardProperty to be cloned.
 *
 * Deeply clones the @prop.
 *
 * Returns: (transfer full): The newly created #ICalVcardProperty deeply cloned from @prop.
 *
 * Since: 4.0
 *
 **/
ICalVcardProperty *
i_cal_vcard_property_clone (const ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_vcard_property_new_full (vcardproperty_clone ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))), NULL);
}

/**
 * i_cal_vcard_property_new_from_string:
 * @str: The string used to construct an #ICalVcardProperty
 *
 * Creates an #ICalVcardProperty from a string.
 *
 * Returns: (transfer full): The newly created #ICalVcardProperty from @str.
 *
 * Since: 4.0
 *
 **/
ICalVcardProperty *
i_cal_vcard_property_new_from_string (const gchar *str)
{
    g_return_val_if_fail (str != NULL, NULL);

	return i_cal_vcard_property_new_full (vcardproperty_new_from_string (str), NULL);
}

/**
 * i_cal_vcard_property_as_vcard_string:
 * @prop: The #ICalVcardProperty to be converted
 *
 * Converts an #ICalVcardProperty to a string representation.
 *
 * Returns: (transfer full): The string representation of @prop.
 *
 * Since: 4.0
 *
 **/
gchar *
i_cal_vcard_property_as_vcard_string (ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_memory_str_to_glib (vcardproperty_as_vcard_string_r ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))));
}

/**
 * i_cal_vcard_property_free: (skip)
 * @prop: (transfer full): The #ICalVcardProperty to be freed
 *
 * Frees the @prop.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_free (ICalVcardProperty *prop)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));

	vcardproperty_free ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)));
}

/**
 * i_cal_vcard_property_isa:
 * @property: The #ICalVcardProperty which type is to be determined
 *
 * Gets the kind of the @property.
 *
 * Returns: The type of #ICalVcardProperty.
 *
 * Since: 4.0
 *
 **/
ICalVcardPropertyKind
i_cal_vcard_property_isa (ICalVcardProperty *property)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)property), I_CAL_VCARD_NO_PROPERTY);

	return (ICalVcardPropertyKind) (vcardproperty_isa ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)property))));
}

/**
 * i_cal_vcard_property_isa_property:
 * @property: The object whose native part to be checked
 *
 * Checks whether the native part of #ICalVcardProperty is valid vCard property.
 *
 * Returns: true if the native part of @property is of the type icalproperty, false if not.
 *
 * Since: 4.0
 *
 **/
gboolean
i_cal_vcard_property_isa_property (ICalVcardProperty *property)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)property), FALSE);

	return vcardproperty_isa_property ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)property)));
}

/**
 * i_cal_vcard_property_add_parameter:
 * @prop: The #ICalVcardProperty to be set
 * @parameter: (transfer none): The parameter to be added into @prop
 *
 * Adds an #ICalVcardParameter into the #ICalVcardProperty. It behaves like set the copy of the #ICalVcardParameter.
 * Upon completion the native part of #ICalVcardParameter will be set to %NULL.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_add_parameter (ICalVcardProperty *prop, 
                                    ICalVcardParameter *parameter)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (I_CAL_VCARD_IS_PARAMETER ((ICalVcardParameter*)parameter));

	i_cal_object_set_owner ((ICalObject *)parameter, (GObject *)prop);
	vcardproperty_add_parameter ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)parameter)));
}

/**
 * i_cal_vcard_property_take_parameter: (skip)
 * @prop: The #ICalVcardProperty to be set
 * @parameter: (transfer full): The parameter to be added into @prop
 *
 * Adds the @parameter into the @prop and frees the @parameter.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_take_parameter (ICalVcardProperty *prop, 
                                     ICalVcardParameter *parameter)
{
    g_return_if_fail(I_CAL_VCARD_IS_PROPERTY(prop));
    g_return_if_fail(I_CAL_VCARD_IS_PARAMETER(parameter));

    i_cal_vcard_property_add_parameter(prop, parameter);
    g_object_unref(parameter);
}

/**
 * i_cal_vcard_property_set_parameter:
 * @prop: The #ICalVcardProperty to be set
 * @parameter: (transfer none): The parameter to be set into @prop
 *
 * Sets an #ICalVcardParameter into the #ICalVcardProperty. It behaves like set the copy of the #ICalVcardParameter.
 * Upon completion the native part of #ICalVcardParameter will be set to NULL.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_parameter (ICalVcardProperty *prop, 
                                    ICalVcardParameter *parameter)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (I_CAL_VCARD_IS_PARAMETER ((ICalVcardParameter*)parameter));

	i_cal_object_set_owner ((ICalObject *)parameter, (GObject *)prop);
	vcardproperty_set_parameter ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)parameter)));
}

/**
 * i_cal_vcard_property_set_parameter_from_string:
 * @prop: The #ICalVcardProperty to be set
 * @name: The name of the parameter
 * @value: The value of the parameter
 *
 * Sets the #ICalVcardProperty with the parameter defined by the name and value.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_parameter_from_string (ICalVcardProperty *prop, 
                                                const gchar *name, 
                                                const gchar *value)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (name != NULL);
    g_return_if_fail (value != NULL);

	vcardproperty_set_parameter_from_string ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), name, value);
}

/**
 * i_cal_vcard_property_get_parameter_as_string:
 * @prop: The #ICalVcardProperty to be queried
 * @name: The name of the target parameter
 *
 * Gets the string representation of the target parameter in the #ICalVcardProperty.
 *
 * Returns: (transfer full): The string representation of the parameter.
 *
 * Since: 4.0
 *
 **/
gchar *
i_cal_vcard_property_get_parameter_as_string (ICalVcardProperty *prop, 
                                              const gchar *name)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);
    g_return_val_if_fail (name != NULL, NULL);

	return i_cal_memory_str_to_glib (vcardproperty_get_parameter_as_string_r ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), name));
}

/**
 * i_cal_vcard_property_remove_parameter_by_kind:
 * @prop: The #ICalVcardProperty to be manipulated
 * @kind: The #ICalVcardParameterKind to be removed
 *
 * Removes all parameters of kind @kind from the @prop.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_remove_parameter_by_kind (ICalVcardProperty *prop, 
                                               ICalVcardParameterKind kind)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));

	vcardproperty_remove_parameter_by_kind ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter_kind) (kind));
}

/**
 * i_cal_vcard_property_remove_parameter_by_name:
 * @prop: The #ICalVcardProperty to be manipulated
 * @name: The name of the parameter to be removed
 *
 * Removes all parameters of name @name from the @prop.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_remove_parameter_by_name (ICalVcardProperty *prop, 
                                               const gchar *name)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (name != NULL);

	vcardproperty_remove_parameter_by_name ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), name);
}

/**
 * i_cal_vcard_property_remove_parameter_by_ref:
 * @prop: The #ICalVcardProperty to be manipulated
 * @param: The #ICalVcardParameter to be removed
 *
 * Removes the parameter in the #ICalVcardProperty by ref.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_remove_parameter_by_ref (ICalVcardProperty *prop, 
                                              ICalVcardParameter *param)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (I_CAL_VCARD_IS_PARAMETER ((ICalVcardParameter*)param));

	vcardproperty_remove_parameter_by_ref ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)param)));
}

/**
 * i_cal_vcard_property_count_parameters:
 * @prop: The #ICalVcardProperty to be checked
 *
 * Counts the parameters in the #ICalVcardProperty.
 *
 * Returns: The count of the parameters in the #ICalVcardProperty.
 *
 * Since: 4.0
 *
 **/
gint
i_cal_vcard_property_count_parameters (const ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), 0);

	return vcardproperty_count_parameters ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)));
}

/**
 * i_cal_vcard_property_get_first_parameter:
 * @prop: The #ICalVcardProperty to be queried
 * @kind: The target kind of #ICalVcardParameter to be retrieved
 *
 * Gets the first #ICalVcardParameter from the parent #ICalVcardProperty.
 *
 * Returns: (transfer full): The first #ICalVcardParameter of @prop.
 *
 * Since: 4.0
 *
 **/
ICalVcardParameter *
i_cal_vcard_property_get_first_parameter (ICalVcardProperty *prop, 
                                          ICalVcardParameterKind kind)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_vcard_parameter_new_full (vcardproperty_get_first_parameter ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter_kind) (kind)), (GObject *)prop);
}

/**
 * i_cal_vcard_property_get_next_parameter:
 * @prop: The #ICalVcardProperty to be queried
 * @kind: The target kind of #ICalVcardParameter to be retrieved
 *
 * Gets the next #ICalVcardParameter from the parent #ICalVcardProperty.
 *
 * Returns: (transfer full): The next #ICalVcardParameter of @prop.
 *
 * Since: 4.0
 *
 **/
ICalVcardParameter *
i_cal_vcard_property_get_next_parameter (ICalVcardProperty *prop, 
                                         ICalVcardParameterKind kind)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_vcard_parameter_new_full (vcardproperty_get_next_parameter ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardparameter_kind) (kind)), (GObject *)prop);
}

/**
 * i_cal_vcard_property_set_value:
 * @prop: The target #ICalVcardProperty
 * @value: The #ICalVcardValue will be set as the property of @prop
 *
 * Sets the #ICalVcardProperty with the #ICalVcardValue.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_value (ICalVcardProperty *prop, 
                                ICalVcardValue *value)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (I_CAL_VCARD_IS_VALUE ((ICalVcardValue*)value));

	i_cal_object_set_owner ((ICalObject *)prop, (GObject *)value);
	i_cal_object_set_owner ((ICalObject *)value, (GObject *)prop);
	vcardproperty_set_value ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), (vcardvalue *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)value)));
}

/**
 * i_cal_vcard_property_take_value: (skip)
 * @prop: The target #ICalVcardProperty
 * @value: (transfer full): The #ICalVcardValue will be set as the property of @prop
 *
 * Sets the @prop with the @value and unrefs the @value.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_take_value (ICalVcardProperty *prop, 
                                 ICalVcardValue *value)
{
    g_return_if_fail(I_CAL_IS_PROPERTY(prop));
    g_return_if_fail(I_CAL_IS_VALUE(value));

    i_cal_vcard_property_set_value(prop, value);
    g_object_unref(value);
}

/**
 * i_cal_vcard_property_set_value_from_string:
 * @prop: The #ICalVcardProperty to be set
 * @value: The value used to construct the #ICalVcardValue
 * @kind: The kind used to construct the #ICalVcardValue
 *
 * Sets the #ICalVcardProperty with the #ICalVcardValue constructed from string.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_value_from_string (ICalVcardProperty *prop, 
                                            const gchar *value, 
                                            const gchar *kind)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (value != NULL);
    g_return_if_fail (kind != NULL);

	vcardproperty_set_value_from_string ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), value, kind);
}

/**
 * i_cal_vcard_property_get_value:
 * @prop: The #ICalVcardProperty to be queried
 *
 * Gets the #ICalVcardValue of #ICalVcardProperty.
 *
 * Returns: (transfer full): The #ICalVcardValue of @prop.
 *
 * Since: 4.0
 *
 **/
ICalVcardValue *
i_cal_vcard_property_get_value (const ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_vcard_value_new_full (vcardproperty_get_value ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))), (GObject *)prop);
}

/**
 * i_cal_vcard_property_get_value_as_string:
 * @prop: The #ICalVcardProperty to be queried
 *
 * Gets the string representation of the value in #ICalVcardProperty.
 *
 * Returns: (transfer full): The string representation of the value of the #ICalVcardProperty.
 *
 * Since: 4.0
 *
 **/
gchar *
i_cal_vcard_property_get_value_as_string (const ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_memory_str_to_glib (vcardproperty_get_value_as_string_r ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))));
}

/**
 * i_cal_vcard_value_set_parent:
 * @value: The child #ICalVcardValue
 * @property: (nullable): The parent #ICalVcardProperty
 *
 * Sets the parent property of a value.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_value_set_parent (ICalVcardValue *value, 
                              ICalVcardProperty *property)
{
    g_return_if_fail (I_CAL_VCARD_IS_VALUE ((ICalVcardValue*)value));
    if (property) {
        g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)property));
    }

	vcardvalue_set_parent ((vcardvalue *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)value)), ((property)?((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)property))):NULL));
}

/**
 * i_cal_vcard_value_get_parent:
 * @value: An #ICalVcardValue
 *
 * Gets the parent #ICalVcardProperty of the specified #ICalVcardValue.
 *
 * Returns: (transfer full) (nullable): The parent #ICalVcardProperty
 *
 * Since: 4.0
 *
 **/
ICalVcardProperty *
i_cal_vcard_value_get_parent (const ICalVcardValue *value)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_VALUE ((ICalVcardValue*)value), NULL);

	return i_cal_vcard_property_new_full (vcardvalue_get_parent ((vcardvalue *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)value))), NULL);
}

/**
 * i_cal_vcard_property_set_x_name:
 * @prop: An #ICalVcardProperty
 * @name: The name string
 *
 * Sets the name of X property for the #ICalVcardProperty.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_x_name (ICalVcardProperty *prop, 
                                 const gchar *name)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (name != NULL);

	vcardproperty_set_x_name ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), name);
}

/**
 * i_cal_vcard_property_get_x_name:
 * @prop: An #ICalVcardProperty
 *
 * Gets the name of X property.
 *
 * Returns: (nullable): The name of x property.
 *
 * Since: 4.0
 *
 **/
const gchar *
i_cal_vcard_property_get_x_name (ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return vcardproperty_get_x_name ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)));
}

/**
 * i_cal_vcard_property_set_group:
 * @prop: An #ICalVcardProperty
 * @group: A group name
 *
 * Sets the group name of the @prop.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_set_group (ICalVcardProperty *prop, 
                                const gchar *group)
{
    g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    g_return_if_fail (group != NULL);

	vcardproperty_set_group ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)), group);
}

/**
 * i_cal_vcard_property_get_group:
 * @prop: An #ICalVcardProperty
 *
 * Gets the group name of the @prop.
 *
 * Returns: (nullable): The group name of the @prop.
 *
 * Since: 4.0
 *
 **/
const gchar *
i_cal_vcard_property_get_group (ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return vcardproperty_get_group ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop)));
}

/**
 * i_cal_vcard_property_get_property_name:
 * @prop: An #ICalVcardProperty
 *
 * Gets the property name of #ICalVcardProperty.
 *
 * Returns: (transfer full): Property name of #ICalVcardProperty.
 *
 * Since: 4.0
 *
 **/
gchar *
i_cal_vcard_property_get_property_name (const ICalVcardProperty *prop)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop), NULL);

	return i_cal_memory_str_to_glib (vcardproperty_get_property_name_r ((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))));
}

/**
 * i_cal_vcard_parameter_value_to_value_kind:
 * @value: An #ICalVcardParameterValue
 *
 * Converts the #ICalVcardParameterValue to #ICalVcardValueKind.
 *
 * Returns: #ICalVcardValueKind
 *
 * Since: 4.0
 *
 **/
ICalVcardValueKind
i_cal_vcard_parameter_value_to_value_kind (ICalVcardParameterValue value)
{
	return (ICalVcardValueKind) (vcardparameter_value_to_value_kind ((vcardparameter_value) (value)));
}

/**
 * i_cal_vcard_parameter_set_parent:
 * @param: The child #ICalVcardParameter
 * @property: (nullable): The parent #ICalVcardProperty
 *
 * Sets the parent #ICalVcardProperty of an #ICalVcardParameter.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_parameter_set_parent (ICalVcardParameter *param, 
                                  ICalVcardProperty *property)
{
    g_return_if_fail (I_CAL_VCARD_IS_PARAMETER ((ICalVcardParameter*)param));
    if (property) {
        g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)property));
    }

	vcardparameter_set_parent ((vcardparameter *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)param)), ((property)?((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)property))):NULL));
}

/**
 * i_cal_vcard_parameter_get_parent:
 * @param: The child #ICalVcardParameter
 *
 * Gets the parent #ICalVcardProperty of the specified #ICalVcardParameter.
 *
 * Returns: (transfer full) (nullable): The parent #ICalVcardProperty
 *
 * Since: 4.0
 *
 **/
ICalVcardProperty *
i_cal_vcard_parameter_get_parent (ICalVcardParameter *param)
{
    g_return_val_if_fail (I_CAL_VCARD_IS_PARAMETER ((ICalVcardParameter*)param), NULL);

	return i_cal_vcard_property_new_full (vcardparameter_get_parent ((vcardparameter *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)param))), NULL);
}

/**
 * i_cal_vcard_property_kind_to_value_kind:
 * @kind: An #ICalVcardPropertyKind
 *
 * Converts the #ICalVcardPropertyKind to #ICalVcardValueKind.
 *
 * Returns: The #ICalVcardValueKind
 *
 * Since: 4.0
 *
 **/
ICalVcardValueKind
i_cal_vcard_property_kind_to_value_kind (ICalVcardPropertyKind kind)
{
	return (ICalVcardValueKind) (vcardproperty_kind_to_value_kind ((vcardproperty_kind) (kind)));
}

/**
 * i_cal_vcard_value_kind_to_property_kind:
 * @kind: An #ICalVcardValueKind
 *
 * Converts an #ICalVcardValueKind to an #ICalVcardPropertyKind.
 *
 * Returns: The #ICalVcardPropertyKind.
 *
 * Since: 4.0
 *
 **/
ICalVcardPropertyKind
i_cal_vcard_value_kind_to_property_kind (ICalVcardValueKind kind)
{
	return (ICalVcardPropertyKind) (vcardproperty_value_kind_to_kind ((vcardvalue_kind) (kind)));
}

/**
 * i_cal_vcard_property_kind_to_string:
 * @kind: An #ICalVcardPropertyKind
 *
 * Converts the #ICalVcardPropertyKind to a string.
 *
 * Returns: The string representation of @kind.
 *
 * Since: 4.0
 *
 **/
const gchar *
i_cal_vcard_property_kind_to_string (ICalVcardPropertyKind kind)
{
	return vcardproperty_kind_to_string ((vcardproperty_kind) (kind));
}

/**
 * i_cal_vcard_property_kind_from_string:
 * @string: A string representing #ICalVcardPropertyKind
 *
 * Converts the string to #ICalVcardPropertyKind.
 *
 * Returns: The #ICalVcardPropertyKind.
 *
 * Since: 4.0
 *
 **/
ICalVcardPropertyKind
i_cal_vcard_property_kind_from_string (const gchar *string)
{
    g_return_val_if_fail (string != NULL, I_CAL_VCARD_NO_PROPERTY);

	return (ICalVcardPropertyKind) (vcardproperty_string_to_kind (string));
}

/**
 * i_cal_vcard_property_kind_is_valid:
 * @kind: The #ICalVcardPropertyKind
 *
 * Checks whether #ICalVcardPropertyKind is valid.
 *
 * Returns: true if valid, false if not.
 *
 * Since: 4.0
 *
 **/
gboolean
i_cal_vcard_property_kind_is_valid (ICalVcardPropertyKind kind)
{
	return vcardproperty_kind_is_valid ((vcardproperty_kind) (kind));
}

/**
 * i_cal_vcard_property_enum_to_string:
 * @e: An enum value
 *
 * Gets string representation of the @e.
 *
 * Returns: (transfer full) (nullable): String representation of the @e, or %NULL, when the @e is an unknown enum.
 *
 * Since: 4.0
 *
 **/
gchar *
i_cal_vcard_property_enum_to_string (int e)
{
	return i_cal_memory_str_to_glib (vcardproperty_enum_to_string_r (e));
}

/**
 * i_cal_vcard_property_kind_and_string_to_enum:
 * @kind: An #ICalVcardValueKind as integer
 * @str: A string
 *
 * Returns enum value for the provided @kind and @str, or 0 for unknown kind.
 *
 * Returns: enum value for the provided @kind and @str, or 0 for unknown kind.
 *
 * Since: 4.0
 *
 **/
gint
i_cal_vcard_property_kind_and_string_to_enum (int kind, 
                                              const gchar *str)
{
    g_return_val_if_fail (str != NULL, 0);

	return vcardproperty_kind_and_string_to_enum (kind, str);
}

/**
 * i_cal_vcard_property_enum_belongs_to_property:
 * @kind: an #ICalVcardPropertyKind
 * @e: an enum value
 *
 * Checks whether the @kind can hold @e.
 *
 * Returns: true if the @kind can hold @e, false if not.
 *
 * Since: 4.0
 *
 **/
gboolean
i_cal_vcard_property_enum_belongs_to_property (ICalVcardPropertyKind kind, 
                                               int e)
{
	return vcardproperty_enum_belongs_to_property ((vcardproperty_kind) (kind), e);
}

/**
 * i_cal_vcard_property_normalize:
 * @prop: (nullable): an #ICalVcardProperty
 *
 * Normalizes (reorder and sorts) the parameters of the @prop.
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_normalize (ICalVcardProperty *prop)
{
    if (prop) {
        g_return_if_fail (I_CAL_VCARD_IS_PROPERTY ((ICalVcardProperty*)prop));
    }

	vcardproperty_normalize (((prop)?((vcardproperty *)i_cal_object_get_native (I_CAL_OBJECT ((ICalObject *)prop))):NULL));
}

/**
 * i_cal_vcard_property_kind_is_structured:
 * @kind: an #ICalVcardPropertyKind
 *
 * Returns whether the @kind is a structured property. Structured properties have their value encoded in
 * a specific format.
 *
 * Returns: whether the @kind is a structured property
 *
 * Since: 4.0
 *
 **/
gboolean
i_cal_vcard_property_kind_is_structured (ICalVcardPropertyKind kind)
{
	return vcardproperty_is_structured ((vcardproperty_kind) (kind));
}

/**
 * i_cal_vcard_property_kind_is_multivalued:
 * @kind: an #ICalVcardPropertyKind
 *
 * Returns whether the @kind is a multivalued property. Multivalued properties can hold more than one value.
 *
 * Returns: whether the @kind is a multivalued property
 *
 * Since: 4.0
 *
 **/
gboolean
i_cal_vcard_property_kind_is_multivalued (ICalVcardPropertyKind kind)
{
	return vcardproperty_is_multivalued ((vcardproperty_kind) (kind));
}

/**
 * i_cal_vcard_property_add_type_parameter:
 * @prop: an #ICalVcardProperty
 * @type_param: a TYPE parameter as #ICalVcardParameterType
 *
 * Adds an #ICalVcardParameterType TYPE parameter into the @prop. See also i_cal_vcard_property_add_type_x_parameter()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_add_type_parameter (ICalVcardProperty *prop, 
                                         ICalVcardParameterType type_param)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_PROPERTY(prop));
    elem.val = type_param;
    vcardproperty_add_type_parameter((vcardproperty *)i_cal_object_get_native ((ICalObject *)prop), &elem);
}

/**
 * i_cal_vcard_property_add_type_x_parameter:
 * @prop: an #ICalVcardProperty
 * @type_param: (transfer none): an X value of a TYPE parameter
 *
 * Adds an X (custom) TYPE parameter into the @prop. See also i_cal_vcard_property_add_type_parameter()
 *
 * Since: 4.0
 *
 **/
void
i_cal_vcard_property_add_type_x_parameter (ICalVcardProperty *prop, 
                                           const gchar *type_param)
{
    vcardenumarray_element elem = { 0 };
    g_return_if_fail(I_CAL_VCARD_IS_PROPERTY(prop));
    elem.val = VCARD_X_PARAMETER;
    elem.xvalue = type_param;
    vcardproperty_add_type_parameter((vcardproperty *)i_cal_object_get_native ((ICalObject *)prop), &elem);
}
