from __future__ import annotations

import typer

app = typer.Typer(
    name="aegro",
    help="CLI para gerenciamento agricola via API Aegro.",
    invoke_without_command=True,
)


@app.callback(invoke_without_command=True)
def _callback(ctx: typer.Context) -> None:
    """CLI para gerenciamento agricola via API Aegro."""
    if ctx.invoked_subcommand is None:
        typer.echo(ctx.get_help())


from aegro.cli.activities import activities_app  # noqa: E402
from aegro.cli.assets import assets_app  # noqa: E402
from aegro.cli.auth import auth_app  # noqa: E402
from aegro.cli.bank_accounts import bank_accounts_app  # noqa: E402
from aegro.cli.catalogs import catalogs_app  # noqa: E402
from aegro.cli.companies import companies_app  # noqa: E402
from aegro.cli.crop_glebes import crop_glebes_app  # noqa: E402
from aegro.cli.crops import crops_app  # noqa: E402
from aegro.cli.elements import elements_app  # noqa: E402
from aegro.cli.farms import farms_app  # noqa: E402
from aegro.cli.financial import financial_app  # noqa: E402
from aegro.cli.financial_categories import fin_categories_app  # noqa: E402
from aegro.cli.fuel_supplies import fuel_supplies_app  # noqa: E402
from aegro.cli.glebes import glebes_app  # noqa: E402
from aegro.cli.harvest_logs import harvest_logs_app  # noqa: E402
from aegro.cli.maintenances import maintenances_app  # noqa: E402
from aegro.cli.purchase_orders import purchase_orders_app  # noqa: E402
from aegro.cli.stock import stock_app  # noqa: E402
from aegro.cli.tags import tags_app  # noqa: E402
from aegro.cli.weather import weather_app  # noqa: E402

app.add_typer(activities_app, name="activities")
app.add_typer(assets_app, name="assets")
app.add_typer(auth_app, name="auth")
app.add_typer(bank_accounts_app, name="bank-accounts")
app.add_typer(catalogs_app, name="catalogs")
app.add_typer(companies_app, name="companies")
app.add_typer(crop_glebes_app, name="crop-glebes")
app.add_typer(crops_app, name="crops")
app.add_typer(elements_app, name="elements")
app.add_typer(farms_app, name="farms")
app.add_typer(financial_app, name="financial")
app.add_typer(fin_categories_app, name="fin-categories")
app.add_typer(fuel_supplies_app, name="fuel-supplies")
app.add_typer(glebes_app, name="glebes")
app.add_typer(harvest_logs_app, name="harvest-logs")
app.add_typer(maintenances_app, name="maintenances")
app.add_typer(purchase_orders_app, name="purchase-orders")
app.add_typer(stock_app, name="stock")
app.add_typer(tags_app, name="tags")
app.add_typer(weather_app, name="weather")


def main() -> None:
    """Entry point for the aegro CLI."""
    app()
