syntax = "v1"

info (
    title: "Test Header with Body"
    version: "v1"
)

type (
    HeaderDef {
        Token string `header:"Authorization" validate:"required"`
    }
    
    // 方式1: 嵌入 header 結構體
    UpdateReqWithEmbed {
        Name string `json:"name"`
        Age  int    `json:"age"`
        HeaderDef
    }
    
    // 方式2: 分開定義
    UpdateReqSeparate {
        Token string `header:"Authorization" validate:"required"`
        Name  string `json:"name"`
        Age   int    `json:"age"`
    }
    
    Response {
        Message string `json:"message"`
    }
)

@server (
    prefix: /api/v1
)
service test {
    @handler TestWithEmbed
    put /with-embed (UpdateReqWithEmbed) returns (Response)
    
    @handler TestSeparate
    put /separate (UpdateReqSeparate) returns (Response)
}
