#!/usr/bin/env python3
"""
GET /api/v1/health — public healthcheck endpoint.
No authentication required.
"""

from flask import Blueprint, jsonify
from datetime import datetime, timezone

health_bp = Blueprint("v1_health", __name__, url_prefix="/api/v1")


@health_bp.route("/health", methods=["GET"])
def health():
    """
    Health check
    ---
    tags:
      - System
    summary: Public healthcheck — returns API status and timestamp
    responses:
      200:
        description: API is healthy
        schema:
          type: object
          properties:
            status:
              type: string
              example: ok
            version:
              type: string
              example: "1.0"
            timestamp:
              type: string
              format: date-time
    """
    return jsonify(
        {
            "status": "ok",
            "version": "1.0",
            "api": "Turf SaaS API v1",
            "timestamp": datetime.now(timezone.utc).isoformat(),
        }
    ), 200
