#ifndef CONFIGNIO_H
#define CONFIGNIO_H

#include "stm.h"
#include "cmd.h"

#define BUFF_SIZE 4096

struct cmd_st {
    buffer              *rb, *wb;
    struct cmd_parser   parser;
    uint8_t           cmd;
    uint8_t           verified;
    uint8_t           status;

    char username[STR_SIZE];
    char password[STR_SIZE];
    char new_username[STR_SIZE];
    uint8_t byte;
    uint16_t value;
};

struct config {
    union {
        struct cmd_st cmd;
    } client;

    uint8_t raw_buff_a[BUFF_SIZE], raw_buff_b[BUFF_SIZE];
    buffer read_buffer, write_buffer;
};

void config_read(struct selector_key *key);

#endif
