/* PIKA - Photo and Image Kooker Application
 * a rebranding of The GNU Image Manipulation Program (created with heckimp)
 * A derived work which may be trivial. However, any changes may be (C)2023 by Aldercone Studio
 *
 * Original copyright, applying to most contents (license remains unchanged): 
 * Copyright (C) 1995 Spencer Kimball and Peter Mattis
 *
 * pikasaveprocedure.h
 * Copyright (C) 2019 Michael Natterer <mitch@gimp.org>
 *
 * This library is free software: you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 3 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
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library.  If not, see
 * <https://www.gnu.org/licenses/>.
 */

#ifndef __PIKA_SAVE_PROCEDURE_H__
#define __PIKA_SAVE_PROCEDURE_H__

#include <libpika/pikafileprocedure.h>

G_BEGIN_DECLS

/* For information look into the C source or the html documentation */


/**
 * PikaRunSaveFunc:
 * @procedure:   the #PikaProcedure that runs.
 * @run_mode:    the #PikaRunMode.
 * @image:       the image to save.
 * @n_drawables: the number of drawables to save.
 * @drawables: (array length=n_drawables):   the drawables to save.
 * @file:        the #GFile to save to.
 * @metadata:    metadata object prepared for the mimetype passed in
 *               pika_file_procedure_set_mime_types() if export_metadata
 *               argument was set in pika_save_procedure_new().
 * @config:      the @procedure's remaining arguments.
 * @run_data: (closure): the run_data given in pika_save_procedure_new().
 *
 * The save function is run during the lifetime of the PIKA session,
 * each time a plug-in save procedure is called.
 *
 * If a MimeType was passed in pika_save_procedure_new(), then @metadata will be
 * non-%NULL and can be tweaked by the run() function if needed. Otherwise you
 * can let it as-is and it will be stored back into the exported @file according
 * to rules on metadata export shared across formats.
 *
 * Returns: (transfer full): the @procedure's return values.
 *
 * Since: 3.0
 **/
typedef PikaValueArray * (* PikaRunSaveFunc) (PikaProcedure        *procedure,
                                              PikaRunMode           run_mode,
                                              PikaImage            *image,
                                              gint                  n_drawables,
                                              PikaDrawable        **drawables,
                                              GFile                *file,
                                              PikaMetadata         *metadata,
                                              PikaProcedureConfig  *config,
                                              gpointer              run_data);


#define PIKA_TYPE_SAVE_PROCEDURE            (pika_save_procedure_get_type ())
#define PIKA_SAVE_PROCEDURE(obj)            (G_TYPE_CHECK_INSTANCE_CAST ((obj), PIKA_TYPE_SAVE_PROCEDURE, PikaSaveProcedure))
#define PIKA_SAVE_PROCEDURE_CLASS(klass)    (G_TYPE_CHECK_CLASS_CAST ((klass), PIKA_TYPE_SAVE_PROCEDURE, PikaSaveProcedureClass))
#define PIKA_IS_SAVE_PROCEDURE(obj)         (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PIKA_TYPE_SAVE_PROCEDURE))
#define PIKA_IS_SAVE_PROCEDURE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PIKA_TYPE_SAVE_PROCEDURE))
#define PIKA_SAVE_PROCEDURE_GET_CLASS(obj)  (G_TYPE_INSTANCE_GET_CLASS ((obj), PIKA_TYPE_SAVE_PROCEDURE, PikaSaveProcedureClass))


typedef struct _PikaSaveProcedure        PikaSaveProcedure;
typedef struct _PikaSaveProcedureClass   PikaSaveProcedureClass;
typedef struct _PikaSaveProcedurePrivate PikaSaveProcedurePrivate;

struct _PikaSaveProcedure
{
  PikaFileProcedure         parent_instance;

  PikaSaveProcedurePrivate *priv;
};

struct _PikaSaveProcedureClass
{
  PikaFileProcedureClass parent_class;
};


GType           pika_save_procedure_get_type              (void) G_GNUC_CONST;

PikaProcedure * pika_save_procedure_new                   (PikaPlugIn        *plug_in,
                                                           const gchar       *name,
                                                           PikaPDBProcType    proc_type,
                                                           gboolean           export_metadata,
                                                           PikaRunSaveFunc    run_func,
                                                           gpointer           run_data,
                                                           GDestroyNotify     run_data_destroy);

void            pika_save_procedure_set_support_exif      (PikaSaveProcedure *procedure,
                                                           gboolean           supports);
void            pika_save_procedure_set_support_iptc      (PikaSaveProcedure *procedure,
                                                           gboolean           supports);
void            pika_save_procedure_set_support_xmp       (PikaSaveProcedure *procedure,
                                                           gboolean           supports);
void            pika_save_procedure_set_support_profile   (PikaSaveProcedure *procedure,
                                                           gboolean           supports);
void            pika_save_procedure_set_support_thumbnail (PikaSaveProcedure *procedure,
                                                           gboolean           supports);
void            pika_save_procedure_set_support_comment   (PikaSaveProcedure *procedure,
                                                            gboolean           supports);

gboolean        pika_save_procedure_get_support_exif      (PikaSaveProcedure *procedure);
gboolean        pika_save_procedure_get_support_iptc      (PikaSaveProcedure *procedure);
gboolean        pika_save_procedure_get_support_xmp       (PikaSaveProcedure *procedure);
gboolean        pika_save_procedure_get_support_profile   (PikaSaveProcedure *procedure);
gboolean        pika_save_procedure_get_support_thumbnail (PikaSaveProcedure *procedure);
gboolean        pika_save_procedure_get_support_comment   (PikaSaveProcedure *procedure);


G_END_DECLS

#endif  /*  __PIKA_SAVE_PROCEDURE_H__  */
