#!/usr/bin/env python3
"""Revalidacao diaria da licenca (executado via cron).

Desenvolvedor: Euquias Junior <junior@jbinfo.com.br>
"""
from __future__ import annotations

import sys
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parents[1]))

from dnsshield import create_app  # noqa: E402
from dnsshield import licenca  # noqa: E402


def main() -> int:
    app = create_app()
    with app.test_request_context():
        estado = licenca.verificar()
        print(f"status={estado['status']} autorizado={estado['autorizado']} {estado['motivo']}")
    return 0


if __name__ == "__main__":
    raise SystemExit(main())
