{
    "schemes": [],
    "swagger": "2.0",
    "info": {
        "description": "Dashboard aggregation service for Banknote Tracker",
        "title": "BNT Dashboard Service API",
        "contact": {},
        "version": "1.0"
    },
    "host": "localhost:9012",
    "basePath": "/",
    "paths": {
        "/dashboard": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Returns aggregated dashboard data for the organisation",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "dashboard"
                ],
                "summary": "Get dashboard data",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Start date (RFC3339)",
                        "name": "from",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "string",
                        "description": "End date (RFC3339)",
                        "name": "to",
                        "in": "query",
                        "required": true
                    },
                    {
                        "type": "integer",
                        "description": "Page number",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Drill into one department (admins/super_admin only; regular users are pinned to their own)",
                        "name": "department_reference",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/dto.DashboardResponse"
                        }
                    }
                }
            }
        },
        "/dashboard/health": {
            "get": {
                "description": "Returns service health status",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Health check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.HealthResponse"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "dto.ActivityDateGroup": {
            "type": "object",
            "properties": {
                "activities": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ActivityItem"
                    }
                },
                "date": {
                    "type": "string"
                }
            }
        },
        "dto.ActivityItem": {
            "type": "object",
            "properties": {
                "description": {
                    "type": "string"
                },
                "photo_url": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "user_name": {
                    "type": "string"
                }
            }
        },
        "dto.CompletionRate": {
            "type": "object",
            "properties": {
                "invoiced_count": {
                    "type": "integer"
                },
                "percentage": {
                    "type": "number"
                },
                "total_count": {
                    "type": "integer"
                }
            }
        },
        "dto.DashboardResponse": {
            "type": "object",
            "properties": {
                "cases_by_denomination": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.DenominationCount"
                    }
                },
                "cases_by_status": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.StatusCount"
                    }
                },
                "completion_rate": {
                    "$ref": "#/definitions/dto.CompletionRate"
                },
                "invoice_metrics": {
                    "description": "InvoiceMetrics is a POINTER and omitempty on purpose: financial metrics are visibility-gated by\nthe caller's department capability (accessible_modules). A department without a financial module\n(invoice/bill/management) gets this block OMITTED entirely — not zeroed — so production users\nnever receive billing data. See DD3 capability-driven composition.",
                    "allOf": [
                        {
                            "$ref": "#/definitions/dto.InvoiceMetrics"
                        }
                    ]
                },
                "production_log": {
                    "$ref": "#/definitions/dto.ProductionLogResult"
                },
                "production_throughput": {
                    "$ref": "#/definitions/dto.ProductionThroughput"
                },
                "recent_activity": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ActivityDateGroup"
                    }
                },
                "total_amount_produced": {
                    "$ref": "#/definitions/dto.TotalAmountProduced"
                }
            }
        },
        "dto.DenominationCount": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "count": {
                    "type": "integer"
                },
                "denomination": {
                    "type": "string"
                },
                "value": {
                    "type": "number"
                }
            }
        },
        "dto.InvoiceMetrics": {
            "type": "object",
            "properties": {
                "billed": {
                    "type": "number"
                },
                "count": {
                    "type": "integer"
                },
                "outstanding": {
                    "type": "number"
                },
                "paid": {
                    "type": "number"
                }
            }
        },
        "dto.ProductionLogItem": {
            "type": "object",
            "properties": {
                "action": {
                    "type": "string"
                },
                "batch_reference": {
                    "type": "string"
                },
                "case_count": {
                    "type": "integer"
                },
                "date": {
                    "type": "string"
                },
                "denomination": {
                    "type": "string"
                },
                "denomination_code": {
                    "type": "string"
                },
                "denomination_value": {
                    "type": "integer"
                },
                "photo_url": {
                    "type": "string"
                },
                "prefix": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "status_code": {
                    "type": "integer"
                },
                "time": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "user_name": {
                    "type": "string"
                },
                "user_reference": {
                    "type": "string"
                },
                "year": {
                    "type": "integer"
                }
            }
        },
        "dto.ProductionLogResult": {
            "type": "object",
            "properties": {
                "has_next": {
                    "type": "boolean"
                },
                "has_previous": {
                    "type": "boolean"
                },
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ProductionLogItem"
                    }
                },
                "page": {
                    "type": "integer"
                },
                "pages": {
                    "type": "integer"
                },
                "size": {
                    "type": "integer"
                },
                "total": {
                    "type": "integer"
                }
            }
        },
        "dto.ProductionThroughput": {
            "type": "object",
            "properties": {
                "interval": {
                    "type": "string"
                },
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/dto.ProductionThroughputItem"
                    }
                }
            }
        },
        "dto.ProductionThroughputItem": {
            "type": "object",
            "properties": {
                "confirmed": {
                    "description": "3 ↔ confirmation",
                    "type": "integer"
                },
                "date": {
                    "type": "string"
                },
                "evacuated": {
                    "description": "4 ↔ evacuation",
                    "type": "integer"
                },
                "generated": {
                    "description": "status_code 0 ↔ prefix",
                    "type": "integer"
                },
                "invoiced": {
                    "description": "6 ↔ invoice/bill",
                    "type": "integer"
                },
                "labelled": {
                    "description": "1 ↔ labelling",
                    "type": "integer"
                },
                "moved": {
                    "description": "5 ↔ movement",
                    "type": "integer"
                },
                "packed": {
                    "description": "2 ↔ packing",
                    "type": "integer"
                }
            }
        },
        "dto.StatusCount": {
            "type": "object",
            "properties": {
                "count": {
                    "type": "integer"
                },
                "label": {
                    "type": "string"
                },
                "status": {
                    "type": "string"
                },
                "status_code": {
                    "type": "integer"
                }
            }
        },
        "dto.TotalAmountProduced": {
            "type": "object",
            "properties": {
                "amount": {
                    "type": "number"
                },
                "case_count": {
                    "type": "integer"
                },
                "change_percentage": {
                    "type": "number"
                },
                "previous_amount": {
                    "type": "number"
                },
                "previous_case_count": {
                    "type": "integer"
                }
            }
        },
        "schemas.HealthResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        }
    },
    "securityDefinitions": {
        "BearerAuth": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}