%% -*- mode: erlang -*-
%% Macula HTTP/3 Mesh - Root Rebar3 Configuration

{erl_opts, [
    debug_info,
    warnings_as_errors,
    warn_export_vars,
    warn_unused_vars,
    warn_obsolete_guard
]}.

{deps, [
    %% QUIC transport (using Hex for publishable packages)
    {quicer, "0.2.15"},

    %% MessagePack serialization
    {msgpack, "0.8.1"},

    %% Process registry
    {gproc, "0.9.1"}

    %% JSON encoding: Using built-in json module (OTP 27+)
]}.

{project_plugins, [
    rebar3_hex,
    rebar3_proper,
    rebar3_ex_doc
]}.

%% Test configuration
{cover_enabled, true}.
{cover_opts, [verbose]}.

{ct_opts, [
    {sys_config, "config/test.sys.config"}
]}.

{dialyzer, [
    {warnings, [
        no_return,
        no_unused,
        no_improper_lists,
        no_fun_app,
        no_match,
        no_opaque,
        no_fail_call,
        error_handling
    ]},
    {plt_apps, top_level_deps},
    {plt_extra_apps, []},
    {plt_location, local},
    {base_plt_apps, [erts, kernel, stdlib, crypto, public_key, ssl]},
    {base_plt_location, global}
]}.

%% Shell configuration
{shell, [
    {apps, [macula]},
    {config, "config/sys.config"}
]}.

%% Release configuration
{relx, [
    {release, {macula, "0.4.1"}, [
        macula,
        sasl,
        runtime_tools
        %% observer - removed for headless deployments (requires wx/OpenGL)
    ]},

    {mode, dev},
    {include_erts, true},
    {extended_start_script, true},

    {sys_config, "./config/sys.config"},
    {vm_args, "./config/vm.args"},

    {overlay, [
        {mkdir, "log"},
        {mkdir, "data"},
        {copy, "README.md", "README.md"},
        {copy, "LICENSE", "LICENSE"}
    ]}
]}.

%% Profiles
{profiles, [
    {test, [
        {deps, [
            {proper, "1.4.0"},
            {meck, "0.9.2"}
        ]},
        {erl_opts, [nowarn_export_all]}
    ]},

    {prod, [
        {erl_opts, [
            no_debug_info,
            deterministic
        ]},
        {relx, [
            {mode, prod},
            {dev_mode, false},
            {include_src, false}
        ]}
    ]},

    {lint, [
        {plugins, [
            {rebar3_lint, "3.2.5"}
        ]}
    ]}
]}.

%% Documentation
{ex_doc, [
    {extras, [
        {"README.md", #{title => "Overview"}},
        {"LICENSE", #{title => "License"}},
        {"architecture/MACULA_PROJECT_STRUCTURE.md", #{title => "Project Structure"}},
        {"architecture/macula_http3_mesh_root.md", #{title => "Architecture"}},
        {"architecture/macula_http3_mesh_quick_start.md", #{title => "Quick Start"}},
        {"architecture/macula_http3_mesh_hello_world.md", #{title => "Hello World"}},
        {"architecture/macula_http3_mesh_roadmap.md", #{title => "Roadmap"}},
        {"architecture/DOCUMENTATION_STATUS.md", #{title => "Documentation Status"}},
        {"architecture/macula_http3_mesh_contributing.md", #{title => "Contributing"}}
    ]},
    {main, "readme"},
    {source_url, "https://github.com/macula-io/macula"},
    {prefix_ref_vsn_with_v, false}
]}.

%% Hex package configuration (for future publishing)
{hex, [
    {doc, #{provider => ex_doc}}
]}.
