/*
 * Copyright {{Year}} {{Author}} <{{Email}}>
 *
 * SPDX-License-Identifier: LGPL-2.1-or-later
 */

#include "config.h"

#include "fu-{{vendor_dash_example}}-device.h"
#include "fu-{{vendor_dash_example}}-firmware.h"
#include "fu-{{vendor_dash_example}}-plugin.h"

struct _Fu{{VendorExample}}Plugin {
	FuPlugin parent_instance;
};

G_DEFINE_TYPE(Fu{{VendorExample}}Plugin, fu_{{vendor_example}}_plugin, FU_TYPE_PLUGIN)

static void
fu_{{vendor_example}}_plugin_init(Fu{{VendorExample}}Plugin *self)
{
	fu_plugin_add_flag(FU_PLUGIN(self), FWUPD_PLUGIN_FLAG_MUTABLE_ENUMERATION);
}

static void
fu_{{vendor_example}}_plugin_constructed(GObject *obj)
{
	FuPlugin *plugin = FU_PLUGIN(obj);
	FuContext *ctx = fu_plugin_get_context(plugin);
	fu_context_add_quirk_key(ctx, "{{VendorExample}}StartAddr");
{%- if Parent == 'Usb' %}
	fu_plugin_add_udev_subsystem(plugin, "usb");
{%- elif Parent == 'Hid' %}
	fu_plugin_add_udev_subsystem(plugin, "hidraw");
{%- endif %}
	fu_plugin_add_device_gtype(plugin, FU_TYPE_{{VENDOR_EXAMPLE}}_DEVICE);
	fu_plugin_add_firmware_gtype(plugin, FU_TYPE_{{VENDOR_EXAMPLE}}_FIRMWARE);
}

static void
fu_{{vendor_example}}_plugin_class_init(Fu{{VendorExample}}PluginClass *klass)
{
	FuPluginClass *plugin_class = FU_PLUGIN_CLASS(klass);
	plugin_class->constructed = fu_{{vendor_example}}_plugin_constructed;
}
