openapi: 3.1.0
info:
  title: Asystir Agent-Readable API
  version: "1.0.0"
  description: |
    Public, machine-readable surface of asystir.com for AI agents and crawlers.

    This spec documents two categories of endpoints:

    1. **Static JSON endpoints under `/ai/`** — canonical context, products, pricing,
       capabilities, FAQ, and changelog. Cacheable, GET-only, no auth.
    2. **Form-based action endpoints** — existing PHP form handlers an agent can
       POST to in order to request quotes, demos, or contact a human.

    For human-readable orientation, see https://www.asystir.com/agent-guide.html
    For high-signal company summary, see https://www.asystir.com/llms.txt
  contact:
    name: Asystir
    email: info@asystir.com
    url: https://www.asystir.com
  license:
    name: Proprietary
servers:
  - url: https://www.asystir.com
    description: Production

tags:
  - name: discovery
    description: Static JSON endpoints describing the platform
  - name: forms
    description: Action endpoints (form-based) an agent can submit on behalf of a user

paths:
  /ai/context.json:
    get:
      tags: [discovery]
      summary: Company identity and canonical entrypoints
      description: Canonical "who we are" doc — company description, contact, languages, endpoints, actions.
      responses:
        "200":
          description: Company context
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AIContext"

  /ai/products.json:
    get:
      tags: [discovery]
      summary: Product catalog
      description: Full product catalog with categories, integrations, target users.
      responses:
        "200":
          description: Product catalog
          content:
            application/json:
              schema:
                type: object
                properties:
                  products:
                    type: array
                    items:
                      $ref: "#/components/schemas/Product"

  /ai/pricing.json:
    get:
      tags: [discovery]
      summary: Indicative pricing tiers
      description: |
        Indicative pricing ranges for Asystir tiers and add-ons.
        Final pricing requires submitting the Estimativo form for an institution-specific quote.
      responses:
        "200":
          description: Pricing tiers and add-ons
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Pricing"

  /ai/capabilities.json:
    get:
      tags: [discovery]
      summary: Platform capabilities and supported standards
      description: What each role can do on the platform, supported integrations, deployment options.
      responses:
        "200":
          description: Capabilities map
          content:
            application/json:
              schema:
                type: object

  /ai/faq.json:
    get:
      tags: [discovery]
      summary: FAQ in machine-readable form
      description: Same Q&A as visible FAQPage JSON-LD, in flat JSON for direct agent consumption.
      responses:
        "200":
          description: FAQ list
          content:
            application/json:
              schema:
                type: object
                properties:
                  faqs:
                    type: array
                    items:
                      $ref: "#/components/schemas/FAQItem"

  /ai/changelog.json:
    get:
      tags: [discovery]
      summary: Recent product changes
      description: Recent product, AI, and compliance changes (manual updates).
      responses:
        "200":
          description: Changelog entries
          content:
            application/json:
              schema:
                type: object

  /send_estimativo.php:
    post:
      tags: [forms]
      summary: Submit a general cost-estimate request
      description: |
        Submits an institution profile to the Asystir sales team and triggers
        an email auto-reply to the requester plus a Telegram notification to sales.

        This is the form behind https://www.asystir.com/Estimativo.html
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/EstimativoForm"
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/EstimativoForm"
      responses:
        "200":
          description: Submission accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  message: { type: string }

  /send_estimativo_clinica.php:
    post:
      tags: [forms]
      summary: Submit a clinic-specific cost-estimate request
      description: |
        Clinic-focused variant of the estimativo form — includes medical specialty
        multi-select, AI feature interest, and reception-focused module set.

        This is the form behind https://www.asystir.com/EstimativoClinica.html
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/EstimativoClinicaForm"
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/EstimativoClinicaForm"
      responses:
        "200":
          description: Submission accepted
          content:
            application/json:
              schema:
                type: object
                properties:
                  success: { type: boolean }
                  message: { type: string }

  /PhpFunctions/SendDemoRequest.php:
    post:
      tags: [forms]
      summary: Request a personalized live demo
      description: Submits a demo request to the sales team. Behind the global "Solicite Demo" popup.
      requestBody:
        required: true
        content:
          application/x-www-form-urlencoded:
            schema:
              $ref: "#/components/schemas/DemoRequestForm"
      responses:
        "200":
          description: Demo request received
          content:
            application/json:
              schema:
                type: object

components:
  schemas:
    AIContext:
      type: object
      properties:
        site: { type: string, example: "asystir.com" }
        name: { type: string }
        tagline: { type: string }
        summary: { type: string }
        url: { type: string, format: uri }
        languages:
          type: array
          items: { type: string }
        contact: { type: object }
        endpoints: { type: object }
        actions:
          type: array
          items: { type: object }

    Product:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        category: { type: string, enum: [appointments, emr, prescriptions, lab, imaging, hospital_suite, ai_agent, ai_assistant, private_ai, analytics, telemedicine, ems] }
        url: { type: string, format: uri }
        shortDescription: { type: string }
        longDescription: { type: string }
        keyFeatures:
          type: array
          items: { type: string }
        integrations:
          type: array
          items: { type: string }
        complianceFrameworks:
          type: array
          items: { type: string }
        indicativePricing:
          type: object

    Pricing:
      type: object
      properties:
        currency: { type: string, example: "ARS" }
        billingCycle: { type: string, example: "monthly" }
        disclaimer: { type: string }
        tiers:
          type: array
          items: { $ref: "#/components/schemas/PricingTier" }
        addOns:
          type: array
          items: { type: object }
        quoteEndpoints: { type: object }

    PricingTier:
      type: object
      properties:
        id: { type: string }
        name: { type: string }
        targetInstitution: { type: string }
        doctorsRange: { type: string }
        monthlyPriceFromARS: { type: number }
        monthlyPriceToARS: { type: number }
        setupFeeRangeARS:
          type: array
          items: { type: number }
        includedModules:
          type: array
          items: { type: string }
        supportSLA: { type: string }
        bestFor: { type: string }

    FAQItem:
      type: object
      properties:
        category: { type: string }
        question: { type: string }
        answer: { type: string }

    EstimativoForm:
      type: object
      required: [institucion, contacto, email]
      properties:
        institucion: { type: string, description: "Institution name" }
        contacto: { type: string, description: "Contact person name" }
        email: { type: string, format: email }
        telefono: { type: string }
        tipo_institucion: { type: string, enum: [consultorio, clinica, centro_medico, sanatorio, hospital, otro] }
        areas_recepcion: { type: string, description: "Range: 1, 1-5, 5-10, 10-20, ..." }
        personal_admin: { type: string }
        equipo_tecnico: { type: string }
        profesionales: { type: string }
        enfermeros: { type: string }
        locaciones: { type: integer, description: "Number of physical locations" }
        mod_turnos: { type: boolean }
        mod_hc: { type: boolean }
        mod_recetas: { type: boolean }
        mod_lab: { type: boolean }
        mod_imagenes: { type: boolean }
        mod_admision: { type: boolean }
        mod_camas: { type: boolean }
        mod_hc_internacion: { type: boolean }
        mod_enfermeria: { type: boolean }
        mod_inventario: { type: boolean }
        mod_emergencias: { type: boolean }
        mod_ai_turnos: { type: boolean }
        mod_ai_agentic: { type: boolean }
        mod_ai_server: { type: boolean }
        mensaje: { type: string }

    EstimativoClinicaForm:
      type: object
      required: [institucion, contacto, email]
      properties:
        institucion: { type: string }
        contacto: { type: string }
        email: { type: string, format: email }
        telefono: { type: string }
        especialidad:
          type: array
          description: Multi-select medical specialties
          items:
            type: string
            enum: [cardiologia, clinica_medica, dermatologia, endocrinologia, gastroenterologia, ginecologia, hematologia, infectologia, medicina_laboral, nefrologia, neumologia, neurologia, nutricion, obstetricia, oftalmologia, oncologia, otorrinolaringologia, pediatria, policonsultorio, psicologia, psiquiatria, reumatologia, traumatologia, urologia, emergencia, otra]
        mensaje: { type: string }

    DemoRequestForm:
      type: object
      required: [name, email, company]
      properties:
        name: { type: string }
        email: { type: string, format: email }
        phone: { type: string }
        company: { type: string, description: "Institution name" }
        country: { type: string }
        topic: { type: string }
        comments: { type: string }
