/* imap-status-command.c generated by valac 0.56.3, the Vala compiler
 * generated from imap-status-command.vala, do not modify */

/*
 * Copyright 2016 Software Freedom Conservancy Inc.
 *
 * This software is licensed under the GNU Lesser General Public License
 * (version 2.1 or later).  See the COPYING file in this distribution.
 */

#include "geary-engine.h"
#include <gio/gio.h>
#include <glib.h>

enum  {
	GEARY_IMAP_STATUS_COMMAND_0_PROPERTY,
	GEARY_IMAP_STATUS_COMMAND_NUM_PROPERTIES
};
static GParamSpec* geary_imap_status_command_properties[GEARY_IMAP_STATUS_COMMAND_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
#define _vala_return_if_fail(expr, msg) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return; }
#define _vala_return_val_if_fail(expr, msg, val) if G_LIKELY (expr) ; else { g_return_if_fail_warning (G_LOG_DOMAIN, G_STRFUNC, msg); return val; }
#define _vala_warn_if_fail(expr, msg) if G_LIKELY (expr) ; else g_warn_message (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);

static gpointer geary_imap_status_command_parent_class = NULL;

static GType geary_imap_status_command_get_type_once (void);

GearyImapStatusCommand*
geary_imap_status_command_construct (GType object_type,
                                     GearyImapMailboxSpecifier* mailbox,
                                     GearyImapStatusDataType* data_items,
                                     gint data_items_length1,
                                     GCancellable* should_send)
{
	GearyImapStatusCommand * self = NULL;
	GearyImapListParameter* _tmp0_;
	GearyImapListParameter* _tmp1_;
	GearyImapParameter* _tmp2_;
	GearyImapParameter* _tmp3_;
	GearyImapListParameter* data_item_list = NULL;
	GearyImapListParameter* _tmp4_;
	GearyImapListParameter* _tmp8_;
	GearyImapListParameter* _tmp9_;
	GearyImapListParameter* _tmp10_;
	g_return_val_if_fail (GEARY_IMAP_IS_MAILBOX_SPECIFIER (mailbox), NULL);
	g_return_val_if_fail ((should_send == NULL) || G_TYPE_CHECK_INSTANCE_TYPE (should_send, g_cancellable_get_type ()), NULL);
	self = (GearyImapStatusCommand*) geary_imap_command_construct (object_type, GEARY_IMAP_STATUS_COMMAND_NAME, NULL, (gint) 0, should_send);
	_tmp0_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp1_ = _tmp0_;
	_tmp2_ = geary_imap_mailbox_specifier_to_parameter (mailbox);
	_tmp3_ = _tmp2_;
	geary_imap_list_parameter_add (_tmp1_, _tmp3_);
	_g_object_unref0 (_tmp3_);
	_vala_assert (data_items_length1 > 0, "data_items.length > 0");
	_tmp4_ = geary_imap_list_parameter_new ();
	data_item_list = _tmp4_;
	{
		GearyImapStatusDataType* data_item_collection = NULL;
		gint data_item_collection_length1 = 0;
		gint _data_item_collection_size_ = 0;
		gint data_item_it = 0;
		data_item_collection = data_items;
		data_item_collection_length1 = data_items_length1;
		for (data_item_it = 0; data_item_it < data_item_collection_length1; data_item_it = data_item_it + 1) {
			GearyImapStatusDataType data_item = 0;
			data_item = data_item_collection[data_item_it];
			{
				GearyImapListParameter* _tmp5_;
				GearyImapStringParameter* _tmp6_;
				GearyImapStringParameter* _tmp7_;
				_tmp5_ = data_item_list;
				_tmp6_ = geary_imap_status_data_type_to_parameter (data_item);
				_tmp7_ = _tmp6_;
				geary_imap_list_parameter_add (_tmp5_, G_TYPE_CHECK_INSTANCE_CAST (_tmp7_, GEARY_IMAP_TYPE_PARAMETER, GearyImapParameter));
				_g_object_unref0 (_tmp7_);
			}
		}
	}
	_tmp8_ = geary_imap_command_get_args (G_TYPE_CHECK_INSTANCE_CAST (self, GEARY_IMAP_TYPE_COMMAND, GearyImapCommand));
	_tmp9_ = _tmp8_;
	_tmp10_ = data_item_list;
	geary_imap_list_parameter_add (_tmp9_, G_TYPE_CHECK_INSTANCE_CAST (_tmp10_, GEARY_IMAP_TYPE_PARAMETER, GearyImapParameter));
	_g_object_unref0 (data_item_list);
	return self;
}

GearyImapStatusCommand*
geary_imap_status_command_new (GearyImapMailboxSpecifier* mailbox,
                               GearyImapStatusDataType* data_items,
                               gint data_items_length1,
                               GCancellable* should_send)
{
	return geary_imap_status_command_construct (GEARY_IMAP_TYPE_STATUS_COMMAND, mailbox, data_items, data_items_length1, should_send);
}

static void
geary_imap_status_command_class_init (GearyImapStatusCommandClass * klass,
                                      gpointer klass_data)
{
	geary_imap_status_command_parent_class = g_type_class_peek_parent (klass);
}

static void
geary_imap_status_command_instance_init (GearyImapStatusCommand * self,
                                         gpointer klass)
{
}

/**
 * The IMAP STATUS command.
 *
 * See [[http://tools.ietf.org/html/rfc3501#section-6.3.10]]
 *
 * @see StatusData
 */
 G_GNUC_NO_INLINE static GType
geary_imap_status_command_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (GearyImapStatusCommandClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) geary_imap_status_command_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (GearyImapStatusCommand), 0, (GInstanceInitFunc) geary_imap_status_command_instance_init, NULL };
	GType geary_imap_status_command_type_id;
	geary_imap_status_command_type_id = g_type_register_static (GEARY_IMAP_TYPE_COMMAND, "GearyImapStatusCommand", &g_define_type_info, 0);
	return geary_imap_status_command_type_id;
}

GType
geary_imap_status_command_get_type (void)
{
	static gsize geary_imap_status_command_type_id__once = 0;
	if (g_once_init_enter (&geary_imap_status_command_type_id__once)) {
		GType geary_imap_status_command_type_id;
		geary_imap_status_command_type_id = geary_imap_status_command_get_type_once ();
		g_once_init_leave (&geary_imap_status_command_type_id__once, geary_imap_status_command_type_id);
	}
	return geary_imap_status_command_type_id__once;
}

