{
  "openapi": "3.1.0",
  "info": {
    "title": "Overtime electrician discovery",
    "version": "1.0.0",
    "description": "Public opt-in electrician profiles and human-confirmed request links. No personal contact data. Availability is self-declared, wages need a job-specific agreement, and agents must never claim a reservation, booking or charge from an intent response. On-site selection still requires electrician agreement, identity/card checks and a confirmed \u00a310 fee or eligible agency subscription. Video-call payments remain separate and unchanged."
  },
  "servers": [
    {
      "url": "https://ovatime.lovable.app"
    }
  ],
  "paths": {
    "/api/public/agent/search": {
      "get": {
        "operationId": "searchElectricians",
        "summary": "Find public electrician profiles",
        "parameters": [
          {
            "name": "area",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "maxLength": 10,
              "description": "UK postcode or outward area; matches that outward area, not a proximity search."
            }
          },
          {
            "name": "trade",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "",
                "Domestic",
                "Commercial",
                "Industrial",
                "Testing & inspection",
                "First fix",
                "Second fix",
                "Lighting",
                "EV chargers",
                "Maintenance"
              ]
            }
          },
          {
            "name": "date",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "format": "date",
              "description": "On-site self-declared availability date."
            }
          },
          {
            "name": "kind",
            "in": "query",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "site",
                "video"
              ]
            }
          },
          {
            "name": "offset",
            "in": "query",
            "required": false,
            "schema": {
              "type": "integer",
              "minimum": 0,
              "maximum": 100000
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "electricians": {
                      "type": "array",
                      "items": {
                        "$ref": "#/components/schemas/Electrician"
                      }
                    },
                    "next_offset": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Follow this offset even when a filtered page is empty."
                    },
                    "checked_at": {
                      "type": "string",
                      "format": "date-time"
                    },
                    "availability_is_self_declared": {
                      "const": true
                    },
                    "bookings_require_confirmation": {
                      "const": true
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/agent/profile/{id}": {
      "get": {
        "operationId": "getElectricianProfile",
        "summary": "Read one public profile",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "schema": {
              "type": "string",
              "format": "uuid"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/Electrician"
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/public/agent/intent": {
      "post": {
        "operationId": "prepareElectricianRequestLink",
        "summary": "Return a human-confirmed request link, without creating a reservation",
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "electrician_id",
                  "kind"
                ],
                "properties": {
                  "electrician_id": {
                    "type": "string",
                    "format": "uuid"
                  },
                  "kind": {
                    "type": "string",
                    "enum": [
                      "site",
                      "video"
                    ]
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "const": "confirmation_required"
                    },
                    "request_url": {
                      "type": "string",
                      "format": "uri"
                    },
                    "electrician": {
                      "$ref": "#/components/schemas/Electrician"
                    },
                    "reserved": {
                      "const": false
                    },
                    "charged": {
                      "const": false
                    },
                    "sign_in_required": {
                      "const": true
                    },
                    "electrician_agreement_required": {
                      "const": true
                    },
                    "next_step": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "404": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "409": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "413": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          },
          "503": {
            "description": "Invalid input, unavailable profile or unavailable service",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "string"
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "Electrician": {
        "type": "object",
        "required": [
          "id",
          "display_name",
          "profile_url",
          "image_url",
          "availability",
          "verified_work",
          "on_site",
          "video",
          "request_links"
        ],
        "properties": {
          "id": {
            "type": "string",
            "format": "uuid"
          },
          "display_name": {
            "type": "string"
          },
          "area": {
            "type": "string",
            "description": "General UK outward postcode area, never a home postcode."
          },
          "biography": {
            "type": "string"
          },
          "specialties": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "image_url": {
            "type": [
              "string",
              "null"
            ],
            "format": "uri"
          },
          "profile_url": {
            "type": "string",
            "format": "uri"
          },
          "issuer_checked_card_types": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "verified_work": {
            "type": "object",
            "properties": {
              "completed_shifts": {
                "type": "integer"
              },
              "rating": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "rating_count": {
                "type": "integer"
              },
              "turn_up": {
                "type": [
                  "number",
                  "null"
                ]
              }
            }
          },
          "availability": {
            "type": "object",
            "description": "Self-declared availability. Not a guaranteed appointment.",
            "properties": {
              "declaration": {
                "type": [
                  "string",
                  "null"
                ]
              },
              "declared_at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "dates": {
                "type": "array",
                "items": {
                  "type": "string",
                  "format": "date"
                }
              },
              "label": {
                "type": "string"
              },
              "confirmation_required": {
                "const": true
              }
            }
          },
          "on_site": {
            "type": "object",
            "properties": {
              "minimum_day_rate_gbp": {
                "type": "number"
              },
              "quote_required": {
                "const": true
              },
              "platform_fee_gbp": {
                "const": 10
              },
              "electrician_commission_percent": {
                "const": 0
              }
            }
          },
          "video": {
            "type": "object",
            "description": "Video work is separate from on-site work and uses an hourly pro-rata fixed call fee.",
            "properties": {
              "online": {
                "type": "boolean"
              },
              "domestic": {
                "type": "boolean"
              },
              "commercial": {
                "type": "boolean"
              },
              "hourly_rate_gbp": {
                "type": "number"
              },
              "skills": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              },
              "rating": {
                "type": [
                  "number",
                  "null"
                ]
              },
              "rating_count": {
                "type": "integer"
              }
            }
          },
          "request_links": {
            "type": "object",
            "properties": {
              "on_site": {
                "type": "string",
                "format": "uri"
              },
              "video": {
                "type": "string",
                "format": "uri"
              }
            }
          }
        }
      }
    }
  }
}
