syntax = "v1"

info (
    title: "Test Header and Path Parameters"
    version: "v1"
)

type (
    HeaderReq {
        Token string `header:"Authorization" validate:"required"`
    }
    
    PathReq {
        ID string `path:"id" validate:"required"`
    }
    
    QueryReq {
        Name string `form:"name,optional"`
    }
    
    BodyReq {
        Data string `json:"data"`
    }
    
    Response {
        Message string `json:"message"`
    }
    
    CombinedReq {
        Token string `header:"Authorization" validate:"required"`
        ID string `path:"id" validate:"required"`
        Data string `json:"data"`
    }
)

@server (
    prefix: /api/v1
)
service test {
    // Test header parameter
    @handler TestHeader
    get /header (HeaderReq) returns (Response)
    
    // Test path parameter
    @handler TestPath
    get /path/:id (PathReq) returns (Response)
    
    // Test query parameter
    @handler TestQuery
    get /query (QueryReq) returns (Response)
    
    // Test body parameter
    @handler TestBody
    post /body (BodyReq) returns (Response)
    
    // Test combined
    @handler TestCombined
    post /combined/:id (CombinedReq) returns (Response)
}
