// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Create as $Create } from "@wailsio/runtime";

/**
 * Plugin defines the interface that all plugins must implement.
 */
export type Plugin = any;

/**
 * PluginInfo contains metadata about a registered plugin.
 */
export class PluginInfo {
    "Name": string;
    "Namespace": string;
    "Description": string;
    "Version": string;
    "Author": string;

    /**
     * List of sub-routes this plugin handles
     */
    "Routes": string[];

    /** Creates a new PluginInfo instance. */
    constructor($$source: Partial<PluginInfo> = {}) {
        if (!("Name" in $$source)) {
            this["Name"] = "";
        }
        if (!("Namespace" in $$source)) {
            this["Namespace"] = "";
        }
        if (!("Description" in $$source)) {
            this["Description"] = "";
        }
        if (!("Version" in $$source)) {
            this["Version"] = "";
        }
        if (!("Author" in $$source)) {
            this["Author"] = "";
        }
        if (!("Routes" in $$source)) {
            this["Routes"] = [];
        }

        Object.assign(this, $$source);
    }

    /**
     * Creates a new PluginInfo instance from a string or object.
     */
    static createFrom($$source: any = {}): PluginInfo {
        const $$createField5_0 = $$createType0;
        let $$parsedSource = typeof $$source === 'string' ? JSON.parse($$source) : $$source;
        if ("Routes" in $$parsedSource) {
            $$parsedSource["Routes"] = $$createField5_0($$parsedSource["Routes"]);
        }
        return new PluginInfo($$parsedSource as Partial<PluginInfo>);
    }
}

// Private type creation functions
const $$createType0 = $Create.Array($Create.Any);
