{
  "swagger": "2.0",
  "info": {
    "title": "DigiFlow API",
    "description": "Multi-tenant SaaS platform for field service work order management. Enables companies to create work orders, assign technicians, optimize routes, and provide real-time visibility to administrators, technicians, and clients.",
    "version": "1.0.0",
    "contact": {
      "name": "DigiFlow Support",
      "url": "https://digiflow.app/support",
      "email": "support@digiflow.app"
    },
    "license": {
      "name": "Proprietary"
    }
  },
  "tags": [
    {
      "name": "AssetService"
    },
    {
      "name": "AuthService"
    },
    {
      "name": "ClientService"
    },
    {
      "name": "CustomFieldService"
    },
    {
      "name": "DashboardService"
    },
    {
      "name": "DelayService"
    },
    {
      "name": "EvidenceService"
    },
    {
      "name": "NotificationService"
    },
    {
      "name": "RealtimeService"
    },
    {
      "name": "RouteService"
    },
    {
      "name": "TechnicianService"
    },
    {
      "name": "TenantService"
    },
    {
      "name": "UserService"
    },
    {
      "name": "WorkOrderSearchService"
    },
    {
      "name": "WorkOrderService"
    },
    {
      "name": "WorkOrderStateService"
    },
    {
      "name": "WorkOrderTypeService"
    }
  ],
  "consumes": [
    "application/json"
  ],
  "produces": [
    "application/json"
  ],
  "paths": {
    "/v1/assets": {
      "get": {
        "summary": "List assets with filters",
        "operationId": "AssetService_ListAssets",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.ListAssetsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "typeFilter",
            "description": "Filter by asset type",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      },
      "post": {
        "summary": "Create asset (admin only)",
        "operationId": "AssetService_CreateAsset",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.Asset"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.CreateAssetRequest"
            }
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/assets/search": {
      "get": {
        "summary": "Search assets by name or serial number",
        "operationId": "AssetService_SearchAssets",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.SearchAssetsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "query",
            "description": "Search in name, serial_number",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/assets/serial/{serialNumber}": {
      "get": {
        "summary": "Get asset by serial number",
        "operationId": "AssetService_GetAssetBySerialNumber",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.Asset"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "serialNumber",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/assets/{assetId}/work-orders": {
      "get": {
        "summary": "Get work order history for asset (OPS-07, D-11)",
        "operationId": "AssetService_GetAssetWorkOrderHistory",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.GetAssetWorkOrderHistoryResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "assetId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "cursor",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/assets/{id}": {
      "get": {
        "summary": "Get asset by ID",
        "operationId": "AssetService_GetAsset",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.Asset"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      },
      "delete": {
        "summary": "Deactivate asset (soft delete)",
        "operationId": "AssetService_DeactivateAsset",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.DeactivateAssetResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      },
      "patch": {
        "summary": "Update asset",
        "operationId": "AssetService_UpdateAsset",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.Asset"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.AssetService.UpdateAssetBody"
            }
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/auth/logout": {
      "post": {
        "summary": "Logout - revoke all user tokens",
        "operationId": "AuthService_Logout",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.LogoutResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.LogoutRequest"
            }
          }
        ],
        "tags": [
          "AuthService"
        ]
      }
    },
    "/v1/auth/me": {
      "get": {
        "summary": "Get current user info from token",
        "operationId": "AuthService_GetCurrentUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.GetCurrentUserResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "AuthService"
        ]
      }
    },
    "/v1/auth/refresh": {
      "post": {
        "summary": "Refresh token grant with rotation (D-05)",
        "operationId": "AuthService_RefreshToken",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.TokenResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.RefreshTokenRequest"
            }
          }
        ],
        "tags": [
          "AuthService"
        ]
      }
    },
    "/v1/auth/token": {
      "post": {
        "summary": "Password grant for first-party apps (D-03)",
        "operationId": "AuthService_PasswordGrant",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.TokenResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.auth.v1.PasswordGrantRequest"
            }
          }
        ],
        "tags": [
          "AuthService"
        ]
      }
    },
    "/v1/clients": {
      "get": {
        "summary": "List clients",
        "operationId": "ClientService_ListClients",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.ListClientsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "ClientService"
        ]
      },
      "post": {
        "summary": "Create client (admin only)",
        "operationId": "ClientService_CreateClient",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.Client"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.CreateClientRequest"
            }
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/clients/search": {
      "get": {
        "summary": "Search clients by name or email",
        "operationId": "ClientService_SearchClients",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.SearchClientsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "query",
            "description": "Search in name, email",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/clients/{clientId}/assets": {
      "get": {
        "summary": "List assets by client",
        "operationId": "AssetService_ListAssetsByClient",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.asset.v1.ListAssetsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "AssetService"
        ]
      }
    },
    "/v1/clients/{clientId}/link-user": {
      "post": {
        "summary": "Link client to user account for portal access (D-02)",
        "operationId": "ClientService_LinkClientToUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.Client"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.ClientService.LinkClientToUserBody"
            }
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/clients/{clientId}/work-orders": {
      "get": {
        "summary": "Get work order history for client (OPS-08, D-11, D-12)",
        "operationId": "ClientService_GetClientWorkOrderHistory",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.GetClientWorkOrderHistoryResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "clientId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "description": "D-12: pagination",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "cursor",
            "description": "Cursor-based pagination",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "monthsBack",
            "description": "D-12: Default 6-12 months",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/clients/{id}": {
      "get": {
        "summary": "Get client by ID",
        "operationId": "ClientService_GetClient",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.Client"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "ClientService"
        ]
      },
      "delete": {
        "summary": "Deactivate client (soft delete)",
        "operationId": "ClientService_DeactivateClient",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.DeactivateClientResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "ClientService"
        ]
      },
      "patch": {
        "summary": "Update client",
        "operationId": "ClientService_UpdateClient",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.Client"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.ClientService.UpdateClientBody"
            }
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/clients/{id}/stats": {
      "get": {
        "summary": "Get client statistics",
        "operationId": "ClientService_GetClientStats",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.client.v1.ClientStats"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "ClientService"
        ]
      }
    },
    "/v1/custom-fields/{id}": {
      "get": {
        "summary": "Get a field definition by ID",
        "operationId": "CustomFieldService_GetFieldDefinition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.FieldDefinition"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      },
      "delete": {
        "summary": "Deactivate a field definition (soft delete)",
        "operationId": "CustomFieldService_DeactivateFieldDefinition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.DeactivateFieldDefinitionResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      },
      "patch": {
        "summary": "Update a field definition",
        "operationId": "CustomFieldService_UpdateFieldDefinition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.FieldDefinition"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CustomFieldService.UpdateFieldDefinitionBody"
            }
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      }
    },
    "/v1/dashboard/activity": {
      "get": {
        "summary": "Get activity feed",
        "operationId": "DashboardService_GetActivityFeed",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.ActivityFeedResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/dashboard/completion-trend": {
      "get": {
        "summary": "Get completion trend data",
        "operationId": "DashboardService_GetCompletionTrend",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.CompletionTrendResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "days",
            "description": "Default 30",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/dashboard/delay-alerts": {
      "get": {
        "summary": "Get recent delay alerts",
        "operationId": "DashboardService_GetDelayAlerts",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.DelayAlertsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "limit",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/dashboard/map": {
      "get": {
        "summary": "Get work orders for map view",
        "operationId": "DashboardService_GetMapData",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.MapDataResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "date",
            "description": "Optional: filter by date, default today",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/dashboard/stats": {
      "get": {
        "summary": "Get overall dashboard statistics",
        "operationId": "DashboardService_GetDashboardStats",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.DashboardStats"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/dashboard/technician-performance": {
      "get": {
        "summary": "Get technician performance metrics",
        "operationId": "DashboardService_GetTechnicianPerformance",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.TechnicianPerformanceResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "DashboardService"
        ]
      }
    },
    "/v1/evidence": {
      "post": {
        "summary": "Upload evidence (photo, audio, or text) - server proxy (D-11)",
        "operationId": "EvidenceService_UploadEvidence",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.Evidence"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.UploadEvidenceRequest"
            }
          }
        ],
        "tags": [
          "EvidenceService"
        ]
      }
    },
    "/v1/evidence/{id}": {
      "get": {
        "summary": "Get evidence by ID with presigned URL for download (D-21)",
        "operationId": "EvidenceService_GetEvidence",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.Evidence"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "EvidenceService"
        ]
      },
      "delete": {
        "summary": "Delete evidence (admin/owner only)",
        "operationId": "EvidenceService_DeleteEvidence",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.DeleteEvidenceResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "EvidenceService"
        ]
      }
    },
    "/v1/notifications/devices": {
      "post": {
        "summary": "Register device token for push notifications (D-06)",
        "operationId": "NotificationService_RegisterDevice",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.DeviceToken"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.RegisterDeviceRequest"
            }
          }
        ],
        "tags": [
          "NotificationService"
        ]
      }
    },
    "/v1/notifications/devices/{tokenId}": {
      "delete": {
        "summary": "Unregister device token",
        "operationId": "NotificationService_UnregisterDevice",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.UnregisterDeviceResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "tokenId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "NotificationService"
        ]
      }
    },
    "/v1/notifications/history": {
      "get": {
        "summary": "List notification history for current user",
        "operationId": "NotificationService_ListNotificationHistory",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.ListNotificationHistoryResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "NotificationService"
        ]
      }
    },
    "/v1/notifications/preferences": {
      "get": {
        "summary": "Get notification preferences for current user (D-16)",
        "operationId": "NotificationService_GetPreferences",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.NotificationPreferences"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "NotificationService"
        ]
      },
      "put": {
        "summary": "Update notification preferences (D-16)",
        "operationId": "NotificationService_UpdatePreferences",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.NotificationPreferences"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.UpdatePreferencesRequest"
            }
          }
        ],
        "tags": [
          "NotificationService"
        ]
      }
    },
    "/v1/notifications/tenant-defaults": {
      "get": {
        "summary": "Get tenant default preferences (admin only)",
        "operationId": "NotificationService_GetTenantDefaults",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.NotificationPreferences"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "NotificationService"
        ]
      },
      "put": {
        "summary": "Update tenant default preferences (admin only)",
        "operationId": "NotificationService_UpdateTenantDefaults",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.NotificationPreferences"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.notification.v1.UpdateTenantDefaultsRequest"
            }
          }
        ],
        "tags": [
          "NotificationService"
        ]
      }
    },
    "/v1/operations/delays": {
      "get": {
        "summary": "Get list of delayed work orders",
        "operationId": "DelayService_ListDelayedWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.ListDelayedWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "DelayService"
        ]
      }
    },
    "/v1/operations/delays/check": {
      "post": {
        "summary": "Manually trigger delay check (admin only)",
        "operationId": "DelayService_CheckDelays",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.CheckDelaysResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "DelayService"
        ]
      }
    },
    "/v1/operations/delays/{workOrderId}": {
      "get": {
        "summary": "Get delay details for a work order",
        "operationId": "DelayService_GetDelayDetails",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.operations.v1.DelayDetails"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "DelayService"
        ]
      }
    },
    "/v1/realtime/online": {
      "get": {
        "summary": "Get currently online users for the tenant (admin only)",
        "operationId": "RealtimeService_GetOnlineUsers",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.realtime.v1.GetOnlineUsersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "RealtimeService"
        ]
      }
    },
    "/v1/routes/nearest-technicians": {
      "get": {
        "summary": "Get technicians sorted by distance to location (D-20)",
        "operationId": "RouteService_GetNearestTechnicians",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.GetNearestTechniciansResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "targetLocation.lat",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "targetLocation.lng",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "targetLocation.address",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "limit",
            "description": "Max technicians to return",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "availableOnly",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "RouteService"
        ]
      }
    },
    "/v1/routes/optimize": {
      "post": {
        "summary": "Optimize route for technician on a specific date (OPS-05, D-06)",
        "operationId": "RouteService_OptimizeRoute",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.OptimizeRouteResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.OptimizeRouteRequest"
            }
          }
        ],
        "tags": [
          "RouteService"
        ]
      }
    },
    "/v1/routes/travel-time": {
      "get": {
        "summary": "Get estimated travel time between two points",
        "operationId": "RouteService_GetTravelTime",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.GetTravelTimeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "origin.lat",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "origin.lng",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "origin.address",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "destination.lat",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "destination.lng",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "destination.address",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "RouteService"
        ]
      }
    },
    "/v1/routes/{technicianId}": {
      "get": {
        "summary": "Get saved custom route for a technician (frontend integration)",
        "operationId": "RouteService_GetSavedRoute",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.GetSavedRouteResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "technicianId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "date",
            "description": "YYYY-MM-DD format",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "RouteService"
        ]
      },
      "put": {
        "summary": "Save custom route order for a technician (frontend integration)",
        "operationId": "RouteService_SaveCustomRoute",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.SaveCustomRouteResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "technicianId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.route.v1.RouteService.SaveCustomRouteBody"
            }
          }
        ],
        "tags": [
          "RouteService"
        ]
      }
    },
    "/v1/technicians": {
      "get": {
        "summary": "List technicians with optional filters",
        "operationId": "TechnicianService_ListTechnicians",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.ListTechniciansResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "availableOnly",
            "in": "query",
            "required": false,
            "type": "boolean"
          },
          {
            "name": "skillFilter",
            "description": "Filter by skill tag",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      },
      "post": {
        "summary": "Create technician profile (admin only)",
        "operationId": "TechnicianService_CreateTechnicianProfile",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianProfile"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.CreateTechnicianProfileRequest"
            }
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/technicians/nearby": {
      "get": {
        "summary": "Get technicians sorted by distance to location (D-20)",
        "operationId": "TechnicianService_GetNearbyTechnicians",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.GetNearbyTechniciansResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "lat",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "lng",
            "in": "query",
            "required": false,
            "type": "number",
            "format": "double"
          },
          {
            "name": "limit",
            "description": "Max technicians to return",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "availableOnly",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/technicians/{id}": {
      "get": {
        "summary": "Get technician by ID",
        "operationId": "TechnicianService_GetTechnician",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianProfile"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      },
      "delete": {
        "summary": "Deactivate technician (soft delete)",
        "operationId": "TechnicianService_DeactivateTechnician",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.DeactivateTechnicianResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      },
      "patch": {
        "summary": "Update technician profile",
        "operationId": "TechnicianService_UpdateTechnician",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianProfile"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianService.UpdateTechnicianBody"
            }
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/technicians/{id}/availability": {
      "get": {
        "summary": "Get technician availability for a specific date (OPS-02)",
        "operationId": "TechnicianService_GetAvailability",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.GetAvailabilityResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "date",
            "description": "YYYY-MM-DD format",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/technicians/{id}/stats": {
      "get": {
        "summary": "Get technician's work order statistics",
        "operationId": "TechnicianService_GetTechnicianStats",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianStats"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/technicians/{technicianId}/check-conflicts": {
      "post": {
        "summary": "Check schedule conflicts when assigning (D-19)",
        "operationId": "TechnicianService_CheckScheduleConflicts",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.CheckScheduleConflictsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "technicianId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.technician.v1.TechnicianService.CheckScheduleConflictsBody"
            }
          }
        ],
        "tags": [
          "TechnicianService"
        ]
      }
    },
    "/v1/tenants": {
      "post": {
        "summary": "Self-service tenant registration (D-08)\nCreates tenant AND first admin user (D-09)",
        "operationId": "TenantService_CreateTenant",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.tenant.v1.CreateTenantResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.tenant.v1.CreateTenantRequest"
            }
          }
        ],
        "tags": [
          "TenantService"
        ]
      }
    },
    "/v1/tenants/{tenantId}": {
      "get": {
        "summary": "Get tenant by ID (requires auth)",
        "operationId": "TenantService_GetTenant",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.tenant.v1.Tenant"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "TenantService"
        ]
      },
      "put": {
        "summary": "Update tenant settings (admin only)",
        "operationId": "TenantService_UpdateTenant",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.tenant.v1.Tenant"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "tenantId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.tenant.v1.TenantService.UpdateTenantBody"
            }
          }
        ],
        "tags": [
          "TenantService"
        ]
      }
    },
    "/v1/users": {
      "get": {
        "summary": "List users in tenant (admin/manager)",
        "operationId": "UserService_ListUsers",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.ListUsersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "UserService"
        ]
      },
      "post": {
        "summary": "Create user (admin only) - AUTH-04",
        "operationId": "UserService_CreateUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.User"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.CreateUserRequest"
            }
          }
        ],
        "tags": [
          "UserService"
        ]
      }
    },
    "/v1/users/{userId}": {
      "get": {
        "summary": "Get user by ID",
        "operationId": "UserService_GetUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.User"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "UserService"
        ]
      },
      "delete": {
        "summary": "Deactivate user (admin only) - AUTH-04",
        "operationId": "UserService_DeactivateUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.DeactivateUserResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "UserService"
        ]
      },
      "put": {
        "summary": "Update user (admin only for role changes)",
        "operationId": "UserService_UpdateUser",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.User"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "userId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.user.v1.UserService.UpdateUserBody"
            }
          }
        ],
        "tags": [
          "UserService"
        ]
      }
    },
    "/v1/work-order-states": {
      "get": {
        "summary": "List all states for tenant",
        "operationId": "WorkOrderStateService_ListStates",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListStatesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderStateService"
        ]
      },
      "post": {
        "summary": "Create a new state",
        "operationId": "WorkOrderStateService_CreateState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderState"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CreateStateRequest"
            }
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      }
    },
    "/v1/work-order-states/transitions": {
      "get": {
        "summary": "List all transitions for tenant",
        "operationId": "WorkOrderStateService_ListTransitions",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListTransitionsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderStateService"
        ]
      },
      "post": {
        "summary": "Create a transition between states",
        "operationId": "WorkOrderStateService_CreateTransition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.StateTransition"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CreateTransitionRequest"
            }
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      }
    },
    "/v1/work-order-states/transitions/{fromStateId}/{toStateId}": {
      "delete": {
        "summary": "Delete a transition",
        "operationId": "WorkOrderStateService_DeleteTransition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.DeleteTransitionResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "fromStateId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "toStateId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      }
    },
    "/v1/work-order-states/{fromStateId}/transitions": {
      "get": {
        "summary": "Get allowed transitions from a specific state",
        "operationId": "WorkOrderStateService_GetAllowedTransitions",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetAllowedTransitionsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "fromStateId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      }
    },
    "/v1/work-order-states/{id}": {
      "get": {
        "summary": "Get a state by ID",
        "operationId": "WorkOrderStateService_GetState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderState"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      },
      "delete": {
        "summary": "Delete a state (only if no work orders use it)",
        "operationId": "WorkOrderStateService_DeleteState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.DeleteStateResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      },
      "patch": {
        "summary": "Update a state",
        "operationId": "WorkOrderStateService_UpdateState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderState"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderStateService.UpdateStateBody"
            }
          }
        ],
        "tags": [
          "WorkOrderStateService"
        ]
      }
    },
    "/v1/work-order-types": {
      "get": {
        "summary": "List work order types for tenant",
        "operationId": "WorkOrderTypeService_ListWorkOrderTypes",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListWorkOrderTypesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "WorkOrderTypeService"
        ]
      },
      "post": {
        "summary": "Create a new work order type (admin only)",
        "operationId": "WorkOrderTypeService_CreateWorkOrderType",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderType"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CreateWorkOrderTypeRequest"
            }
          }
        ],
        "tags": [
          "WorkOrderTypeService"
        ]
      }
    },
    "/v1/work-order-types/{id}": {
      "get": {
        "summary": "Get a work order type by ID",
        "operationId": "WorkOrderTypeService_GetWorkOrderType",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderType"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderTypeService"
        ]
      },
      "delete": {
        "summary": "Deactivate a work order type (soft delete)",
        "operationId": "WorkOrderTypeService_DeactivateWorkOrderType",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.DeactivateWorkOrderTypeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderTypeService"
        ]
      },
      "patch": {
        "summary": "Update a work order type",
        "operationId": "WorkOrderTypeService_UpdateWorkOrderType",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderType"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderTypeService.UpdateWorkOrderTypeBody"
            }
          }
        ],
        "tags": [
          "WorkOrderTypeService"
        ]
      }
    },
    "/v1/work-order-types/{workOrderTypeId}/fields": {
      "get": {
        "summary": "List field definitions for a work order type",
        "operationId": "CustomFieldService_ListFieldDefinitions",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListFieldDefinitionsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderTypeId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      },
      "post": {
        "summary": "Create a field definition for a work order type",
        "operationId": "CustomFieldService_CreateFieldDefinition",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.FieldDefinition"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderTypeId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CustomFieldService.CreateFieldDefinitionBody"
            }
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      }
    },
    "/v1/work-orders": {
      "get": {
        "summary": "List work orders with filtering (basic - WO-07 search is in Plan 04)",
        "operationId": "WorkOrderService_ListWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "stateId",
            "description": "Basic filters - advanced search in Plan 04",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "typeId",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "priority",
            "in": "query",
            "required": false,
            "type": "string",
            "enum": [
              "PRIORITY_UNSPECIFIED",
              "PRIORITY_LOW",
              "PRIORITY_MEDIUM",
              "PRIORITY_HIGH",
              "PRIORITY_URGENT"
            ],
            "default": "PRIORITY_UNSPECIFIED"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      },
      "post": {
        "summary": "Create a new work order (WO-01)",
        "operationId": "WorkOrderService_CreateWorkOrder",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CreateWorkOrderRequest"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/client": {
      "get": {
        "summary": "Get work orders for current client (CLI-01, D-17)",
        "operationId": "WorkOrderService_GetClientWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetClientWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "cursor",
            "description": "For pagination",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "activeOnly",
            "in": "query",
            "required": false,
            "type": "boolean"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/client/statistics": {
      "get": {
        "summary": "Get client statistics (CLI-04)",
        "operationId": "WorkOrderService_GetClientStatistics",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ClientStatistics"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/filter": {
      "post": {
        "summary": "Filter work orders by multiple criteria (WO-07)",
        "operationId": "WorkOrderSearchService_FilterWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.FilterWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.FilterWorkOrdersRequest"
            }
          }
        ],
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/my": {
      "get": {
        "summary": "Get work orders for current technician, grouped by date (TECH-01, D-13)",
        "operationId": "WorkOrderService_GetMyWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetMyWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "dateFilter",
            "description": "Optional: \"today\", \"tomorrow\", \"this_week\", or YYYY-MM-DD",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/overdue": {
      "get": {
        "summary": "List overdue work orders (frontend integration)",
        "operationId": "WorkOrderSearchService_ListOverdueWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListOverdueWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "pageSize",
            "description": "Max 100, default 20",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "description": "1-indexed page number",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/problems/{problemId}/acknowledge": {
      "post": {
        "summary": "Acknowledge a problem (admin only)",
        "operationId": "WorkOrderService_AcknowledgeProblem",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderProblem"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "problemId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/problems/{problemId}/resolve": {
      "post": {
        "summary": "Resolve a problem (admin only)",
        "operationId": "WorkOrderService_ResolveProblem",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderProblem"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "problemId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.ResolveProblemBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/search": {
      "get": {
        "summary": "Full text search on work orders (WO-07)",
        "operationId": "WorkOrderSearchService_SearchWorkOrders",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.SearchWorkOrdersResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "query",
            "description": "Search text (will be converted to tsquery)",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "pageSize",
            "description": "Max 100, default 20",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "description": "1-indexed page number",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/stats": {
      "get": {
        "summary": "Get work order statistics overview (WO-11)",
        "operationId": "WorkOrderSearchService_GetStatisticsOverview",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStatisticsOverviewResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/stats/by-date": {
      "get": {
        "summary": "Get daily statistics for date range (WO-11)",
        "operationId": "WorkOrderSearchService_GetStatsByDateRange",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStatsByDateRangeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "dateFrom",
            "description": "YYYY-MM-DD",
            "in": "query",
            "required": false,
            "type": "string"
          },
          {
            "name": "dateTo",
            "description": "YYYY-MM-DD",
            "in": "query",
            "required": false,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/stats/by-priority": {
      "get": {
        "summary": "Get work order counts by priority (WO-11)",
        "operationId": "WorkOrderSearchService_GetStatsByPriority",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStatsByPriorityResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/stats/by-state": {
      "get": {
        "summary": "Get work order counts by state (WO-11)",
        "operationId": "WorkOrderSearchService_GetStatsByState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStatsByStateResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/stats/by-type": {
      "get": {
        "summary": "Get work order counts by type (WO-11)",
        "operationId": "WorkOrderSearchService_GetStatsByType",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStatsByTypeResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "tags": [
          "WorkOrderSearchService"
        ]
      }
    },
    "/v1/work-orders/{id}": {
      "get": {
        "summary": "Get a work order by ID with full details (WO-02)",
        "operationId": "WorkOrderService_GetWorkOrder",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      },
      "patch": {
        "summary": "Update a work order (WO-03)",
        "operationId": "WorkOrderService_UpdateWorkOrder",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.UpdateWorkOrderBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{id}/archive": {
      "post": {
        "summary": "Archive/cancel a work order (WO-04)",
        "operationId": "WorkOrderService_ArchiveWorkOrder",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ArchiveWorkOrderResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.ArchiveWorkOrderBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{id}/audit": {
      "get": {
        "summary": "Get audit log for a work order (WO-08)",
        "operationId": "WorkOrderService_GetAuditLog",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetAuditLogResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "pageSize",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          },
          {
            "name": "page",
            "in": "query",
            "required": false,
            "type": "integer",
            "format": "int32"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{id}/close": {
      "post": {
        "summary": "Close work order with notes (TECH-04, D-16)",
        "operationId": "WorkOrderService_CloseWorkOrder",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.CloseWorkOrderBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{id}/history": {
      "get": {
        "summary": "Get state history for a work order (WO-05)",
        "operationId": "WorkOrderService_GetStateHistory",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetStateHistoryResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{id}/transition": {
      "post": {
        "summary": "Transition work order state (WO-05, WO-10)",
        "operationId": "WorkOrderService_TransitionState",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.TransitionStateBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/assignments": {
      "get": {
        "summary": "Get assignments for a work order",
        "operationId": "WorkOrderService_GetAssignments",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetAssignmentsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      },
      "post": {
        "summary": "Assign a technician to a work order (WO-06)",
        "operationId": "WorkOrderService_AssignTechnician",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.Assignment"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.AssignTechnicianBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/assignments/{technicianId}": {
      "delete": {
        "summary": "Remove technician assignment",
        "operationId": "WorkOrderService_RemoveAssignment",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.RemoveAssignmentResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "technicianId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/comments": {
      "post": {
        "summary": "Add text comment (EVI-06)",
        "operationId": "EvidenceService_AddComment",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.Evidence"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.EvidenceService.AddCommentBody"
            }
          }
        ],
        "tags": [
          "EvidenceService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/custom-fields": {
      "get": {
        "summary": "Get all field values for a work order",
        "operationId": "CustomFieldService_GetFieldValues",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.GetFieldValuesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      },
      "put": {
        "summary": "Set field values for a work order (bulk upsert)",
        "operationId": "CustomFieldService_SetFieldValues",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.SetFieldValuesResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.CustomFieldService.SetFieldValuesBody"
            }
          }
        ],
        "tags": [
          "CustomFieldService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/evidence": {
      "get": {
        "summary": "List all evidence for a work order",
        "operationId": "EvidenceService_ListEvidence",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.evidence.v1.ListEvidenceResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "typeFilter",
            "description": "Optional: filter by type",
            "in": "query",
            "required": false,
            "type": "string",
            "enum": [
              "EVIDENCE_TYPE_UNSPECIFIED",
              "EVIDENCE_TYPE_PHOTO",
              "EVIDENCE_TYPE_AUDIO",
              "EVIDENCE_TYPE_TEXT"
            ],
            "default": "EVIDENCE_TYPE_UNSPECIFIED"
          }
        ],
        "tags": [
          "EvidenceService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/problems": {
      "get": {
        "summary": "List problems for a work order",
        "operationId": "WorkOrderService_ListProblems",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.ListProblemsResponse"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      },
      "post": {
        "summary": "Report a problem on a work order (TECH-03, D-15)",
        "operationId": "WorkOrderService_ReportProblem",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderProblem"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.ReportProblemBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    },
    "/v1/work-orders/{workOrderId}/satisfaction": {
      "post": {
        "summary": "Submit satisfaction rating (CLI-03, D-18)",
        "operationId": "WorkOrderService_SubmitSatisfaction",
        "responses": {
          "200": {
            "description": "A successful response.",
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.SatisfactionRating"
            }
          },
          "default": {
            "description": "An unexpected error response.",
            "schema": {
              "$ref": "#/definitions/google.rpc.Status"
            }
          }
        },
        "parameters": [
          {
            "name": "workOrderId",
            "in": "path",
            "required": true,
            "type": "string"
          },
          {
            "name": "body",
            "in": "body",
            "required": true,
            "schema": {
              "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderService.SubmitSatisfactionBody"
            }
          }
        ],
        "tags": [
          "WorkOrderService"
        ]
      }
    }
  },
  "definitions": {
    "digiflow.asset.v1.Asset": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "clientId": {
          "type": "string"
        },
        "clientName": {
          "type": "string",
          "title": "Denormalized"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "serialNumber": {
          "type": "string"
        },
        "locationAddress": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.asset.v1.Location"
        },
        "notes": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean"
        },
        "workOrderCount": {
          "type": "integer",
          "format": "int32",
          "title": "Total work orders for this asset"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Core messages"
    },
    "digiflow.asset.v1.AssetService.UpdateAssetBody": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "serialNumber": {
          "type": "string"
        },
        "locationAddress": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.asset.v1.Location"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "digiflow.asset.v1.AssetWorkOrderSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "priority": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.asset.v1.CreateAssetRequest": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "type": {
          "type": "string"
        },
        "serialNumber": {
          "type": "string"
        },
        "locationAddress": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.asset.v1.Location"
        },
        "notes": {
          "type": "string"
        }
      },
      "title": "Request/Response messages"
    },
    "digiflow.asset.v1.DeactivateAssetResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.asset.v1.GetAssetWorkOrderHistoryResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.asset.v1.AssetWorkOrderSummary"
          }
        },
        "nextCursor": {
          "type": "string"
        },
        "hasMore": {
          "type": "boolean"
        }
      }
    },
    "digiflow.asset.v1.ListAssetsResponse": {
      "type": "object",
      "properties": {
        "assets": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.asset.v1.Asset"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.asset.v1.Location": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "format": "double"
        },
        "lng": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.asset.v1.SearchAssetsResponse": {
      "type": "object",
      "properties": {
        "assets": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.asset.v1.Asset"
          }
        }
      }
    },
    "digiflow.auth.v1.GetCurrentUserResponse": {
      "type": "object",
      "properties": {
        "userId": {
          "type": "string"
        },
        "tenantId": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "digiflow.auth.v1.LogoutRequest": {
      "type": "object"
    },
    "digiflow.auth.v1.LogoutResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.auth.v1.PasswordGrantRequest": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "password": {
          "type": "string"
        }
      }
    },
    "digiflow.auth.v1.RefreshTokenRequest": {
      "type": "object",
      "properties": {
        "refreshToken": {
          "type": "string"
        }
      }
    },
    "digiflow.auth.v1.TokenResponse": {
      "type": "object",
      "properties": {
        "accessToken": {
          "type": "string"
        },
        "tokenType": {
          "type": "string"
        },
        "expiresIn": {
          "type": "integer",
          "format": "int32"
        },
        "refreshToken": {
          "type": "string"
        }
      }
    },
    "digiflow.client.v1.Client": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "userId": {
          "type": "string",
          "title": "D-02: nullable, for portal access"
        },
        "userEmail": {
          "type": "string",
          "title": "Denormalized if user linked"
        },
        "name": {
          "type": "string"
        },
        "contactEmail": {
          "type": "string"
        },
        "contactPhone": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.client.v1.Location"
        },
        "notes": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean"
        },
        "assetCount": {
          "type": "integer",
          "format": "int32",
          "title": "Denormalized count"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Core messages"
    },
    "digiflow.client.v1.ClientService.LinkClientToUserBody": {
      "type": "object",
      "properties": {
        "userId": {
          "type": "string"
        }
      }
    },
    "digiflow.client.v1.ClientService.UpdateClientBody": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "contactEmail": {
          "type": "string"
        },
        "contactPhone": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.client.v1.Location"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "digiflow.client.v1.ClientStats": {
      "type": "object",
      "properties": {
        "clientId": {
          "type": "string"
        },
        "totalWorkOrders": {
          "type": "integer",
          "format": "int32"
        },
        "completed": {
          "type": "integer",
          "format": "int32"
        },
        "pending": {
          "type": "integer",
          "format": "int32"
        },
        "inProgress": {
          "type": "integer",
          "format": "int32"
        },
        "avgSatisfactionRating": {
          "type": "number",
          "format": "double"
        },
        "totalAssets": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.client.v1.CreateClientRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "contactEmail": {
          "type": "string"
        },
        "contactPhone": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.client.v1.Location"
        },
        "notes": {
          "type": "string"
        },
        "userId": {
          "type": "string",
          "title": "Optional: link to existing user"
        }
      },
      "title": "Request/Response messages"
    },
    "digiflow.client.v1.DeactivateClientResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.client.v1.GetClientWorkOrderHistoryResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.client.v1.WorkOrderSummary"
          }
        },
        "nextCursor": {
          "type": "string"
        },
        "hasMore": {
          "type": "boolean"
        }
      }
    },
    "digiflow.client.v1.ListClientsResponse": {
      "type": "object",
      "properties": {
        "clients": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.client.v1.Client"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.client.v1.Location": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "format": "double"
        },
        "lng": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.client.v1.SearchClientsResponse": {
      "type": "object",
      "properties": {
        "clients": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.client.v1.Client"
          }
        }
      }
    },
    "digiflow.client.v1.WorkOrderSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "priority": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.evidence.v1.DeleteEvidenceResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.evidence.v1.Evidence": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workOrderId": {
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/digiflow.evidence.v1.EvidenceType"
        },
        "originalFilename": {
          "type": "string"
        },
        "fileSize": {
          "type": "string",
          "format": "int64"
        },
        "mimeType": {
          "type": "string"
        },
        "content": {
          "type": "string",
          "title": "For text comments (EVI-06)"
        },
        "downloadUrl": {
          "type": "string",
          "title": "URLs (presigned, D-21)"
        },
        "thumbnailUrl": {
          "type": "string",
          "title": "For photos (D-18)"
        },
        "metadata": {
          "$ref": "#/definitions/digiflow.evidence.v1.EvidenceMetadata",
          "title": "Metadata (EVI-04, EVI-07)"
        },
        "uploadedById": {
          "type": "string",
          "title": "Who/when"
        },
        "uploadedByName": {
          "type": "string"
        },
        "uploadedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.evidence.v1.EvidenceMetadata": {
      "type": "object",
      "properties": {
        "latitude": {
          "type": "number",
          "format": "double",
          "title": "EVI-07"
        },
        "longitude": {
          "type": "number",
          "format": "double",
          "title": "EVI-07"
        },
        "capturedAt": {
          "type": "string",
          "format": "date-time",
          "title": "EVI-04 client-side timestamp"
        },
        "deviceInfo": {
          "type": "string",
          "title": "Optional: device model, OS version"
        }
      }
    },
    "digiflow.evidence.v1.EvidenceService.AddCommentBody": {
      "type": "object",
      "properties": {
        "content": {
          "type": "string"
        },
        "metadata": {
          "$ref": "#/definitions/digiflow.evidence.v1.EvidenceMetadata"
        }
      }
    },
    "digiflow.evidence.v1.EvidenceType": {
      "type": "string",
      "enum": [
        "EVIDENCE_TYPE_UNSPECIFIED",
        "EVIDENCE_TYPE_PHOTO",
        "EVIDENCE_TYPE_AUDIO",
        "EVIDENCE_TYPE_TEXT"
      ],
      "default": "EVIDENCE_TYPE_UNSPECIFIED",
      "title": "Evidence types per D-20"
    },
    "digiflow.evidence.v1.ListEvidenceResponse": {
      "type": "object",
      "properties": {
        "evidence": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.evidence.v1.Evidence"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.evidence.v1.UploadEvidenceRequest": {
      "type": "object",
      "properties": {
        "workOrderId": {
          "type": "string"
        },
        "type": {
          "$ref": "#/definitions/digiflow.evidence.v1.EvidenceType"
        },
        "filename": {
          "type": "string"
        },
        "content": {
          "type": "string",
          "format": "byte",
          "title": "File bytes (for server proxy D-11)"
        },
        "metadata": {
          "$ref": "#/definitions/digiflow.evidence.v1.EvidenceMetadata"
        }
      }
    },
    "digiflow.notification.v1.DeviceToken": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "platform": {
          "$ref": "#/definitions/digiflow.notification.v1.Platform"
        },
        "token": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean"
        },
        "lastUsedAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.notification.v1.EventPreference": {
      "type": "object",
      "properties": {
        "eventType": {
          "$ref": "#/definitions/digiflow.notification.v1.EventType"
        },
        "emailEnabled": {
          "type": "boolean"
        },
        "pushEnabled": {
          "type": "boolean"
        },
        "inAppEnabled": {
          "type": "boolean"
        }
      }
    },
    "digiflow.notification.v1.EventType": {
      "type": "string",
      "enum": [
        "EVENT_TYPE_UNSPECIFIED",
        "EVENT_TYPE_ASSIGNMENT",
        "EVENT_TYPE_STATE_CHANGE",
        "EVENT_TYPE_DELAY",
        "EVENT_TYPE_FEEDBACK",
        "EVENT_TYPE_REMINDER"
      ],
      "default": "EVENT_TYPE_UNSPECIFIED",
      "title": "Event types for notification preferences"
    },
    "digiflow.notification.v1.ListNotificationHistoryResponse": {
      "type": "object",
      "properties": {
        "notifications": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.notification.v1.NotificationHistoryItem"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.notification.v1.NotificationChannel": {
      "type": "string",
      "enum": [
        "NOTIFICATION_CHANNEL_UNSPECIFIED",
        "NOTIFICATION_CHANNEL_EMAIL",
        "NOTIFICATION_CHANNEL_PUSH",
        "NOTIFICATION_CHANNEL_IN_APP"
      ],
      "default": "NOTIFICATION_CHANNEL_UNSPECIFIED",
      "title": "Notification channels"
    },
    "digiflow.notification.v1.NotificationHistoryItem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "eventType": {
          "$ref": "#/definitions/digiflow.notification.v1.EventType"
        },
        "channel": {
          "$ref": "#/definitions/digiflow.notification.v1.NotificationChannel"
        },
        "title": {
          "type": "string"
        },
        "body": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "title": "sent, failed"
        },
        "sentAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.notification.v1.NotificationPreferences": {
      "type": "object",
      "properties": {
        "preferences": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.notification.v1.EventPreference"
          }
        },
        "language": {
          "type": "string",
          "title": "D-23: es, en"
        }
      }
    },
    "digiflow.notification.v1.Platform": {
      "type": "string",
      "enum": [
        "PLATFORM_UNSPECIFIED",
        "PLATFORM_IOS",
        "PLATFORM_ANDROID",
        "PLATFORM_WEB"
      ],
      "default": "PLATFORM_UNSPECIFIED",
      "title": "Platform types for device tokens"
    },
    "digiflow.notification.v1.RegisterDeviceRequest": {
      "type": "object",
      "properties": {
        "platform": {
          "$ref": "#/definitions/digiflow.notification.v1.Platform"
        },
        "token": {
          "type": "string"
        }
      }
    },
    "digiflow.notification.v1.UnregisterDeviceResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.notification.v1.UpdatePreferencesRequest": {
      "type": "object",
      "properties": {
        "preferences": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.notification.v1.EventPreference"
          }
        },
        "language": {
          "type": "string"
        }
      }
    },
    "digiflow.notification.v1.UpdateTenantDefaultsRequest": {
      "type": "object",
      "properties": {
        "preferences": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.notification.v1.EventPreference"
          }
        }
      }
    },
    "digiflow.operations.v1.ActivityFeedResponse": {
      "type": "object",
      "properties": {
        "items": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.ActivityItem"
          }
        }
      }
    },
    "digiflow.operations.v1.ActivityItem": {
      "type": "object",
      "properties": {
        "activityType": {
          "type": "string",
          "description": "\"state_change\", \"assignment\", \"problem\", etc."
        },
        "timestamp": {
          "type": "string",
          "format": "date-time"
        },
        "workOrderId": {
          "type": "string"
        },
        "workOrderTitle": {
          "type": "string"
        },
        "description": {
          "type": "string",
          "title": "e.g., \"Changed to In Progress\""
        },
        "actorName": {
          "type": "string"
        }
      }
    },
    "digiflow.operations.v1.CheckDelaysResponse": {
      "type": "object",
      "properties": {
        "newDelaysDetected": {
          "type": "integer",
          "format": "int32"
        },
        "workOrderIds": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "digiflow.operations.v1.CompletionTrendResponse": {
      "type": "object",
      "properties": {
        "data": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.DailyCompletion"
          }
        }
      }
    },
    "digiflow.operations.v1.DailyCompletion": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "title": "YYYY-MM-DD"
        },
        "completedCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.operations.v1.DashboardStats": {
      "type": "object",
      "properties": {
        "totalWorkOrders": {
          "type": "integer",
          "format": "int32"
        },
        "activeCount": {
          "type": "integer",
          "format": "int32"
        },
        "completedCount": {
          "type": "integer",
          "format": "int32"
        },
        "todayCount": {
          "type": "integer",
          "format": "int32"
        },
        "problemCount": {
          "type": "integer",
          "format": "int32"
        },
        "delayedCount": {
          "type": "integer",
          "format": "int32"
        },
        "byState": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.StateCount"
          }
        },
        "byPriority": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.PriorityCount"
          }
        }
      }
    },
    "digiflow.operations.v1.DelayAlert": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workOrderId": {
          "type": "string"
        },
        "workOrderTitle": {
          "type": "string"
        },
        "clientName": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "detectedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.operations.v1.DelayAlertsResponse": {
      "type": "object",
      "properties": {
        "alerts": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.DelayAlert"
          }
        }
      }
    },
    "digiflow.operations.v1.DelayDetails": {
      "type": "object",
      "properties": {
        "workOrderId": {
          "type": "string"
        },
        "workOrderTitle": {
          "type": "string"
        },
        "scheduledEnd": {
          "type": "string",
          "format": "date-time"
        },
        "delayDetectedAt": {
          "type": "string",
          "format": "date-time"
        },
        "technicianEmail": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "clientName": {
          "type": "string"
        },
        "notificationSent": {
          "type": "boolean"
        },
        "notificationSentAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.operations.v1.DelayedWorkOrder": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "scheduledTimeEnd": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "clientName": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "detectedAt": {
          "type": "string",
          "format": "date-time"
        },
        "hoursOverdue": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.operations.v1.ListDelayedWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.DelayedWorkOrder"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.operations.v1.MapDataResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.MapWorkOrder"
          }
        }
      }
    },
    "digiflow.operations.v1.MapWorkOrder": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "lat": {
          "type": "number",
          "format": "double"
        },
        "lng": {
          "type": "number",
          "format": "double"
        },
        "address": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "priority": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        }
      }
    },
    "digiflow.operations.v1.PriorityCount": {
      "type": "object",
      "properties": {
        "priority": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.operations.v1.StateCount": {
      "type": "object",
      "properties": {
        "stateId": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.operations.v1.TechnicianMetrics": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "isAvailable": {
          "type": "boolean"
        },
        "activeWorkOrders": {
          "type": "integer",
          "format": "int32"
        },
        "completedLast30Days": {
          "type": "integer",
          "format": "int32"
        },
        "delaysLast30Days": {
          "type": "integer",
          "format": "int32"
        },
        "avgSatisfaction": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.operations.v1.TechnicianPerformanceResponse": {
      "type": "object",
      "properties": {
        "technicians": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.operations.v1.TechnicianMetrics"
          }
        }
      }
    },
    "digiflow.realtime.v1.GetOnlineUsersResponse": {
      "type": "object",
      "properties": {
        "users": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.realtime.v1.OnlineUser"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.realtime.v1.OnlineUser": {
      "type": "object",
      "properties": {
        "userId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "role": {
          "type": "string"
        },
        "connectedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.route.v1.CustomRouteStop": {
      "type": "object",
      "properties": {
        "workOrderId": {
          "type": "string"
        },
        "sequence": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.route.v1.GetNearestTechniciansResponse": {
      "type": "object",
      "properties": {
        "technicians": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.route.v1.TechnicianDistance"
          }
        }
      }
    },
    "digiflow.route.v1.GetSavedRouteResponse": {
      "type": "object",
      "properties": {
        "hasCustomRoute": {
          "type": "boolean"
        },
        "stops": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.route.v1.RouteStop"
          }
        },
        "savedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.route.v1.GetTravelTimeResponse": {
      "type": "object",
      "properties": {
        "durationMinutes": {
          "type": "integer",
          "format": "int32"
        },
        "distanceKm": {
          "type": "number",
          "format": "double"
        },
        "routeSummary": {
          "type": "string",
          "title": "e.g., \"via I-95 N\""
        }
      }
    },
    "digiflow.route.v1.Location": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "format": "double"
        },
        "lng": {
          "type": "number",
          "format": "double"
        },
        "address": {
          "type": "string"
        }
      },
      "title": "Core messages"
    },
    "digiflow.route.v1.OptimizeRouteRequest": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "date": {
          "type": "string",
          "title": "YYYY-MM-DD format"
        },
        "startLocation": {
          "$ref": "#/definitions/digiflow.route.v1.Location",
          "title": "Optional: override technician home location"
        },
        "returnToStart": {
          "type": "boolean",
          "title": "Whether to return to start location at end"
        }
      },
      "title": "Request/Response messages"
    },
    "digiflow.route.v1.OptimizeRouteResponse": {
      "type": "object",
      "properties": {
        "stops": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.route.v1.RouteStop"
          }
        },
        "totalTravelTimeMinutes": {
          "type": "integer",
          "format": "int32"
        },
        "totalDistanceKm": {
          "type": "number",
          "format": "double"
        },
        "estimatedStartTime": {
          "type": "string"
        },
        "estimatedEndTime": {
          "type": "string"
        },
        "fallbackUsed": {
          "type": "boolean",
          "title": "true if Google Maps API was unavailable (D-06)"
        },
        "optimizationStatus": {
          "type": "string",
          "title": "\"optimized\", \"fallback\", \"single_stop\""
        }
      }
    },
    "digiflow.route.v1.RouteService.SaveCustomRouteBody": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "title": "YYYY-MM-DD format"
        },
        "stops": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.route.v1.CustomRouteStop"
          },
          "title": "Ordered list of work order IDs"
        }
      }
    },
    "digiflow.route.v1.RouteStop": {
      "type": "object",
      "properties": {
        "workOrderId": {
          "type": "string"
        },
        "workOrderTitle": {
          "type": "string"
        },
        "sequence": {
          "type": "integer",
          "format": "int32"
        },
        "location": {
          "$ref": "#/definitions/digiflow.route.v1.Location"
        },
        "estimatedArrival": {
          "type": "string",
          "title": "HH:MM format"
        },
        "travelTimeMinutes": {
          "type": "integer",
          "format": "int32",
          "title": "from previous stop"
        },
        "distanceKm": {
          "type": "number",
          "format": "double",
          "title": "from previous stop"
        },
        "scheduledTimeStart": {
          "type": "string"
        },
        "scheduledTimeEnd": {
          "type": "string"
        }
      }
    },
    "digiflow.route.v1.SaveCustomRouteResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "digiflow.route.v1.TechnicianDistance": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "distanceKm": {
          "type": "number",
          "format": "double"
        },
        "estimatedTravelMinutes": {
          "type": "integer",
          "format": "int32"
        },
        "isAvailable": {
          "type": "boolean"
        },
        "activeWorkOrders": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.technician.v1.CheckScheduleConflictsResponse": {
      "type": "object",
      "properties": {
        "hasConflicts": {
          "type": "boolean"
        },
        "conflicts": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.ScheduleConflict"
          }
        }
      }
    },
    "digiflow.technician.v1.CreateTechnicianProfileRequest": {
      "type": "object",
      "properties": {
        "userId": {
          "type": "string"
        },
        "skills": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.technician.v1.WeeklySchedule"
        },
        "homeLocation": {
          "$ref": "#/definitions/digiflow.technician.v1.Location"
        }
      },
      "title": "Request/Response messages"
    },
    "digiflow.technician.v1.DaySchedule": {
      "type": "object",
      "properties": {
        "day": {
          "type": "integer",
          "format": "int32",
          "title": "0=Sunday, 1=Monday, ..., 6=Saturday"
        },
        "startTime": {
          "type": "string",
          "title": "\"09:00\" format"
        },
        "endTime": {
          "type": "string",
          "title": "\"18:00\" format"
        }
      }
    },
    "digiflow.technician.v1.DeactivateTechnicianResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.technician.v1.GetAvailabilityResponse": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "date": {
          "type": "string"
        },
        "isAvailable": {
          "type": "boolean"
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.technician.v1.DaySchedule"
        },
        "busySlots": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.TimeSlot"
          },
          "title": "Already assigned work orders"
        },
        "freeSlots": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.TimeSlot"
          },
          "title": "Available time slots"
        }
      }
    },
    "digiflow.technician.v1.GetNearbyTechniciansResponse": {
      "type": "object",
      "properties": {
        "technicians": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.TechnicianWithDistance"
          }
        }
      }
    },
    "digiflow.technician.v1.ListTechniciansResponse": {
      "type": "object",
      "properties": {
        "technicians": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.TechnicianProfile"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.technician.v1.Location": {
      "type": "object",
      "properties": {
        "lat": {
          "type": "number",
          "format": "double"
        },
        "lng": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.technician.v1.ScheduleConflict": {
      "type": "object",
      "properties": {
        "workOrderId": {
          "type": "string"
        },
        "workOrderTitle": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "scheduledTimeStart": {
          "type": "string"
        },
        "scheduledTimeEnd": {
          "type": "string"
        }
      }
    },
    "digiflow.technician.v1.TechnicianProfile": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "userId": {
          "type": "string"
        },
        "userEmail": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "skills": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "title": "D-04: Skills as tags"
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.technician.v1.WeeklySchedule",
          "title": "D-05: Weekly schedule"
        },
        "homeLocation": {
          "$ref": "#/definitions/digiflow.technician.v1.Location"
        },
        "isAvailable": {
          "type": "boolean"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Core messages"
    },
    "digiflow.technician.v1.TechnicianService.CheckScheduleConflictsBody": {
      "type": "object",
      "properties": {
        "scheduledDate": {
          "type": "string"
        },
        "scheduledTimeStart": {
          "type": "string"
        },
        "scheduledTimeEnd": {
          "type": "string"
        },
        "excludeWorkOrderId": {
          "type": "string",
          "title": "Exclude current WO when updating"
        }
      }
    },
    "digiflow.technician.v1.TechnicianService.UpdateTechnicianBody": {
      "type": "object",
      "properties": {
        "skills": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.technician.v1.WeeklySchedule"
        },
        "homeLocation": {
          "$ref": "#/definitions/digiflow.technician.v1.Location"
        },
        "isAvailable": {
          "type": "boolean"
        }
      }
    },
    "digiflow.technician.v1.TechnicianStats": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "totalAssigned": {
          "type": "integer",
          "format": "int32"
        },
        "completedThisMonth": {
          "type": "integer",
          "format": "int32"
        },
        "pending": {
          "type": "integer",
          "format": "int32"
        },
        "inProgress": {
          "type": "integer",
          "format": "int32"
        },
        "avgCompletionTimeHours": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.technician.v1.TechnicianWithDistance": {
      "type": "object",
      "properties": {
        "technician": {
          "$ref": "#/definitions/digiflow.technician.v1.TechnicianProfile"
        },
        "distanceKm": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.technician.v1.TimeSlot": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string"
        },
        "end": {
          "type": "string"
        },
        "workOrderId": {
          "type": "string",
          "title": "Empty for free slots"
        },
        "workOrderTitle": {
          "type": "string"
        }
      }
    },
    "digiflow.technician.v1.WeeklySchedule": {
      "type": "object",
      "properties": {
        "days": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.technician.v1.DaySchedule"
          }
        }
      }
    },
    "digiflow.tenant.v1.CreateTenantRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "adminEmail": {
          "type": "string",
          "title": "Admin user info (D-09)"
        },
        "adminPassword": {
          "type": "string"
        },
        "adminFirstName": {
          "type": "string"
        },
        "adminLastName": {
          "type": "string"
        }
      }
    },
    "digiflow.tenant.v1.CreateTenantResponse": {
      "type": "object",
      "properties": {
        "tenant": {
          "$ref": "#/definitions/digiflow.tenant.v1.Tenant"
        },
        "adminUserId": {
          "type": "string"
        },
        "accessToken": {
          "type": "string",
          "title": "Return tokens for immediate login"
        },
        "refreshToken": {
          "type": "string"
        }
      }
    },
    "digiflow.tenant.v1.Tenant": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "slug": {
          "type": "string"
        },
        "settings": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "isActive": {
          "type": "boolean"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.tenant.v1.TenantService.UpdateTenantBody": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "settings": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        }
      }
    },
    "digiflow.user.v1.CreateUserRequest": {
      "type": "object",
      "properties": {
        "email": {
          "type": "string"
        },
        "password": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "title": "D-07: multiple roles allowed"
        }
      }
    },
    "digiflow.user.v1.DeactivateUserResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.user.v1.ListUsersResponse": {
      "type": "object",
      "properties": {
        "users": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.user.v1.User"
          }
        },
        "total": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.user.v1.User": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "tenantId": {
          "type": "string"
        },
        "email": {
          "type": "string"
        },
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "isActive": {
          "type": "boolean"
        },
        "lastLoginAt": {
          "type": "string",
          "format": "date-time"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.user.v1.UserService.UpdateUserBody": {
      "type": "object",
      "properties": {
        "firstName": {
          "type": "string"
        },
        "lastName": {
          "type": "string"
        },
        "roles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "digiflow.workorder.v1.ArchiveWorkOrderResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.Assignment": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "technicianId": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "technicianEmail": {
          "type": "string"
        },
        "role": {
          "$ref": "#/definitions/digiflow.workorder.v1.AssignmentRole"
        },
        "assignedAt": {
          "type": "string",
          "format": "date-time"
        },
        "assignedBy": {
          "type": "string"
        }
      },
      "title": "Technician assignment"
    },
    "digiflow.workorder.v1.AssignmentRole": {
      "type": "string",
      "enum": [
        "ASSIGNMENT_ROLE_UNSPECIFIED",
        "ASSIGNMENT_ROLE_PRIMARY",
        "ASSIGNMENT_ROLE_SUPPORT"
      ],
      "default": "ASSIGNMENT_ROLE_UNSPECIFIED",
      "title": "Assignment role"
    },
    "digiflow.workorder.v1.AuditLogEntry": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "entityType": {
          "type": "string"
        },
        "entityId": {
          "type": "string"
        },
        "action": {
          "type": "string"
        },
        "actorId": {
          "type": "string"
        },
        "actorName": {
          "type": "string"
        },
        "changes": {
          "type": "string",
          "title": "JSON string of changes"
        },
        "metadata": {
          "type": "string",
          "title": "JSON string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Audit log entry"
    },
    "digiflow.workorder.v1.ClientStatistics": {
      "type": "object",
      "properties": {
        "totalWorkOrders": {
          "type": "integer",
          "format": "int32"
        },
        "activeCount": {
          "type": "integer",
          "format": "int32"
        },
        "completedCount": {
          "type": "integer",
          "format": "int32"
        },
        "avgSatisfaction": {
          "type": "number",
          "format": "double"
        }
      }
    },
    "digiflow.workorder.v1.ClientWorkOrderSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "technicianName": {
          "type": "string"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "completedAt": {
          "type": "string",
          "format": "date-time"
        },
        "satisfaction": {
          "$ref": "#/definitions/digiflow.workorder.v1.SatisfactionRating",
          "title": "null if not yet rated"
        }
      }
    },
    "digiflow.workorder.v1.CreateStateRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "isInitial": {
          "type": "boolean"
        },
        "isTerminal": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.CreateTransitionRequest": {
      "type": "object",
      "properties": {
        "fromStateId": {
          "type": "string"
        },
        "toStateId": {
          "type": "string"
        },
        "requiredRoles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "digiflow.workorder.v1.CreateWorkOrderRequest": {
      "type": "object",
      "properties": {
        "typeId": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "priority": {
          "$ref": "#/definitions/digiflow.workorder.v1.Priority"
        },
        "clientId": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.workorder.v1.Location"
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.workorder.v1.Schedule"
        },
        "customFields": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldValue"
          }
        }
      }
    },
    "digiflow.workorder.v1.CreateWorkOrderTypeRequest": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.CustomFieldService.CreateFieldDefinitionBody": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "label": {
          "type": "string"
        },
        "fieldType": {
          "$ref": "#/definitions/digiflow.workorder.v1.FieldType"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.SelectOption"
          }
        },
        "isRequired": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.CustomFieldService.SetFieldValuesBody": {
      "type": "object",
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldValue"
          }
        }
      }
    },
    "digiflow.workorder.v1.CustomFieldService.UpdateFieldDefinitionBody": {
      "type": "object",
      "properties": {
        "label": {
          "type": "string"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.SelectOption"
          }
        },
        "isRequired": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.DailyStat": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "title": "YYYY-MM-DD"
        },
        "scheduled": {
          "type": "integer",
          "format": "int32",
          "title": "Work orders scheduled for this date"
        },
        "completed": {
          "type": "integer",
          "format": "int32",
          "title": "Work orders completed"
        }
      }
    },
    "digiflow.workorder.v1.DeactivateFieldDefinitionResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.DeactivateWorkOrderTypeResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.DeleteStateResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.DeleteTransitionResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.FieldDefinition": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workOrderTypeId": {
          "type": "string"
        },
        "name": {
          "type": "string",
          "title": "internal name (snake_case)"
        },
        "label": {
          "type": "string",
          "title": "display label"
        },
        "fieldType": {
          "$ref": "#/definitions/digiflow.workorder.v1.FieldType"
        },
        "options": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.SelectOption"
          },
          "title": "only for FIELD_TYPE_SELECT"
        },
        "isRequired": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        },
        "isActive": {
          "type": "boolean"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Field definition - describes what a field is"
    },
    "digiflow.workorder.v1.FieldType": {
      "type": "string",
      "enum": [
        "FIELD_TYPE_UNSPECIFIED",
        "FIELD_TYPE_TEXT",
        "FIELD_TYPE_NUMBER",
        "FIELD_TYPE_DATE",
        "FIELD_TYPE_SELECT",
        "FIELD_TYPE_CHECKBOX"
      ],
      "default": "FIELD_TYPE_UNSPECIFIED",
      "title": "Field types supported (maps to custom_field_type enum)"
    },
    "digiflow.workorder.v1.FieldValue": {
      "type": "object",
      "properties": {
        "fieldDefinitionId": {
          "type": "string"
        },
        "fieldName": {
          "type": "string"
        },
        "fieldLabel": {
          "type": "string"
        },
        "fieldType": {
          "$ref": "#/definitions/digiflow.workorder.v1.FieldType"
        },
        "textValue": {
          "type": "string"
        },
        "numberValue": {
          "type": "number",
          "format": "double"
        },
        "dateValue": {
          "type": "string",
          "title": "ISO 8601 date string (YYYY-MM-DD)"
        },
        "boolValue": {
          "type": "boolean"
        }
      },
      "title": "Field value - the actual value stored"
    },
    "digiflow.workorder.v1.FilterWorkOrdersRequest": {
      "type": "object",
      "properties": {
        "stateId": {
          "type": "string",
          "title": "Optional filters - only non-empty values are applied"
        },
        "typeId": {
          "type": "string"
        },
        "priority": {
          "$ref": "#/definitions/digiflow.workorder.v1.Priority"
        },
        "clientId": {
          "type": "string"
        },
        "technicianId": {
          "type": "string"
        },
        "dateFrom": {
          "type": "string",
          "title": "YYYY-MM-DD"
        },
        "dateTo": {
          "type": "string",
          "title": "YYYY-MM-DD"
        },
        "pageSize": {
          "type": "integer",
          "format": "int32",
          "description": "Max 100, default 20",
          "title": "Pagination"
        },
        "page": {
          "type": "integer",
          "format": "int32",
          "title": "1-indexed page number"
        },
        "cursor": {
          "type": "string",
          "title": "For cursor-based pagination (work order ID)"
        },
        "sortBy": {
          "$ref": "#/definitions/digiflow.workorder.v1.SortBy",
          "title": "Sorting"
        }
      },
      "title": "Filter request with multiple optional criteria"
    },
    "digiflow.workorder.v1.FilterWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        },
        "nextCursor": {
          "type": "string",
          "title": "For cursor-based pagination"
        }
      }
    },
    "digiflow.workorder.v1.GetAllowedTransitionsResponse": {
      "type": "object",
      "properties": {
        "transitions": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StateTransition"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetAssignmentsResponse": {
      "type": "object",
      "properties": {
        "assignments": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.Assignment"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetAuditLogResponse": {
      "type": "object",
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.AuditLogEntry"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetClientWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.ClientWorkOrderSummary"
          }
        },
        "nextCursor": {
          "type": "string"
        },
        "hasMore": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.GetFieldValuesResponse": {
      "type": "object",
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldValue"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetMyWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "groups": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderGroup"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetStateHistoryResponse": {
      "type": "object",
      "properties": {
        "entries": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StateHistoryEntry"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetStatisticsOverviewResponse": {
      "type": "object",
      "properties": {
        "total": {
          "type": "integer",
          "format": "int32",
          "title": "Total work orders"
        },
        "active": {
          "type": "integer",
          "format": "int32",
          "title": "Non-terminal states"
        },
        "completed": {
          "type": "integer",
          "format": "int32",
          "title": "Terminal states"
        },
        "overdue": {
          "type": "integer",
          "format": "int32",
          "title": "Past scheduled date but not completed"
        }
      }
    },
    "digiflow.workorder.v1.GetStatsByDateRangeResponse": {
      "type": "object",
      "properties": {
        "stats": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.DailyStat"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetStatsByPriorityResponse": {
      "type": "object",
      "properties": {
        "stats": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StatByPriority"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetStatsByStateResponse": {
      "type": "object",
      "properties": {
        "stats": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StatByState"
          }
        }
      }
    },
    "digiflow.workorder.v1.GetStatsByTypeResponse": {
      "type": "object",
      "properties": {
        "stats": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StatByType"
          }
        }
      }
    },
    "digiflow.workorder.v1.ListFieldDefinitionsResponse": {
      "type": "object",
      "properties": {
        "fields": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldDefinition"
          }
        }
      }
    },
    "digiflow.workorder.v1.ListOverdueWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.ListProblemsResponse": {
      "type": "object",
      "properties": {
        "problems": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderProblem"
          }
        }
      }
    },
    "digiflow.workorder.v1.ListStatesResponse": {
      "type": "object",
      "properties": {
        "states": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderState"
          }
        }
      }
    },
    "digiflow.workorder.v1.ListTransitionsResponse": {
      "type": "object",
      "properties": {
        "transitions": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.StateTransition"
          }
        }
      }
    },
    "digiflow.workorder.v1.ListWorkOrderTypesResponse": {
      "type": "object",
      "properties": {
        "types": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderType"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.ListWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.Location": {
      "type": "object",
      "properties": {
        "address": {
          "type": "string"
        },
        "latitude": {
          "type": "number",
          "format": "double"
        },
        "longitude": {
          "type": "number",
          "format": "double"
        }
      },
      "title": "Location information"
    },
    "digiflow.workorder.v1.Priority": {
      "type": "string",
      "enum": [
        "PRIORITY_UNSPECIFIED",
        "PRIORITY_LOW",
        "PRIORITY_MEDIUM",
        "PRIORITY_HIGH",
        "PRIORITY_URGENT"
      ],
      "default": "PRIORITY_UNSPECIFIED",
      "title": "Priority levels"
    },
    "digiflow.workorder.v1.RemoveAssignmentResponse": {
      "type": "object",
      "properties": {
        "success": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.SatisfactionRating": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workOrderId": {
          "type": "string"
        },
        "rating": {
          "type": "integer",
          "format": "int32"
        },
        "comment": {
          "type": "string"
        },
        "submittedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.workorder.v1.Schedule": {
      "type": "object",
      "properties": {
        "date": {
          "type": "string",
          "title": "YYYY-MM-DD"
        },
        "timeStart": {
          "type": "string",
          "title": "HH:MM"
        },
        "timeEnd": {
          "type": "string",
          "title": "HH:MM"
        }
      },
      "title": "Schedule information"
    },
    "digiflow.workorder.v1.SearchWorkOrdersResponse": {
      "type": "object",
      "properties": {
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrder"
          }
        },
        "totalCount": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.SelectOption": {
      "type": "object",
      "properties": {
        "value": {
          "type": "string"
        },
        "label": {
          "type": "string"
        }
      },
      "title": "Option for select-type fields"
    },
    "digiflow.workorder.v1.SetFieldValuesResponse": {
      "type": "object",
      "properties": {
        "values": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldValue"
          }
        }
      }
    },
    "digiflow.workorder.v1.SortBy": {
      "type": "string",
      "enum": [
        "SORT_BY_UNSPECIFIED",
        "SORT_BY_CREATED",
        "SORT_BY_DATE",
        "SORT_BY_PRIORITY"
      ],
      "default": "SORT_BY_UNSPECIFIED",
      "title": "Sorting options for filter results"
    },
    "digiflow.workorder.v1.StatByPriority": {
      "type": "object",
      "properties": {
        "priority": {
          "$ref": "#/definitions/digiflow.workorder.v1.Priority"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.StatByState": {
      "type": "object",
      "properties": {
        "stateId": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.StatByType": {
      "type": "object",
      "properties": {
        "typeId": {
          "type": "string"
        },
        "typeName": {
          "type": "string"
        },
        "count": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.StateHistoryEntry": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "fromStateId": {
          "type": "string"
        },
        "fromStateName": {
          "type": "string"
        },
        "fromStateColor": {
          "type": "string"
        },
        "toStateId": {
          "type": "string"
        },
        "toStateName": {
          "type": "string"
        },
        "toStateColor": {
          "type": "string"
        },
        "changedBy": {
          "type": "string"
        },
        "changedByName": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        },
        "changedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "State history entry"
    },
    "digiflow.workorder.v1.StateTransition": {
      "type": "object",
      "properties": {
        "fromStateId": {
          "type": "string"
        },
        "toStateId": {
          "type": "string"
        },
        "fromStateName": {
          "type": "string"
        },
        "toStateName": {
          "type": "string"
        },
        "requiredRoles": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "toStateColor": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrder": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "typeId": {
          "type": "string"
        },
        "typeName": {
          "type": "string"
        },
        "stateId": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "stateIsTerminal": {
          "type": "boolean"
        },
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "priority": {
          "$ref": "#/definitions/digiflow.workorder.v1.Priority"
        },
        "clientId": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.workorder.v1.Location"
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.workorder.v1.Schedule"
        },
        "createdBy": {
          "type": "string"
        },
        "assignments": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.Assignment"
          }
        },
        "customFields": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.FieldValue"
          }
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      },
      "title": "Work order with all details"
    },
    "digiflow.workorder.v1.WorkOrderGroup": {
      "type": "object",
      "properties": {
        "groupName": {
          "type": "string",
          "title": "\"today\", \"tomorrow\", \"this_week\", \"later\""
        },
        "workOrders": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/digiflow.workorder.v1.WorkOrderSummary"
          }
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderProblem": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "workOrderId": {
          "type": "string"
        },
        "problemType": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "status": {
          "type": "string",
          "title": "\"open\", \"acknowledged\", \"resolved\""
        },
        "reporterName": {
          "type": "string"
        },
        "reportedAt": {
          "type": "string",
          "format": "date-time"
        },
        "resolverName": {
          "type": "string"
        },
        "resolvedAt": {
          "type": "string",
          "format": "date-time"
        },
        "resolutionNotes": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.ArchiveWorkOrderBody": {
      "type": "object",
      "properties": {
        "reason": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.AssignTechnicianBody": {
      "type": "object",
      "properties": {
        "technicianId": {
          "type": "string"
        },
        "role": {
          "$ref": "#/definitions/digiflow.workorder.v1.AssignmentRole"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.CloseWorkOrderBody": {
      "type": "object",
      "properties": {
        "completionNotes": {
          "type": "string",
          "title": "D-16: required"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.ReportProblemBody": {
      "type": "object",
      "properties": {
        "problemType": {
          "type": "string",
          "title": "From predefined list"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.ResolveProblemBody": {
      "type": "object",
      "properties": {
        "resolutionNotes": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.SubmitSatisfactionBody": {
      "type": "object",
      "properties": {
        "rating": {
          "type": "integer",
          "format": "int32",
          "title": "1-5 stars (D-18)"
        },
        "comment": {
          "type": "string",
          "title": "Optional"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.TransitionStateBody": {
      "type": "object",
      "properties": {
        "toStateId": {
          "type": "string"
        },
        "notes": {
          "type": "string"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderService.UpdateWorkOrderBody": {
      "type": "object",
      "properties": {
        "title": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "priority": {
          "$ref": "#/definitions/digiflow.workorder.v1.Priority"
        },
        "clientId": {
          "type": "string"
        },
        "location": {
          "$ref": "#/definitions/digiflow.workorder.v1.Location"
        },
        "schedule": {
          "$ref": "#/definitions/digiflow.workorder.v1.Schedule"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderState": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string",
          "title": "hex color code for UI"
        },
        "isInitial": {
          "type": "boolean"
        },
        "isTerminal": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderStateService.UpdateStateBody": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "color": {
          "type": "string"
        },
        "isInitial": {
          "type": "boolean"
        },
        "isTerminal": {
          "type": "boolean"
        },
        "sortOrder": {
          "type": "integer",
          "format": "int32"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderSummary": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "title": {
          "type": "string"
        },
        "stateName": {
          "type": "string"
        },
        "stateColor": {
          "type": "string"
        },
        "priority": {
          "type": "string"
        },
        "scheduledDate": {
          "type": "string"
        },
        "scheduledTimeStart": {
          "type": "string"
        },
        "scheduledTimeEnd": {
          "type": "string"
        },
        "clientName": {
          "type": "string"
        },
        "address": {
          "type": "string"
        },
        "isOverdue": {
          "type": "boolean"
        },
        "hasProblem": {
          "type": "boolean"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderType": {
      "type": "object",
      "properties": {
        "id": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        },
        "isActive": {
          "type": "boolean"
        },
        "createdAt": {
          "type": "string",
          "format": "date-time"
        },
        "updatedAt": {
          "type": "string",
          "format": "date-time"
        }
      }
    },
    "digiflow.workorder.v1.WorkOrderTypeService.UpdateWorkOrderTypeBody": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "description": {
          "type": "string"
        }
      }
    },
    "google.protobuf.Any": {
      "type": "object",
      "properties": {
        "@type": {
          "type": "string"
        }
      },
      "additionalProperties": {}
    },
    "google.rpc.Status": {
      "type": "object",
      "properties": {
        "code": {
          "type": "integer",
          "format": "int32"
        },
        "message": {
          "type": "string"
        },
        "details": {
          "type": "array",
          "items": {
            "type": "object",
            "$ref": "#/definitions/google.protobuf.Any"
          }
        }
      }
    }
  },
  "servers": [
    {
      "url": "https://api.digiflow.app",
      "description": "Production"
    },
    {
      "url": "https://staging-api.digiflow.app",
      "description": "Staging"
    },
    {
      "url": "http://localhost:8080",
      "description": "Local development"
    }
  ],
  "securityDefinitions": {
    "Bearer": {
      "type": "apiKey",
      "name": "Authorization",
      "in": "header",
      "description": "JWT Bearer token. Format: Bearer {token}"
    }
  },
  "security": [
    {
      "Bearer": []
    }
  ]
}
