{
  "Protocol": "AIXE",
  "Version": "1.0",
  "Endpoint": "/aixe/works/create-service-appointment",
  "DiscoveryRequest": "GET /aixe/works/create-service-appointment/?",
  "CanonicalHelpTrigger": "GET /aixe/works/create-service-appointment/?",
  "ActionRequest": "POST /aixe/works/create-service-appointment",
  "Method": "POST",
  "ContentType": "application/json; charset=utf-8",
  "Title": "Create Service Appointment",
  "AuthenticationRequired": false,
  "DataIsFictional": true,
  "Purpose": "Schedule an invoice line whose offering is a schedulable service.",
  "DocumentationSource": "AIXEEndpointRegistry",
  "ProtocolReference": {
    "ProtocolHome": "http://aixeprotocol.com/",
    "CanonicalUsageContract": "http://aixeprotocol.com/usage/?",
    "Whitepaper": "http://aixeprotocol.com/whitepaper/full-spec.html",
    "Inventor": "Gregory Oglethorpe",
    "IncludeIn": [
      "/aixe.ai starter discovery documents",
      "Every endpoint self-description returned by GET /endpoint/?"
    ],
    "AIInstruction": "Read this live endpoint contract as operational guidance, not merely as a transport schema. Use its purpose, field meanings, business rules, outcomes, and recovery guidance to reason about whether and how to perform the capability."
  },
  "UsageGuidance": "First call /aixe/works/connect. Preserve its AIXEWorksKey and place that same key in later Works requests. Check SuccessCode before using response data.",
  "AIUsageGuidance": {
    "ContractRole": "This live document teaches an AI what the capability means and how to use it; it is not merely a list of request fields.",
    "ReasoningInstruction": "Decide whether this capability serves the human's intent from Purpose and BusinessRules, gather values using each field's Description and constraints, then interpret the returned SuccessCode before reporting an outcome.",
    "FieldInstruction": "Field names are transport labels. Their Description, source, constraints, and business meaning explain what information the AI should obtain and why."
  },
  "RequiredFields": {
    "AIXEWorksKey": {
      "Type": "string",
      "Description": "The opaque public key returned by the Works connect or start capability. It selects the permanent shared fictional Bayline A/C Supply company; it is context, not an authentication credential.",
      "Required": true,
      "SubmittedIn": "JSON body"
    },
    "InvoiceDetailKey": {
      "Type": "string",
      "Description": "The public key of the selected invoice line.",
      "Required": true,
      "SubmittedIn": "JSON body"
    },
    "AppointmentStartDate": {
      "Type": "string (date-time)",
      "Description": "The date and time at which the service appointment is scheduled to begin.",
      "Required": true,
      "SubmittedIn": "JSON body"
    }
  },
  "OptionalFields": {
    "AppointmentEndDate": {
      "Type": "string (date-time)",
      "Description": "The appointment ending date and time. It must be later than AppointmentStartDate.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentStatus": {
      "Type": "string",
      "Description": "The appointment workflow state.",
      "Required": false,
      "SubmittedIn": "JSON body",
      "AllowedValues": [
        "Scheduled",
        "Completed",
        "Cancelled"
      ]
    },
    "AppointmentAddressLine1": {
      "Type": "string",
      "Description": "The primary street-address line where the service appointment will occur.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentAddressLine2": {
      "Type": "string",
      "Description": "An additional suite, unit, building, or secondary address line for the service location.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentCity": {
      "Type": "string",
      "Description": "The city of the service appointment location.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentState": {
      "Type": "string",
      "Description": "The state or region of the service appointment location.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentZipCode": {
      "Type": "string",
      "Description": "The postal or ZIP code of the service appointment location.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AppointmentNotes": {
      "Type": "string",
      "Description": "Operational notes technicians or schedulers need for this appointment.",
      "Required": false,
      "SubmittedIn": "JSON body"
    },
    "AllowSchedulingConflict": {
      "Type": "boolean",
      "Description": "Whether the caller intentionally permits this appointment to overlap an existing appointment. False keeps conflict protection enabled.",
      "Required": false,
      "SubmittedIn": "JSON body"
    }
  },
  "BusinessRules": [
    "Public fictional demo: no PersonKey, WorkmatePersonKey, SupervisorPersonKey, profile key, site login, or other identity credential is required. AIXEWorksKey only selects the permanent shared Bayline A/C Supply company; it is not an authentication credential.",
    "Except for connect and start, AIXEWorksKey is required. Records in the shared company persist and remain available to future visitors unless intentionally deleted through a documented record-level CRUD capability. Only public keys are returned; internal numeric identifiers are never part of the contract.",
    "End time defaults from the service duration. Customer billing address supplies omitted location fields. Conflicts are rejected unless AllowSchedulingConflict is true."
  ],
  "Errors": [
    {
      "SuccessCode": "VALIDATION_FAILED",
      "Meaning": "One or more required request values are missing or malformed.",
      "Recovery": "Use the field descriptions and constraints in this same live contract, correct the named fields, and retry the same capability.",
      "Recoverable": true
    },
    {
      "SuccessCode": "NOT_FOUND",
      "Meaning": "A submitted public key did not identify a record within this endpoint's declared scope.",
      "Recovery": "Re-check the selected key against a current list or creation response; do not treat this as a missing web route.",
      "Recoverable": true
    },
    {
      "SuccessCode": "BUSINESS_RULE_FAILED",
      "Meaning": "The request was understood but could not run because a declared business or state-transition rule was not satisfied.",
      "Recovery": "Explain the governing rule to the human and retry only after the required business condition or decision changes.",
      "Recoverable": true
    },
    {
      "SuccessCode": "FAILED",
      "Meaning": "The endpoint could not complete the operation for a non-business-rule execution failure.",
      "Recovery": "Read the returned message and error detail. Retry only when the response identifies a recoverable condition.",
      "Recoverable": false
    }
  ],
  "ActionResponse": {
    "RequiredResponseFields": [
      "SuccessCode"
    ],
    "SuccessCodes": [
      "SUCCESS"
    ],
    "FailureCodes": [
      "VALIDATION_FAILED",
      "NOT_FOUND",
      "BUSINESS_RULE_FAILED",
      "FAILED"
    ],
    "NonFinalCodes": [],
    "MissingOrEmptyResponse": "Treat as FAILED.",
    "Rule": "The endpoint response is authoritative. Only an exact SuccessCode value listed in SuccessCodes means the business action succeeded; HTTP status alone does not declare the AIXE outcome."
  }
}