//
//  AboutDialogDemo.swift
//  Adwaita
//
//  Created by lambdaclan on 24.01.26.
//

// swiftlint:disable missing_docs

import Adwaita
import Foundation

enum AboutDialogDemo {

    static var sample: (inout AdwaitaAboutDialogConfig) -> Void {
        { cfg in
            applyDemoConfig(&cfg)
        }
    }

    private static let demoReleaseNotes = """
        <p>This template supports three structures: paragraphs using <code>&lt;p&gt;</code>, ordered lists using
        <code>&lt;ol&gt;</code>, and unordered lists using <code>&lt;ul&gt;</code>.
        Both list types must contain list items marked with <code>&lt;li&gt;</code>.</p>
        <p>Within paragraphs and list items, you may use <code>&lt;em&gt;</code> to apply
        <em>emphasis</em>(italic text) and <code>&lt;code&gt;</code> to mark <code>inline code</code>
        for monospaced text.
        These inline styles are supported only inside those elements.</p>
        <p>Any text placed outside <code>&lt;p&gt;</code>, <code>&lt;ol&gt;</code>,
        <code>&lt;ul&gt;</code>, or <code>&lt;li&gt;</code> tags is ignored by the template
        processor.</p>
        <ol>
        <li>Ordered list items represent numbered content and may
        include <code>&lt;em&gt;</code> for <em>emphasis</em> or <code>&lt;code&gt;</code> for inline code.</li>
            <li>They follow the same rules as paragraphs regarding allowed inline styles.</li>
        </ol>
        <ul>
        <li>Unordered list items represent bullet points and support the same inline styles.</li>
        <li>They must contain only text and allowed inline formatting.</li>
        </ul>
        """

    private static let demoComments = """
        This text demonstrates basic Pango markup along with helpful documentation links.

        Comments shown in an Adwaita AboutDialog will appear on the Details page.
        They can be long and detailed, and they may include links and Pango markup for
        formatting.

        Pango markup supports tags like:
        • <b>bold</b>
        • <i>italic</i>
        • <span foreground="steelblue">colored text</span>

        Full reference: <a href="https://docs.gtk.org/Pango/pango_markup.html">Pango Markup
        Reference</a>

        Example markup:
            <span font="14pt" weight="bold">Demo Title</span>
            <span foreground="tomato">Highlighted text</span>
            <u>Underlined text</u>

        Useful links:
        • <a href="https://adwaita-swift.aparoksha.dev/documentation/adwaita">Adwaita‑Swift Documentation</a>

        You can embed these links directly in your UI using Pango markup.
        """

    private static func applyDemoConfig(_ cfg: inout AdwaitaAboutDialogConfig) {
            cfg.appName = "Demo"
            cfg.developer = "david-swift"
            cfg.version = "Test"
            cfg.icon = .default(icon: .applicationXExecutable)

            cfg.website = URL(string: "https://adwaita-swift.aparoksha.dev/tutorials/table-of-contents")
            cfg.issues = URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift/issues")
            cfg.support = URL(string: "https://adwaita-swift.aparoksha.dev/")

            cfg.links = [
                .init(title: "Source Code", url: URL(string: "https://git.aparoksha.dev/aparoksha/adwaita-swift")),
                .init(title: "Donate", url: URL(string: "https://ko-fi.com/david_swift"))
            ]

            cfg.copyright = "© 2026 david-swift"
            cfg.license = "MIT"
            cfg.releaseNotes = demoReleaseNotes
            cfg.comments = demoComments

            cfg.credits = [
                .init(role: .developer, name: "Jane Doe"),
                .init(role: .developer, name: "John Roe"),
                .init(role: .designer, name: "Mika Sato"),
                .init(role: .artist, name: "Leo Martins"),
                .init(role: .translator, name: "Yuki Nakamura"),
                .init(role: .translator, name: "Tod Brown")
            ]

            cfg.acknowledgements = [
                .init(title: "Special Thanks", name: "GNOME Project"),
                .init(title: "Special Thanks", name: "Swift Programming Language"),
                .init(title: "Additional Support", name: "LibAdwaita Contributors")
            ]

            cfg.otherApps = [
                .init(
                    appID: "io.github.david_swift.Flashcards",
                    name: "Memorize",
                    summary: "An app for creating, studying, and importing flashcard sets with a built‑in test mode."
                )
            ]
    }

}

// swiftlint:enable missing_docs
