/* OutputFormatter.c generated by valac 0.56.19, the Vala compiler
 * generated from OutputFormatter.vala, do not modify */

/*
 * Copyright © 2026 Alain M. (https://github.com/alainm23/planify)
 *
 * This program 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 3 of the License, or (at your option) any later version.
 *
 * This program 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 program; if not, write to the
 * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301 USA
 */

#include <glib-object.h>
#include "planify.h"
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <json-glib/json-glib.h>
#include <gee.h>
#include <stdio.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define PLANIFY_CLI_TYPE_OUTPUT_FORMATTER (planify_cli_output_formatter_get_type ())
#define PLANIFY_CLI_OUTPUT_FORMATTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PLANIFY_CLI_TYPE_OUTPUT_FORMATTER, PlanifyCLIOutputFormatter))
#define PLANIFY_CLI_OUTPUT_FORMATTER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PLANIFY_CLI_TYPE_OUTPUT_FORMATTER, PlanifyCLIOutputFormatterClass))
#define PLANIFY_CLI_IS_OUTPUT_FORMATTER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PLANIFY_CLI_TYPE_OUTPUT_FORMATTER))
#define PLANIFY_CLI_IS_OUTPUT_FORMATTER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PLANIFY_CLI_TYPE_OUTPUT_FORMATTER))
#define PLANIFY_CLI_OUTPUT_FORMATTER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PLANIFY_CLI_TYPE_OUTPUT_FORMATTER, PlanifyCLIOutputFormatterClass))

typedef struct _PlanifyCLIOutputFormatter PlanifyCLIOutputFormatter;
typedef struct _PlanifyCLIOutputFormatterClass PlanifyCLIOutputFormatterClass;
typedef struct _PlanifyCLIOutputFormatterPrivate PlanifyCLIOutputFormatterPrivate;
enum  {
	PLANIFY_CLI_OUTPUT_FORMATTER_0_PROPERTY,
	PLANIFY_CLI_OUTPUT_FORMATTER_NUM_PROPERTIES
};
static GParamSpec* planify_cli_output_formatter_properties[PLANIFY_CLI_OUTPUT_FORMATTER_NUM_PROPERTIES];

#define PLANIFY_CLI_OUTPUT_FORMATTER_TYPE_FIELD_DEF (planify_cli_output_formatter_field_def_get_type ())
typedef struct _PlanifyCLIOutputFormatterFieldDef PlanifyCLIOutputFormatterFieldDef;
typedef void (*PlanifyCLIOutputFormatterFieldValueAdder) (JsonBuilder* builder, gpointer user_data);
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block2Data Block2Data;
#define __vala_JsonNode_free0(var) ((var == NULL) ? NULL : (var = (_vala_JsonNode_free (var), NULL)))

struct _PlanifyCLIOutputFormatter {
	GObject parent_instance;
	PlanifyCLIOutputFormatterPrivate * priv;
};

struct _PlanifyCLIOutputFormatterClass {
	GObjectClass parent_class;
};

struct _PlanifyCLIOutputFormatterFieldDef {
	gchar* name;
	PlanifyCLIOutputFormatterFieldValueAdder add_value;
	gpointer add_value_target;
	GDestroyNotify add_value_target_destroy_notify;
};

struct _Block1Data {
	int _ref_count_;
	ObjectsProject* project;
};

struct _Block2Data {
	int _ref_count_;
	ObjectsItem* item;
};

static gpointer planify_cli_output_formatter_parent_class = NULL;

VALA_EXTERN GType planify_cli_output_formatter_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (PlanifyCLIOutputFormatter, g_object_unref)
static GType planify_cli_output_formatter_field_def_get_type (void) G_GNUC_CONST  G_GNUC_UNUSED ;
static PlanifyCLIOutputFormatterFieldDef* planify_cli_output_formatter_field_def_dup (const PlanifyCLIOutputFormatterFieldDef* self);
static void planify_cli_output_formatter_field_def_free (PlanifyCLIOutputFormatterFieldDef* self);
static void planify_cli_output_formatter_field_def_copy (const PlanifyCLIOutputFormatterFieldDef* self,
                                                  PlanifyCLIOutputFormatterFieldDef* dest);
static void planify_cli_output_formatter_field_def_destroy (PlanifyCLIOutputFormatterFieldDef* self);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (PlanifyCLIOutputFormatterFieldDef, planify_cli_output_formatter_field_def_destroy)
static PlanifyCLIOutputFormatterFieldDef* planify_cli_output_formatter_get_project_fields (ObjectsProject* project,
                                                                                    gint* result_length1);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void __lambda5_ (Block1Data* _data1_,
                 JsonBuilder* builder);
static void ___lambda5__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                 gpointer self);
static void __lambda6_ (Block1Data* _data1_,
                 JsonBuilder* builder);
static void ___lambda6__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                 gpointer self);
static void __lambda7_ (Block1Data* _data1_,
                 JsonBuilder* builder);
static void ___lambda7__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                 gpointer self);
static void __lambda8_ (Block1Data* _data1_,
                 JsonBuilder* builder);
static void ___lambda8__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                 gpointer self);
static PlanifyCLIOutputFormatterFieldDef* planify_cli_output_formatter_get_item_fields (ObjectsItem* item,
                                                                                 gint* result_length1);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void __lambda9_ (Block2Data* _data2_,
                 JsonBuilder* builder);
static void ___lambda9__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                 gpointer self);
static void __lambda10_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda10__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda11_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda11__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda12_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda12__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda13_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda13__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda14_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda14__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda15_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda15__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda16_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda16__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda17_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda17__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda18_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda18__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda19_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda19__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda20_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda20__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
static void __lambda21_ (Block2Data* _data2_,
                  JsonBuilder* builder);
static void ___lambda21__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                                  gpointer self);
VALA_EXTERN void planify_cli_output_formatter_print_task_result (ObjectsItem* item,
                                                     ObjectsProject* project);
static void planify_cli_output_formatter_add_object (JsonBuilder* builder,
                                              PlanifyCLIOutputFormatterFieldDef* fields,
                                              gint fields_length1);
static void _vala_PlanifyCLIOutputFormatterFieldDef_array_free (PlanifyCLIOutputFormatterFieldDef * array,
                                                         gssize array_length);
static void _vala_JsonNode_free (JsonNode* self);
VALA_EXTERN void planify_cli_output_formatter_print_projects_list (GeeArrayList* projects);
VALA_EXTERN void planify_cli_output_formatter_print_tasks_list (GeeArrayList* items);
VALA_EXTERN PlanifyCLIOutputFormatter* planify_cli_output_formatter_new (void);
VALA_EXTERN PlanifyCLIOutputFormatter* planify_cli_output_formatter_construct (GType object_type);
static GType planify_cli_output_formatter_get_type_once (void);

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->project);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
__lambda5_ (Block1Data* _data1_,
            JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) _data1_->project);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda5__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                            gpointer self)
{
	__lambda5_ (self, builder);
}

static void
__lambda6_ (Block1Data* _data1_,
            JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_base_object_get_name ((ObjectsBaseObject*) _data1_->project);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda6__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                            gpointer self)
{
	__lambda6_ (self, builder);
}

static void
__lambda7_ (Block1Data* _data1_,
            JsonBuilder* builder)
{
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_base_object_get_item_count ((ObjectsBaseObject*) _data1_->project);
	_tmp1_ = _tmp0_;
	json_builder_add_int_value (builder, (gint64) _tmp1_);
}

static void
___lambda7__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                            gpointer self)
{
	__lambda7_ (self, builder);
}

static void
__lambda8_ (Block1Data* _data1_,
            JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_project_get_description (_data1_->project);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda8__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                            gpointer self)
{
	__lambda8_ (self, builder);
}

static PlanifyCLIOutputFormatterFieldDef*
planify_cli_output_formatter_get_project_fields (ObjectsProject* project,
                                                 gint* result_length1)
{
	Block1Data* _data1_;
	ObjectsProject* _tmp0_;
	gchar* _tmp1_;
	PlanifyCLIOutputFormatterFieldDef _tmp2_ = {0};
	gchar* _tmp3_;
	PlanifyCLIOutputFormatterFieldDef _tmp4_ = {0};
	gchar* _tmp5_;
	PlanifyCLIOutputFormatterFieldDef _tmp6_ = {0};
	gchar* _tmp7_;
	PlanifyCLIOutputFormatterFieldDef _tmp8_ = {0};
	PlanifyCLIOutputFormatterFieldDef* _tmp9_;
	PlanifyCLIOutputFormatterFieldDef* _tmp10_;
	gint _tmp10__length1;
	PlanifyCLIOutputFormatterFieldDef* result;
	g_return_val_if_fail (project != NULL, NULL);
	_data1_ = g_slice_new0 (Block1Data);
	_data1_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (project);
	_g_object_unref0 (_data1_->project);
	_data1_->project = _tmp0_;
	_tmp1_ = g_strdup ("id");
	memset (&_tmp2_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp2_.name);
	_tmp2_.name = _tmp1_;
	(_tmp2_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp2_.add_value_target_destroy_notify (_tmp2_.add_value_target), NULL);
	_tmp2_.add_value = NULL;
	_tmp2_.add_value_target = NULL;
	_tmp2_.add_value_target_destroy_notify = NULL;
	_tmp2_.add_value = ___lambda5__planify_cli_output_formatter_field_value_adder;
	_tmp2_.add_value_target = block1_data_ref (_data1_);
	_tmp2_.add_value_target_destroy_notify = block1_data_unref;
	_tmp3_ = g_strdup ("name");
	memset (&_tmp4_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp4_.name);
	_tmp4_.name = _tmp3_;
	(_tmp4_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp4_.add_value_target_destroy_notify (_tmp4_.add_value_target), NULL);
	_tmp4_.add_value = NULL;
	_tmp4_.add_value_target = NULL;
	_tmp4_.add_value_target_destroy_notify = NULL;
	_tmp4_.add_value = ___lambda6__planify_cli_output_formatter_field_value_adder;
	_tmp4_.add_value_target = block1_data_ref (_data1_);
	_tmp4_.add_value_target_destroy_notify = block1_data_unref;
	_tmp5_ = g_strdup ("item-count");
	memset (&_tmp6_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp6_.name);
	_tmp6_.name = _tmp5_;
	(_tmp6_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp6_.add_value_target_destroy_notify (_tmp6_.add_value_target), NULL);
	_tmp6_.add_value = NULL;
	_tmp6_.add_value_target = NULL;
	_tmp6_.add_value_target_destroy_notify = NULL;
	_tmp6_.add_value = ___lambda7__planify_cli_output_formatter_field_value_adder;
	_tmp6_.add_value_target = block1_data_ref (_data1_);
	_tmp6_.add_value_target_destroy_notify = block1_data_unref;
	_tmp7_ = g_strdup ("description");
	memset (&_tmp8_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp8_.name);
	_tmp8_.name = _tmp7_;
	(_tmp8_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp8_.add_value_target_destroy_notify (_tmp8_.add_value_target), NULL);
	_tmp8_.add_value = NULL;
	_tmp8_.add_value_target = NULL;
	_tmp8_.add_value_target_destroy_notify = NULL;
	_tmp8_.add_value = ___lambda8__planify_cli_output_formatter_field_value_adder;
	_tmp8_.add_value_target = block1_data_ref (_data1_);
	_tmp8_.add_value_target_destroy_notify = block1_data_unref;
	_tmp9_ = g_new0 (PlanifyCLIOutputFormatterFieldDef, 4);
	_tmp9_[0] = _tmp2_;
	_tmp9_[1] = _tmp4_;
	_tmp9_[2] = _tmp6_;
	_tmp9_[3] = _tmp8_;
	_tmp10_ = _tmp9_;
	_tmp10__length1 = 4;
	if (result_length1) {
		*result_length1 = _tmp10__length1;
	}
	result = _tmp10_;
	block1_data_unref (_data1_);
	_data1_ = NULL;
	return result;
}

static Block2Data*
block2_data_ref (Block2Data* _data2_)
{
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}

static void
block2_data_unref (void * _userdata_)
{
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		_g_object_unref0 (_data2_->item);
		g_slice_free (Block2Data, _data2_);
	}
}

static void
__lambda9_ (Block2Data* _data2_,
            JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_base_object_get_id ((ObjectsBaseObject*) _data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda9__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                            gpointer self)
{
	__lambda9_ (self, builder);
}

static void
__lambda10_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_content (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda10__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda10_ (self, builder);
}

static void
__lambda11_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_description (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda11__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda11_ (self, builder);
}

static void
__lambda12_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_checked (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_boolean_value (builder, _tmp1_);
}

static void
___lambda12__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda12_ (self, builder);
}

static void
__lambda13_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_pinned (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_boolean_value (builder, _tmp1_);
}

static void
___lambda13__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda13_ (self, builder);
}

static void
__lambda14_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	gint _tmp0_;
	gint _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_priority (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_int_value (builder, (gint64) (5 - _tmp1_));
}

static void
___lambda14__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda14_ (self, builder);
}

static void
__lambda15_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_project_id (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda15__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda15_ (self, builder);
}

static void
__lambda16_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_section_id (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda16__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda16_ (self, builder);
}

static void
__lambda17_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_parent_id (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda17__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda17_ (self, builder);
}

static void
__lambda18_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_added_at (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda18__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda18_ (self, builder);
}

static void
__lambda19_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_completed_at (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda19__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda19_ (self, builder);
}

static void
__lambda20_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	g_return_if_fail (builder != NULL);
	_tmp0_ = objects_item_get_updated_at (_data2_->item);
	_tmp1_ = _tmp0_;
	json_builder_add_string_value (builder, _tmp1_);
}

static void
___lambda20__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda20_ (self, builder);
}

static void
__lambda21_ (Block2Data* _data2_,
             JsonBuilder* builder)
{
	g_return_if_fail (builder != NULL);
	json_builder_begin_array (builder);
	{
		GeeArrayList* _label_list = NULL;
		GeeArrayList* _tmp0_;
		GeeArrayList* _tmp1_;
		gint _label_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _label_index = 0;
		_tmp0_ = objects_item_get_labels (_data2_->item);
		_tmp1_ = _tmp0_;
		_label_list = _tmp1_;
		_tmp2_ = _label_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_label_size = _tmp4_;
		_label_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ObjectsLabel* label = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			ObjectsLabel* _tmp9_;
			const gchar* _tmp10_;
			const gchar* _tmp11_;
			_label_index = _label_index + 1;
			_tmp5_ = _label_index;
			_tmp6_ = _label_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _label_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _label_index);
			label = (ObjectsLabel*) _tmp8_;
			_tmp9_ = label;
			_tmp10_ = objects_base_object_get_name ((ObjectsBaseObject*) _tmp9_);
			_tmp11_ = _tmp10_;
			json_builder_add_string_value (builder, _tmp11_);
			_g_object_unref0 (label);
		}
	}
	json_builder_end_array (builder);
}

static void
___lambda21__planify_cli_output_formatter_field_value_adder (JsonBuilder* builder,
                                                             gpointer self)
{
	__lambda21_ (self, builder);
}

static PlanifyCLIOutputFormatterFieldDef*
planify_cli_output_formatter_get_item_fields (ObjectsItem* item,
                                              gint* result_length1)
{
	Block2Data* _data2_;
	ObjectsItem* _tmp0_;
	gchar* _tmp1_;
	PlanifyCLIOutputFormatterFieldDef _tmp2_ = {0};
	gchar* _tmp3_;
	PlanifyCLIOutputFormatterFieldDef _tmp4_ = {0};
	gchar* _tmp5_;
	PlanifyCLIOutputFormatterFieldDef _tmp6_ = {0};
	gchar* _tmp7_;
	PlanifyCLIOutputFormatterFieldDef _tmp8_ = {0};
	gchar* _tmp9_;
	PlanifyCLIOutputFormatterFieldDef _tmp10_ = {0};
	gchar* _tmp11_;
	PlanifyCLIOutputFormatterFieldDef _tmp12_ = {0};
	gchar* _tmp13_;
	PlanifyCLIOutputFormatterFieldDef _tmp14_ = {0};
	gchar* _tmp15_;
	PlanifyCLIOutputFormatterFieldDef _tmp16_ = {0};
	gchar* _tmp17_;
	PlanifyCLIOutputFormatterFieldDef _tmp18_ = {0};
	gchar* _tmp19_;
	PlanifyCLIOutputFormatterFieldDef _tmp20_ = {0};
	gchar* _tmp21_;
	PlanifyCLIOutputFormatterFieldDef _tmp22_ = {0};
	gchar* _tmp23_;
	PlanifyCLIOutputFormatterFieldDef _tmp24_ = {0};
	gchar* _tmp25_;
	PlanifyCLIOutputFormatterFieldDef _tmp26_ = {0};
	PlanifyCLIOutputFormatterFieldDef* _tmp27_;
	PlanifyCLIOutputFormatterFieldDef* _tmp28_;
	gint _tmp28__length1;
	PlanifyCLIOutputFormatterFieldDef* result;
	g_return_val_if_fail (item != NULL, NULL);
	_data2_ = g_slice_new0 (Block2Data);
	_data2_->_ref_count_ = 1;
	_tmp0_ = _g_object_ref0 (item);
	_g_object_unref0 (_data2_->item);
	_data2_->item = _tmp0_;
	_tmp1_ = g_strdup ("id");
	memset (&_tmp2_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp2_.name);
	_tmp2_.name = _tmp1_;
	(_tmp2_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp2_.add_value_target_destroy_notify (_tmp2_.add_value_target), NULL);
	_tmp2_.add_value = NULL;
	_tmp2_.add_value_target = NULL;
	_tmp2_.add_value_target_destroy_notify = NULL;
	_tmp2_.add_value = ___lambda9__planify_cli_output_formatter_field_value_adder;
	_tmp2_.add_value_target = block2_data_ref (_data2_);
	_tmp2_.add_value_target_destroy_notify = block2_data_unref;
	_tmp3_ = g_strdup ("content");
	memset (&_tmp4_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp4_.name);
	_tmp4_.name = _tmp3_;
	(_tmp4_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp4_.add_value_target_destroy_notify (_tmp4_.add_value_target), NULL);
	_tmp4_.add_value = NULL;
	_tmp4_.add_value_target = NULL;
	_tmp4_.add_value_target_destroy_notify = NULL;
	_tmp4_.add_value = ___lambda10__planify_cli_output_formatter_field_value_adder;
	_tmp4_.add_value_target = block2_data_ref (_data2_);
	_tmp4_.add_value_target_destroy_notify = block2_data_unref;
	_tmp5_ = g_strdup ("description");
	memset (&_tmp6_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp6_.name);
	_tmp6_.name = _tmp5_;
	(_tmp6_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp6_.add_value_target_destroy_notify (_tmp6_.add_value_target), NULL);
	_tmp6_.add_value = NULL;
	_tmp6_.add_value_target = NULL;
	_tmp6_.add_value_target_destroy_notify = NULL;
	_tmp6_.add_value = ___lambda11__planify_cli_output_formatter_field_value_adder;
	_tmp6_.add_value_target = block2_data_ref (_data2_);
	_tmp6_.add_value_target_destroy_notify = block2_data_unref;
	_tmp7_ = g_strdup ("checked");
	memset (&_tmp8_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp8_.name);
	_tmp8_.name = _tmp7_;
	(_tmp8_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp8_.add_value_target_destroy_notify (_tmp8_.add_value_target), NULL);
	_tmp8_.add_value = NULL;
	_tmp8_.add_value_target = NULL;
	_tmp8_.add_value_target_destroy_notify = NULL;
	_tmp8_.add_value = ___lambda12__planify_cli_output_formatter_field_value_adder;
	_tmp8_.add_value_target = block2_data_ref (_data2_);
	_tmp8_.add_value_target_destroy_notify = block2_data_unref;
	_tmp9_ = g_strdup ("pinned");
	memset (&_tmp10_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp10_.name);
	_tmp10_.name = _tmp9_;
	(_tmp10_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp10_.add_value_target_destroy_notify (_tmp10_.add_value_target), NULL);
	_tmp10_.add_value = NULL;
	_tmp10_.add_value_target = NULL;
	_tmp10_.add_value_target_destroy_notify = NULL;
	_tmp10_.add_value = ___lambda13__planify_cli_output_formatter_field_value_adder;
	_tmp10_.add_value_target = block2_data_ref (_data2_);
	_tmp10_.add_value_target_destroy_notify = block2_data_unref;
	_tmp11_ = g_strdup ("priority");
	memset (&_tmp12_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp12_.name);
	_tmp12_.name = _tmp11_;
	(_tmp12_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp12_.add_value_target_destroy_notify (_tmp12_.add_value_target), NULL);
	_tmp12_.add_value = NULL;
	_tmp12_.add_value_target = NULL;
	_tmp12_.add_value_target_destroy_notify = NULL;
	_tmp12_.add_value = ___lambda14__planify_cli_output_formatter_field_value_adder;
	_tmp12_.add_value_target = block2_data_ref (_data2_);
	_tmp12_.add_value_target_destroy_notify = block2_data_unref;
	_tmp13_ = g_strdup ("project-id");
	memset (&_tmp14_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp14_.name);
	_tmp14_.name = _tmp13_;
	(_tmp14_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp14_.add_value_target_destroy_notify (_tmp14_.add_value_target), NULL);
	_tmp14_.add_value = NULL;
	_tmp14_.add_value_target = NULL;
	_tmp14_.add_value_target_destroy_notify = NULL;
	_tmp14_.add_value = ___lambda15__planify_cli_output_formatter_field_value_adder;
	_tmp14_.add_value_target = block2_data_ref (_data2_);
	_tmp14_.add_value_target_destroy_notify = block2_data_unref;
	_tmp15_ = g_strdup ("section-id");
	memset (&_tmp16_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp16_.name);
	_tmp16_.name = _tmp15_;
	(_tmp16_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp16_.add_value_target_destroy_notify (_tmp16_.add_value_target), NULL);
	_tmp16_.add_value = NULL;
	_tmp16_.add_value_target = NULL;
	_tmp16_.add_value_target_destroy_notify = NULL;
	_tmp16_.add_value = ___lambda16__planify_cli_output_formatter_field_value_adder;
	_tmp16_.add_value_target = block2_data_ref (_data2_);
	_tmp16_.add_value_target_destroy_notify = block2_data_unref;
	_tmp17_ = g_strdup ("parent-id");
	memset (&_tmp18_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp18_.name);
	_tmp18_.name = _tmp17_;
	(_tmp18_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp18_.add_value_target_destroy_notify (_tmp18_.add_value_target), NULL);
	_tmp18_.add_value = NULL;
	_tmp18_.add_value_target = NULL;
	_tmp18_.add_value_target_destroy_notify = NULL;
	_tmp18_.add_value = ___lambda17__planify_cli_output_formatter_field_value_adder;
	_tmp18_.add_value_target = block2_data_ref (_data2_);
	_tmp18_.add_value_target_destroy_notify = block2_data_unref;
	_tmp19_ = g_strdup ("added-at");
	memset (&_tmp20_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp20_.name);
	_tmp20_.name = _tmp19_;
	(_tmp20_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp20_.add_value_target_destroy_notify (_tmp20_.add_value_target), NULL);
	_tmp20_.add_value = NULL;
	_tmp20_.add_value_target = NULL;
	_tmp20_.add_value_target_destroy_notify = NULL;
	_tmp20_.add_value = ___lambda18__planify_cli_output_formatter_field_value_adder;
	_tmp20_.add_value_target = block2_data_ref (_data2_);
	_tmp20_.add_value_target_destroy_notify = block2_data_unref;
	_tmp21_ = g_strdup ("completed-at");
	memset (&_tmp22_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp22_.name);
	_tmp22_.name = _tmp21_;
	(_tmp22_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp22_.add_value_target_destroy_notify (_tmp22_.add_value_target), NULL);
	_tmp22_.add_value = NULL;
	_tmp22_.add_value_target = NULL;
	_tmp22_.add_value_target_destroy_notify = NULL;
	_tmp22_.add_value = ___lambda19__planify_cli_output_formatter_field_value_adder;
	_tmp22_.add_value_target = block2_data_ref (_data2_);
	_tmp22_.add_value_target_destroy_notify = block2_data_unref;
	_tmp23_ = g_strdup ("updated-at");
	memset (&_tmp24_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp24_.name);
	_tmp24_.name = _tmp23_;
	(_tmp24_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp24_.add_value_target_destroy_notify (_tmp24_.add_value_target), NULL);
	_tmp24_.add_value = NULL;
	_tmp24_.add_value_target = NULL;
	_tmp24_.add_value_target_destroy_notify = NULL;
	_tmp24_.add_value = ___lambda20__planify_cli_output_formatter_field_value_adder;
	_tmp24_.add_value_target = block2_data_ref (_data2_);
	_tmp24_.add_value_target_destroy_notify = block2_data_unref;
	_tmp25_ = g_strdup ("labels");
	memset (&_tmp26_, 0, sizeof (PlanifyCLIOutputFormatterFieldDef));
	_g_free0 (_tmp26_.name);
	_tmp26_.name = _tmp25_;
	(_tmp26_.add_value_target_destroy_notify == NULL) ? NULL : (_tmp26_.add_value_target_destroy_notify (_tmp26_.add_value_target), NULL);
	_tmp26_.add_value = NULL;
	_tmp26_.add_value_target = NULL;
	_tmp26_.add_value_target_destroy_notify = NULL;
	_tmp26_.add_value = ___lambda21__planify_cli_output_formatter_field_value_adder;
	_tmp26_.add_value_target = block2_data_ref (_data2_);
	_tmp26_.add_value_target_destroy_notify = block2_data_unref;
	_tmp27_ = g_new0 (PlanifyCLIOutputFormatterFieldDef, 13);
	_tmp27_[0] = _tmp2_;
	_tmp27_[1] = _tmp4_;
	_tmp27_[2] = _tmp6_;
	_tmp27_[3] = _tmp8_;
	_tmp27_[4] = _tmp10_;
	_tmp27_[5] = _tmp12_;
	_tmp27_[6] = _tmp14_;
	_tmp27_[7] = _tmp16_;
	_tmp27_[8] = _tmp18_;
	_tmp27_[9] = _tmp20_;
	_tmp27_[10] = _tmp22_;
	_tmp27_[11] = _tmp24_;
	_tmp27_[12] = _tmp26_;
	_tmp28_ = _tmp27_;
	_tmp28__length1 = 13;
	if (result_length1) {
		*result_length1 = _tmp28__length1;
	}
	result = _tmp28_;
	block2_data_unref (_data2_);
	_data2_ = NULL;
	return result;
}

static void
_vala_PlanifyCLIOutputFormatterFieldDef_array_free (PlanifyCLIOutputFormatterFieldDef * array,
                                                    gssize array_length)
{
	if (array != NULL) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			planify_cli_output_formatter_field_def_destroy (&array[i]);
		}
	}
	g_free (array);
}

static void
_vala_JsonNode_free (JsonNode* self)
{
	g_boxed_free (json_node_get_type (), self);
}

void
planify_cli_output_formatter_print_task_result (ObjectsItem* item,
                                                ObjectsProject* project)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	gint _tmp1_ = 0;
	PlanifyCLIOutputFormatterFieldDef* _tmp2_;
	PlanifyCLIOutputFormatterFieldDef* _tmp3_;
	gint _tmp3__length1;
	gint _tmp4_ = 0;
	PlanifyCLIOutputFormatterFieldDef* _tmp5_;
	PlanifyCLIOutputFormatterFieldDef* _tmp6_;
	gint _tmp6__length1;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp7_;
	JsonNode* _tmp8_;
	JsonNode* _tmp9_;
	FILE* _tmp10_;
	gchar* _tmp11_;
	gchar* _tmp12_;
	g_return_if_fail (item != NULL);
	g_return_if_fail (project != NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	json_builder_begin_object (builder);
	json_builder_set_member_name (builder, "task");
	_tmp2_ = planify_cli_output_formatter_get_item_fields (item, &_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp3__length1 = _tmp1_;
	planify_cli_output_formatter_add_object (builder, _tmp3_, (gint) _tmp1_);
	_tmp3_ = (_vala_PlanifyCLIOutputFormatterFieldDef_array_free (_tmp3_, _tmp3__length1), NULL);
	json_builder_set_member_name (builder, "project");
	_tmp5_ = planify_cli_output_formatter_get_project_fields (project, &_tmp4_);
	_tmp6_ = _tmp5_;
	_tmp6__length1 = _tmp4_;
	planify_cli_output_formatter_add_object (builder, _tmp6_, (gint) _tmp4_);
	_tmp6_ = (_vala_PlanifyCLIOutputFormatterFieldDef_array_free (_tmp6_, _tmp6__length1), NULL);
	json_builder_end_object (builder);
	_tmp7_ = json_generator_new ();
	generator = _tmp7_;
	_tmp8_ = json_builder_get_root (builder);
	_tmp9_ = _tmp8_;
	json_generator_set_root (generator, _tmp9_);
	__vala_JsonNode_free0 (_tmp9_);
	json_generator_set_pretty (generator, TRUE);
	_tmp10_ = stdout;
	_tmp11_ = json_generator_to_data (generator, NULL);
	_tmp12_ = _tmp11_;
	fprintf (_tmp10_, "%s\n", _tmp12_);
	_g_free0 (_tmp12_);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
}

void
planify_cli_output_formatter_print_projects_list (GeeArrayList* projects)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp14_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp15_;
	JsonBuilder* _tmp16_;
	JsonNode* _tmp17_;
	JsonNode* _tmp18_;
	FILE* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	g_return_if_fail (projects != NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_array (_tmp1_);
	{
		GeeArrayList* _project_list = NULL;
		gint _project_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _project_index = 0;
		_project_list = projects;
		_tmp2_ = _project_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_project_size = _tmp4_;
		_project_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ObjectsProject* project = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			JsonBuilder* _tmp9_;
			ObjectsProject* _tmp10_;
			gint _tmp11_ = 0;
			PlanifyCLIOutputFormatterFieldDef* _tmp12_;
			PlanifyCLIOutputFormatterFieldDef* _tmp13_;
			gint _tmp13__length1;
			_project_index = _project_index + 1;
			_tmp5_ = _project_index;
			_tmp6_ = _project_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _project_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _project_index);
			project = (ObjectsProject*) _tmp8_;
			_tmp9_ = builder;
			_tmp10_ = project;
			_tmp12_ = planify_cli_output_formatter_get_project_fields (_tmp10_, &_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp13__length1 = _tmp11_;
			planify_cli_output_formatter_add_object (_tmp9_, _tmp13_, (gint) _tmp11_);
			_tmp13_ = (_vala_PlanifyCLIOutputFormatterFieldDef_array_free (_tmp13_, _tmp13__length1), NULL);
			_g_object_unref0 (project);
		}
	}
	_tmp14_ = builder;
	json_builder_end_array (_tmp14_);
	_tmp15_ = json_generator_new ();
	generator = _tmp15_;
	_tmp16_ = builder;
	_tmp17_ = json_builder_get_root (_tmp16_);
	_tmp18_ = _tmp17_;
	json_generator_set_root (generator, _tmp18_);
	__vala_JsonNode_free0 (_tmp18_);
	json_generator_set_pretty (generator, TRUE);
	_tmp19_ = stdout;
	_tmp20_ = json_generator_to_data (generator, NULL);
	_tmp21_ = _tmp20_;
	fprintf (_tmp19_, "%s\n", _tmp21_);
	_g_free0 (_tmp21_);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
}

void
planify_cli_output_formatter_print_tasks_list (GeeArrayList* items)
{
	JsonBuilder* builder = NULL;
	JsonBuilder* _tmp0_;
	JsonBuilder* _tmp1_;
	JsonBuilder* _tmp14_;
	JsonGenerator* generator = NULL;
	JsonGenerator* _tmp15_;
	JsonBuilder* _tmp16_;
	JsonNode* _tmp17_;
	JsonNode* _tmp18_;
	FILE* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	g_return_if_fail (items != NULL);
	_tmp0_ = json_builder_new ();
	builder = _tmp0_;
	_tmp1_ = builder;
	json_builder_begin_array (_tmp1_);
	{
		GeeArrayList* _item_list = NULL;
		gint _item_size = 0;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _item_index = 0;
		_item_list = items;
		_tmp2_ = _item_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_item_size = _tmp4_;
		_item_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			ObjectsItem* item = NULL;
			GeeArrayList* _tmp7_;
			gpointer _tmp8_;
			JsonBuilder* _tmp9_;
			ObjectsItem* _tmp10_;
			gint _tmp11_ = 0;
			PlanifyCLIOutputFormatterFieldDef* _tmp12_;
			PlanifyCLIOutputFormatterFieldDef* _tmp13_;
			gint _tmp13__length1;
			_item_index = _item_index + 1;
			_tmp5_ = _item_index;
			_tmp6_ = _item_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _item_list;
			_tmp8_ = gee_abstract_list_get ((GeeAbstractList*) _tmp7_, _item_index);
			item = (ObjectsItem*) _tmp8_;
			_tmp9_ = builder;
			_tmp10_ = item;
			_tmp12_ = planify_cli_output_formatter_get_item_fields (_tmp10_, &_tmp11_);
			_tmp13_ = _tmp12_;
			_tmp13__length1 = _tmp11_;
			planify_cli_output_formatter_add_object (_tmp9_, _tmp13_, (gint) _tmp11_);
			_tmp13_ = (_vala_PlanifyCLIOutputFormatterFieldDef_array_free (_tmp13_, _tmp13__length1), NULL);
			_g_object_unref0 (item);
		}
	}
	_tmp14_ = builder;
	json_builder_end_array (_tmp14_);
	_tmp15_ = json_generator_new ();
	generator = _tmp15_;
	_tmp16_ = builder;
	_tmp17_ = json_builder_get_root (_tmp16_);
	_tmp18_ = _tmp17_;
	json_generator_set_root (generator, _tmp18_);
	__vala_JsonNode_free0 (_tmp18_);
	json_generator_set_pretty (generator, TRUE);
	_tmp19_ = stdout;
	_tmp20_ = json_generator_to_data (generator, NULL);
	_tmp21_ = _tmp20_;
	fprintf (_tmp19_, "%s\n", _tmp21_);
	_g_free0 (_tmp21_);
	_g_object_unref0 (generator);
	_g_object_unref0 (builder);
}

static void
planify_cli_output_formatter_add_object (JsonBuilder* builder,
                                         PlanifyCLIOutputFormatterFieldDef* fields,
                                         gint fields_length1)
{
	g_return_if_fail (builder != NULL);
	json_builder_begin_object (builder);
	{
		PlanifyCLIOutputFormatterFieldDef* field_collection = NULL;
		gint field_collection_length1 = 0;
		gint _field_collection_size_ = 0;
		gint field_it = 0;
		field_collection = fields;
		field_collection_length1 = fields_length1;
		for (field_it = 0; field_it < field_collection_length1; field_it = field_it + 1) {
			PlanifyCLIOutputFormatterFieldDef _tmp0_;
			PlanifyCLIOutputFormatterFieldDef _tmp1_ = {0};
			PlanifyCLIOutputFormatterFieldDef field = {0};
			_tmp0_ = field_collection[field_it];
			planify_cli_output_formatter_field_def_copy (&_tmp0_, &_tmp1_);
			field = _tmp1_;
			{
				PlanifyCLIOutputFormatterFieldDef _tmp2_;
				const gchar* _tmp3_;
				PlanifyCLIOutputFormatterFieldDef _tmp4_;
				PlanifyCLIOutputFormatterFieldValueAdder _tmp5_;
				gpointer _tmp5__target;
				_tmp2_ = field;
				_tmp3_ = _tmp2_.name;
				json_builder_set_member_name (builder, _tmp3_);
				_tmp4_ = field;
				_tmp5_ = _tmp4_.add_value;
				_tmp5__target = _tmp4_.add_value_target;
				_tmp5_ (builder, _tmp5__target);
				planify_cli_output_formatter_field_def_destroy (&field);
			}
		}
	}
	json_builder_end_object (builder);
}

PlanifyCLIOutputFormatter*
planify_cli_output_formatter_construct (GType object_type)
{
	PlanifyCLIOutputFormatter * self = NULL;
	self = (PlanifyCLIOutputFormatter*) g_object_new (object_type, NULL);
	return self;
}

PlanifyCLIOutputFormatter*
planify_cli_output_formatter_new (void)
{
	return planify_cli_output_formatter_construct (PLANIFY_CLI_TYPE_OUTPUT_FORMATTER);
}

static void
planify_cli_output_formatter_field_def_copy (const PlanifyCLIOutputFormatterFieldDef* self,
                                             PlanifyCLIOutputFormatterFieldDef* dest)
{
	const gchar* _tmp0_;
	gchar* _tmp1_;
	PlanifyCLIOutputFormatterFieldValueAdder _tmp2_;
	gpointer _tmp2__target;
	_tmp0_ = (*self).name;
	_tmp1_ = g_strdup (_tmp0_);
	_g_free0 ((*dest).name);
	(*dest).name = _tmp1_;
	_tmp2_ = (*self).add_value;
	_tmp2__target = (*self).add_value_target;
	((*dest).add_value_target_destroy_notify == NULL) ? NULL : ((*dest).add_value_target_destroy_notify ((*dest).add_value_target), NULL);
	(*dest).add_value = NULL;
	(*dest).add_value_target = NULL;
	(*dest).add_value_target_destroy_notify = NULL;
	(*dest).add_value = _tmp2_;
	(*dest).add_value_target = _tmp2__target;
	(*dest).add_value_target_destroy_notify = NULL;
}

static void
planify_cli_output_formatter_field_def_destroy (PlanifyCLIOutputFormatterFieldDef* self)
{
	_g_free0 ((*self).name);
	((*self).add_value_target_destroy_notify == NULL) ? NULL : ((*self).add_value_target_destroy_notify ((*self).add_value_target), NULL);
	(*self).add_value = NULL;
	(*self).add_value_target = NULL;
	(*self).add_value_target_destroy_notify = NULL;
}

static PlanifyCLIOutputFormatterFieldDef*
planify_cli_output_formatter_field_def_dup (const PlanifyCLIOutputFormatterFieldDef* self)
{
	PlanifyCLIOutputFormatterFieldDef* dup;
	dup = g_new0 (PlanifyCLIOutputFormatterFieldDef, 1);
	planify_cli_output_formatter_field_def_copy (self, dup);
	return dup;
}

static void
planify_cli_output_formatter_field_def_free (PlanifyCLIOutputFormatterFieldDef* self)
{
	planify_cli_output_formatter_field_def_destroy (self);
	g_free (self);
}

static GType
planify_cli_output_formatter_field_def_get_type_once (void)
{
	GType planify_cli_output_formatter_field_def_type_id;
	planify_cli_output_formatter_field_def_type_id = g_boxed_type_register_static ("PlanifyCLIOutputFormatterFieldDef", (GBoxedCopyFunc) planify_cli_output_formatter_field_def_dup, (GBoxedFreeFunc) planify_cli_output_formatter_field_def_free);
	return planify_cli_output_formatter_field_def_type_id;
}

static GType
planify_cli_output_formatter_field_def_get_type (void)
{
	static volatile gsize planify_cli_output_formatter_field_def_type_id__once = 0;
	if (g_once_init_enter (&planify_cli_output_formatter_field_def_type_id__once)) {
		GType planify_cli_output_formatter_field_def_type_id;
		planify_cli_output_formatter_field_def_type_id = planify_cli_output_formatter_field_def_get_type_once ();
		g_once_init_leave (&planify_cli_output_formatter_field_def_type_id__once, planify_cli_output_formatter_field_def_type_id);
	}
	return planify_cli_output_formatter_field_def_type_id__once;
}

static void
planify_cli_output_formatter_class_init (PlanifyCLIOutputFormatterClass * klass,
                                         gpointer klass_data)
{
	planify_cli_output_formatter_parent_class = g_type_class_peek_parent (klass);
}

static void
planify_cli_output_formatter_instance_init (PlanifyCLIOutputFormatter * self,
                                            gpointer klass)
{
}

static GType
planify_cli_output_formatter_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (PlanifyCLIOutputFormatterClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) planify_cli_output_formatter_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (PlanifyCLIOutputFormatter), 0, (GInstanceInitFunc) planify_cli_output_formatter_instance_init, NULL };
	GType planify_cli_output_formatter_type_id;
	planify_cli_output_formatter_type_id = g_type_register_static (G_TYPE_OBJECT, "PlanifyCLIOutputFormatter", &g_define_type_info, 0);
	return planify_cli_output_formatter_type_id;
}

GType
planify_cli_output_formatter_get_type (void)
{
	static volatile gsize planify_cli_output_formatter_type_id__once = 0;
	if (g_once_init_enter (&planify_cli_output_formatter_type_id__once)) {
		GType planify_cli_output_formatter_type_id;
		planify_cli_output_formatter_type_id = planify_cli_output_formatter_get_type_once ();
		g_once_init_leave (&planify_cli_output_formatter_type_id__once, planify_cli_output_formatter_type_id);
	}
	return planify_cli_output_formatter_type_id__once;
}

