{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "Bot",
  "description": "Bot account for automated actions.",
  "x-source": "https://api.medplum.com/openapi.json",
  "properties": {
    "resourceType": {
      "description": "This is a Bot resource",
      "type": "string"
    },
    "id": {
      "description": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.",
      "$ref": "#/components/schemas/string"
    },
    "meta": {
      "description": "The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.",
      "$ref": "#/components/schemas/Meta"
    },
    "implicitRules": {
      "description": "A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.",
      "$ref": "#/components/schemas/uri"
    },
    "language": {
      "description": "The base language in which the resource is written.",
      "$ref": "#/components/schemas/code"
    },
    "text": {
      "description": "A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it \"clinically safe\" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.",
      "$ref": "#/components/schemas/Narrative"
    },
    "contained": {
      "description": "These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.",
      "items": {
        "$ref": "#/components/schemas/Resource"
      },
      "type": "array"
    },
    "extension": {
      "description": "May be used to represent additional information that is not part of the basic definition of the resource. To make the use of extensions safe and manageable, there is a strict set of governance  applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.",
      "items": {
        "$ref": "#/components/schemas/Extension"
      },
      "type": "array"
    },
    "modifierExtension": {
      "description": "May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).",
      "items": {
        "$ref": "#/components/schemas/Extension"
      },
      "type": "array"
    },
    "identifier": {
      "description": "An identifier for this bot.",
      "items": {
        "$ref": "#/components/schemas/Identifier"
      },
      "type": "array"
    },
    "name": {
      "description": "A name associated with the Bot.",
      "$ref": "#/components/schemas/string"
    },
    "description": {
      "description": "A summary, characterization or explanation of the Bot.",
      "$ref": "#/components/schemas/string"
    },
    "runtimeVersion": {
      "description": "The identifier of the bot runtime environment (i.e., vmcontext, awslambda, etc).",
      "enum": [
        "awslambda",
        "vmcontext",
        "fission"
      ]
    },
    "timeout": {
      "description": "The maximum allowed execution time of the bot in seconds.",
      "$ref": "#/components/schemas/integer"
    },
    "photo": {
      "description": "Image of the bot.",
      "$ref": "#/components/schemas/Attachment"
    },
    "cronTiming": {
      "description": "A schedule for the bot to be executed.",
      "$ref": "#/components/schemas/Timing"
    },
    "cronString": {
      "description": "A schedule for the bot to be executed.",
      "$ref": "#/components/schemas/string"
    },
    "category": {
      "description": "A code that classifies the service for searching, sorting and display purposes (e.g. \"Surgical Procedure\").",
      "items": {
        "$ref": "#/components/schemas/CodeableConcept"
      },
      "type": "array"
    },
    "system": {
      "description": "Optional flag to indicate that the bot is a system bot and therefore has access to system secrets.",
      "$ref": "#/components/schemas/boolean"
    },
    "runAsUser": {
      "description": "Optional flag to indicate that the bot should be run as the user.",
      "$ref": "#/components/schemas/boolean"
    },
    "publicWebhook": {
      "description": "Optional flag to indicate that the bot can be used as an unauthenticated public webhook. Note that this is a security risk and should only be used for public bots that do not require authentication.",
      "$ref": "#/components/schemas/boolean"
    },
    "streamingEnabled": {
      "description": "Optional flag to indicate that the bot should be deployed in a streaming-enabled context, allowing it to execute with streaming responses.",
      "$ref": "#/components/schemas/boolean"
    },
    "auditEventTrigger": {
      "description": "Criteria for creating an AuditEvent as a result of the bot invocation. Possible values are 'always', 'never', 'on-error', or 'on-output'. Default value is 'always'.",
      "enum": [
        "always",
        "never",
        "on-error",
        "on-output"
      ]
    },
    "auditEventDestination": {
      "description": "The destination system in which the AuditEvent is to be sent. Possible values are 'log' or 'resource'. Default value is 'resource'.",
      "items": {
        "enum": [
          "log",
          "resource"
        ]
      },
      "type": "array"
    },
    "sourceCode": {
      "description": "Bot logic in original source code form written by developers.",
      "$ref": "#/components/schemas/Attachment"
    },
    "executableCode": {
      "description": "Bot logic in executable form as a result of compiling and bundling source code.",
      "$ref": "#/components/schemas/Attachment"
    },
    "cdsService": {
      "description": "CDS service definition if the bot is used as a CDS Hooks service. See https://cds-hooks.hl7.org/ for more details.",
      "$ref": "#/components/schemas/BotCdsService"
    },
    "code": {
      "description": "@deprecated Bot logic script. Use Bot.sourceCode or Bot.executableCode instead.",
      "$ref": "#/components/schemas/string"
    }
  },
  "additionalProperties": false,
  "required": [
    "resourceType"
  ]
}