#pragma once
#include "./basic_types.hpp"
#include "./document_sync.hpp"
#include "./progress.hpp"

namespace lsp::protocol
{
    struct SignatureHelpClientCapabilities
    {
        struct SignatureInformation
        {
            struct ParammeterInformation
            {
                std::optional<boolean> labelOffsetSupport;
            };

            std::optional<std::vector<MarkupKind>> documentationFormat;
            std::optional<ParammeterInformation> parameterInformation;
            std::optional<boolean> activeParameterSupport;
            std::optional<boolean> noActiveParameterSupport;
        };

        std::optional<boolean> dynamicRegistration;
        std::optional<SignatureInformation> signatureInformation;
        std::optional<boolean> contextSupport;
    };

    struct SignatureHelpOptions : WorkDoneProgressOptions
    {
        std::optional<std::vector<string>> triggerCharacters;
        std::optional<std::vector<string>> retriggerCharacters;
    };

    struct SignatureHelpRegistrationOptions : TextDocumentRegistrationOptions, SignatureHelpOptions
    {
    };

    enum class SignatureHelpTriggerKind
    {
        Invoked = 1,
        TriggerCharacter = 2,
        ContentChange = 3
    };

    struct ParammeterInformation
    {
        string label;
        std::variant<string, MarkupContent> documentation;
    };

    struct SignatureInformation
    {
        string label;
        std::optional<std::variant<string, MarkupContent>> documentation;
        std::optional<std::vector<ParammeterInformation>> parameters;
        std::optional<uinteger> activeParameter;
    };

    struct SignatureHelp
    {
        std::vector<SignatureInformation> signatures;
        std::optional<uinteger> activeSignature;
        std::optional<uinteger> activeParameter;
    };

    struct SignatureHelpContext
    {
        SignatureHelpTriggerKind triggerKind;
        string triggerCharacter;
        boolean isRetrigger;
        std::optional<SignatureHelp> activeSignatureHelp;
    };

    struct SignatureHelpParams : TextDocumentPositionParams, WorkDoneProgressParams
    {
        std::optional<SignatureHelpContext> contextSupport;
    };

}
