/*
 * Copyright (C) 2024 Birb Developers
 *
 * Birb is the legal property of its developers, whose names are too
 * numerous to list here. Please refer to the AUTHORS file distributed
 * with this source distribution
 *
 * 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 2 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, see <https://www.gnu.org/licenses/>.
 */

#if !defined(BIRB_GLOBAL_HEADER_INSIDE) && !defined(BIRB_COMPILATION)
# error "only <birb.h> may be included directly"
#endif

#ifndef BIRB_FILTER_H
#define BIRB_FILTER_H

#include <gio/gio.h>

#include "birbversion.h"

G_BEGIN_DECLS

#define BIRB_TYPE_FILTER (birb_filter_get_type())

/**
 * BirbFilter:
 *
 * A BirbFilter is used to check if an item matches the filter.
 *
 * Since: 0.2
 */
BIRB_AVAILABLE_IN_0_2
G_DECLARE_DERIVABLE_TYPE(BirbFilter, birb_filter, BIRB, FILTER, GObject)

struct _BirbFilterClass {
    /*< private >*/
    GObjectClass parent;

    /*< public >*/
    gboolean (*matches)(BirbFilter *filter, GObject *item);

    /*< private >*/
    gpointer reserved[4];
};

/**
 * birb_filter_changed:
 * @filter: The instance.
 *
 * Emits [signal@Filter::changed].
 *
 * This should be called by sub classes when the filter changes.
 *
 * Since: 0.2
 */
BIRB_AVAILABLE_IN_0_2
void birb_filter_changed(BirbFilter *filter);

/**
 * birb_filter_matches:
 * @filter: The instance.
 * @item: The item.
 *
 * Checks if @item matches what @filter is looking for.
 *
 * Returns: %TRUE if the @item matches, otherwise %FALSE.
 *
 * Since: 0.2
 */
BIRB_AVAILABLE_IN_0_2
gboolean birb_filter_matches(BirbFilter *filter, GObject *item);

G_END_DECLS

#endif /* BIRB_FILTER_H */
