{
    "schemes": [],
    "swagger": "2.0",
    "info": {
        "description": "Indent management service for Banknote Tracker",
        "title": "BNT Indent Service API",
        "contact": {},
        "version": "1.0"
    },
    "host": "localhost:9008",
    "basePath": "/",
    "paths": {
        "/indents": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "List indents with pagination, sorting, and filtering",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "List indents",
                "parameters": [
                    {
                        "type": "integer",
                        "default": 1,
                        "description": "Page number",
                        "name": "page",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "default": "created_by.timestamp",
                        "description": "Sort by field",
                        "name": "sort_by",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "default": "desc",
                        "description": "Order by direction (asc or desc)",
                        "name": "order_by",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Search across reference, denomination, year, etc.",
                        "name": "search",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "From date filter (YYYY-MM-DD)",
                        "name": "from",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "To date filter (YYYY-MM-DD)",
                        "name": "to",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Filter by year",
                        "name": "year",
                        "in": "query"
                    },
                    {
                        "type": "integer",
                        "description": "Filter by denomination value (5, 10, 20, 50, 100, 200, 500, 1000)",
                        "name": "denomination.value",
                        "in": "query"
                    },
                    {
                        "type": "boolean",
                        "description": "Filter by active status",
                        "name": "is_active",
                        "in": "query"
                    },
                    {
                        "type": "string",
                        "description": "Filter by prefix generation status (true = has generated, false = none)",
                        "name": "has_prefix",
                        "in": "query"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.PaginatedIndentResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            },
            "post": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Creates a new indent for a denomination and year",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Create indent",
                "parameters": [
                    {
                        "description": "Create indent request",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schemas.CreateIndentRequest"
                        }
                    }
                ],
                "responses": {
                    "201": {
                        "description": "Created",
                        "schema": {
                            "$ref": "#/definitions/schemas.ReferenceResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "409": {
                        "description": "Conflict",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/indents/health": {
            "get": {
                "description": "Returns service health status",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "health"
                ],
                "summary": "Health check",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.HealthResponse"
                        }
                    }
                }
            }
        },
        "/indents/platform/denominations": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Returns all available denominations",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "platform"
                ],
                "summary": "Get denominations",
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "type": "array",
                            "items": {
                                "$ref": "#/definitions/schemas.DenominationResponse"
                            }
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/indents/{reference}": {
            "get": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Retrieves an indent by its reference",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Get indent by reference",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Indent reference",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.IndentResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            },
            "put": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Updates an existing indent by reference",
                "consumes": [
                    "application/json"
                ],
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Update indent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Indent reference",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    },
                    {
                        "description": "Update indent request",
                        "name": "body",
                        "in": "body",
                        "required": true,
                        "schema": {
                            "$ref": "#/definitions/schemas.UpdateIndentRequest"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.ReferenceResponse"
                        }
                    },
                    "400": {
                        "description": "Bad Request",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            },
            "delete": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Deletes an indent by reference",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Delete indent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Indent reference",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.ReferenceResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/indents/{reference}/disable": {
            "put": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Disables an indent by reference",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Disable indent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Indent reference",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.ReferenceResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        },
        "/indents/{reference}/enable": {
            "put": {
                "security": [
                    {
                        "BearerAuth": []
                    }
                ],
                "description": "Enables an indent by reference",
                "produces": [
                    "application/json"
                ],
                "tags": [
                    "indents"
                ],
                "summary": "Enable indent",
                "parameters": [
                    {
                        "type": "string",
                        "description": "Indent reference",
                        "name": "reference",
                        "in": "path",
                        "required": true
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "schema": {
                            "$ref": "#/definitions/schemas.ReferenceResponse"
                        }
                    },
                    "401": {
                        "description": "Unauthorized",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    },
                    "404": {
                        "description": "Not Found",
                        "schema": {
                            "$ref": "#/definitions/shared.ApplicationError"
                        }
                    }
                }
            }
        }
    },
    "definitions": {
        "models.Denomination": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "denomination": {
                    "type": "string"
                },
                "value": {
                    "type": "integer"
                }
            }
        },
        "schemas.AuditInfoResponse": {
            "type": "object",
            "properties": {
                "department_name": {
                    "type": "string"
                },
                "department_reference": {
                    "type": "string"
                },
                "device_name": {
                    "type": "string"
                },
                "email": {
                    "type": "string"
                },
                "full_name": {
                    "type": "string"
                },
                "ip_address": {
                    "type": "string"
                },
                "latitude": {
                    "type": "string"
                },
                "longitude": {
                    "type": "string"
                },
                "organisation_name": {
                    "type": "string"
                },
                "organisation_reference": {
                    "type": "string"
                },
                "photo_url": {
                    "type": "string"
                },
                "role": {
                    "type": "string"
                },
                "timestamp": {
                    "type": "string"
                },
                "user_reference": {
                    "type": "string"
                }
            }
        },
        "schemas.CreateIndentRequest": {
            "type": "object",
            "required": [
                "denomination_value",
                "quantity_requested",
                "year"
            ],
            "properties": {
                "denomination_value": {
                    "type": "integer",
                    "enum": [
                        5,
                        10,
                        20,
                        50,
                        100,
                        200,
                        500,
                        1000
                    ]
                },
                "quantity_requested": {
                    "type": "integer",
                    "maximum": 999999999999,
                    "minimum": 100000
                },
                "year": {
                    "type": "integer"
                }
            }
        },
        "schemas.DenominationResponse": {
            "type": "object",
            "properties": {
                "code": {
                    "type": "string"
                },
                "denomination": {
                    "type": "string"
                },
                "value": {
                    "type": "integer"
                }
            }
        },
        "schemas.HealthResponse": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "schemas.IndentResponse": {
            "type": "object",
            "properties": {
                "created_by": {
                    "$ref": "#/definitions/schemas.AuditInfoResponse"
                },
                "denomination": {
                    "$ref": "#/definitions/models.Denomination"
                },
                "department_reference": {
                    "type": "string"
                },
                "indent_ref": {
                    "type": "string"
                },
                "is_active": {
                    "type": "boolean"
                },
                "organisation_reference": {
                    "type": "string"
                },
                "quantity_generated": {
                    "type": "integer"
                },
                "quantity_remaining": {
                    "type": "integer"
                },
                "quantity_requested": {
                    "type": "integer"
                },
                "reference": {
                    "type": "string"
                },
                "updated_by": {
                    "$ref": "#/definitions/schemas.AuditInfoResponse"
                },
                "year": {
                    "type": "integer"
                }
            }
        },
        "schemas.PaginatedIndentResponse": {
            "type": "object",
            "properties": {
                "items": {
                    "type": "array",
                    "items": {
                        "$ref": "#/definitions/schemas.IndentResponse"
                    }
                },
                "pagination": {
                    "$ref": "#/definitions/schemas.Pagination"
                }
            }
        },
        "schemas.Pagination": {
            "type": "object",
            "properties": {
                "has_next": {
                    "type": "boolean"
                },
                "has_previous": {
                    "type": "boolean"
                },
                "page": {
                    "type": "integer"
                },
                "pages": {
                    "type": "integer"
                },
                "size": {
                    "type": "integer"
                },
                "total": {
                    "type": "integer"
                }
            }
        },
        "schemas.ReferenceResponse": {
            "type": "object",
            "properties": {
                "reference": {
                    "type": "string"
                }
            }
        },
        "schemas.UpdateIndentRequest": {
            "type": "object",
            "properties": {
                "denomination_value": {
                    "type": "integer",
                    "enum": [
                        5,
                        10,
                        20,
                        50,
                        100,
                        200,
                        500,
                        1000
                    ]
                },
                "quantity_requested": {
                    "type": "integer",
                    "maximum": 999999999999,
                    "minimum": 100000
                },
                "year": {
                    "type": "integer"
                }
            }
        },
        "shared.ApplicationError": {
            "type": "object",
            "properties": {
                "error_reference": {
                    "type": "string"
                },
                "error_type": {
                    "$ref": "#/definitions/shared.ErrorType"
                },
                "errors": {
                    "type": "object",
                    "additionalProperties": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    }
                },
                "status_code": {
                    "type": "integer"
                },
                "timestamp": {
                    "type": "string"
                }
            }
        },
        "shared.ErrorType": {
            "type": "string",
            "enum": [
                "VALIDATION_ERROR",
                "NOT_FOUND_ERROR",
                "CONFLICT_ERROR",
                "UNAUTHORIZED_ERROR",
                "AUTHENTICATION_ERROR",
                "FORBIDDEN_ERROR",
                "BAD_REQUEST_ERROR",
                "SERVER_ERROR",
                "REDIS_ERROR",
                "MONGO_DB_ERROR",
                "CREATE_ERROR",
                "UPDATE_ERROR",
                "INVALID_RESOURCE_ERROR",
                "TIMEOUT",
                "METHOD_NOT_ALLOWED",
                "RATE_LIMIT_EXCEEDED",
                "PAYLOAD_TOO_LARGE",
                "UNPROCESSABLE_ENTITY",
                "INTERNAL_ERROR"
            ],
            "x-enum-varnames": [
                "ValidationError",
                "NotFoundError",
                "ConflictError",
                "UnauthorizedError",
                "AuthenticationError",
                "ForbiddenError",
                "BadRequestError",
                "ServerError",
                "RedisError",
                "MongoDBError",
                "CreateError",
                "UpdateError",
                "InvalidResourceError",
                "TimeoutError",
                "MethodNotAllowedError",
                "RateLimitExceededError",
                "PayloadTooLargeError",
                "UnprocessableEntityError",
                "InternalError"
            ]
        }
    },
    "securityDefinitions": {
        "BearerAuth": {
            "type": "apiKey",
            "name": "Authorization",
            "in": "header"
        }
    }
}