---@meta

---@class luvit.httpCodec
local http_codec = {}

---@alias httpCodec_reason
---100
---| 'Continue'
---101
---| 'Switching Protocols'
---102
---| 'Processing'
---200
---| 'OK'
---201
---| 'Created'
---202
---| 'Accepted'
---203
---| 'Non-Authoritative Information'
---204
---| 'No Content'
---205
---| 'Reset Content'
---206
---| 'Partial Content'
---207
---| 'Multi-Status'
---300
---| 'Multiple Choices'
---301
---| 'Moved Permanently'
---302
---| 'Moved Temporarily'
---303
---| 'See Other'
---304
---| 'Not Modified'
---305
---| 'Use Proxy'
---307
---| 'Temporary Redirect'
---400
---| 'Bad Request'
---401
---| 'Unauthorized'
---402
---| 'Payment Required'
---403
---| 'Forbidden'
---404
---| 'Not Found'
---405
---| 'Method Not Allowed'
---406
---| 'Not Acceptable'
---407
---| 'Proxy Authentication Required'
---408
---| 'Request Time-out'
---409
---| 'Conflict'
---410
---| 'Gone'
---411
---| 'Length Required'
---412
---| 'Precondition Failed'
---413
---| 'Request Entity Too Large'
---414
---| 'Request-URI Too Large'
---415
---| 'Unsupported Media Type'
---416
---| 'Requested Range Not Satisfiable'
---417
---| 'Expectation Failed'
---418
---| 'I'm a teapot'
---422
---| 'Unprocessable Entity'
---423
---| 'Locked'
---424
---| 'Failed Dependency'
---425
---| 'Unordered Collection'
---426
---| 'Upgrade Required'
---428
---| 'Precondition Required'
---429
---| 'Too Many Requests'
---431
---| 'Request Header Fields Too Large'
---500
---| 'Internal Server Error'
---501
---| 'Not Implemented'
---502
---| 'Bad Gateway'
---503
---| 'Service Unavailable'
---504
---| 'Gateway Time-out'
---505
---| 'HTTP Version not supported'
---506
---| 'Variant Also Negotiates'
---507
---| 'Insufficient Storage'
---509
---| 'Bandwidth Limit Exceeded'
---510
---| 'Not Extended'
---511
---| 'Network Authentication Required'
---| string

---@alias httpCodec_code
---Continue
---| 100
---Switching Protocols
---| 101
---Processing
---| 102
---OK
---| 200
---Created
---| 201
---Accepted
---| 202
---Non-Authoritative Information
---| 203
---No Content
---| 204
---Reset Content
---| 205
---Partial Content
---| 206
---Multi-Status
---| 207
---Multiple Choices
---| 300
---Moved Permanently
---| 301
---Moved Temporarily
---| 302
---See Other
---| 303
---Not Modified
---| 304
---Use Proxy
---| 305
---Temporary Redirect
---| 307
---Bad Request
---| 400
---Unauthorized
---| 401
---Payment Required
---| 402
---Forbidden
---| 403
---Not Found
---| 404
---Method Not Allowed
---| 405
---Not Acceptable
---| 406
---Proxy Authentication Required
---| 407
---Request Time-out
---| 408
---Conflict
---| 409
---Gone
---| 410
---Length Required
---| 411
---Precondition Failed
---| 412
---Request Entity Too Large
---| 413
---Request-URI Too Large
---| 414
---Unsupported Media Type
---| 415
---Requested Range Not Satisfiable
---| 416
---Expectation Failed
---| 417
---I'm a teapot
---| 418
---Unprocessable Entity
---| 422
---Locked
---| 423
---Failed Dependency
---| 424
---Unordered Collection
---| 425
---Upgrade Required
---| 426
---Precondition Required
---| 428
---Too Many Requests
---| 429
---Request Header Fields Too Large
---| 431
---Internal Server Error
---| 500
---Not Implemented
---| 501
---Bad Gateway
---| 502
---Service Unavailable
---| 503
---Gateway Time-out
---| 504
---HTTP Version not supported
---| 505
---Variant Also Negotiates
---| 506
---Insufficient Storage
---| 507
---Bandwidth Limit Exceeded
---| 509
---Not Extended
---| 510
---Network Authentication Required
---| 511
---| integer

---@alias httpCodec_method
---| 'GET'
---| 'HEAD'
---| 'POST'
---| 'PUT'
---| 'DELETE'
---| 'OPTIONS'
---| 'TRACE'
---| 'PATCH'
---| string

---@alias httpCodec_item {version?: number, method?: httpCodec_method, path?: string, reason?: httpCodec_reason,  code?: httpCodec_code, [integer]: table<string, string>}|string

---@return fun(item: httpCodec_item): string
---@nodiscard
function http_codec.encoder() end

---@alias httpCodec_head {code?: httpCodec_code, reason?: httpCodec_reason, version: string, keepAlive: boolean, method?: httpCodec_method, path?: string, [integer]: table<string, string>}

---@return fun(chunk: string): httpCodec_head|string, string
---@nodiscard
function http_codec.decoder() end

return http_codec
