#ifndef BEAKER_GLOBALS_H
#define BEAKER_GLOBALS_H

#include "../beaker.h"
#include <stdatomic.h>
#include <stddef.h>

extern RouteHandler handlers[MAX_HANDLERS];

extern int handler_count;

extern __thread int current_client_socket;

extern __thread Cookie cookies_to_set[MAX_COOKIES];

extern __thread int cookies_to_set_count;

extern __thread char current_request_buffer[BUFFER_SIZE];

extern __thread RequestInfo current_request_info;

extern __thread int current_response_status;

extern __thread size_t current_response_size;

void beaker_log(const char *level, const char *format, ...);

void beaker_log_errno_format(const char *level, const char *format, ...);

void beaker_log_errno(const char *message);

void beaker_log_request(const char *remote_addr, const char *method,
                        const char *path, int status, size_t response_size,
                        double duration_ms);

extern Locale *locales;

extern int locale_count;

extern int locale_capacity;

#endif
