/**
 * @file param_drv.h
 * @author June6 (https://github.com/Junedoubling6)
 * @brief
 * @version 0.2
 * @date 2023-03-03
 *
 * @copyright Copyright (c) 2022 - , All rights reserved.
 *
 */
#ifndef PARAM_DRV_H__
#define PARAM_DRV_H__

#include <limits.h>
#include <stdbool.h>
#include <stdint.h>
#include <stdio.h>
#include <string.h>

#include "err_code.h"

#ifdef __cplusplus
extern "C" {
#endif

#define SERVER_DATASET_MAX_PARAM_LEN 65
/* 日期和时间 */
/* 2024.01.01 08:00:00 星期一 */
#define DATE_TIME_CENTURY ((uint8_t)21)
#define DATE_TIME_YEAR ((uint8_t)24)
#define DATE_TIME_MONTH ((uint8_t)1)
#define DATE_TIME_DAY ((uint8_t)1)
#define DATE_TIME_WEEK ((uint8_t)1)
#define DATE_TIME_HOUR ((uint8_t)8)
#define DATE_TIME_MINUTE ((uint8_t)0)
#define DATE_TIME_SECOND ((uint8_t)0)

typedef enum {
  /* NOTE: June6 待定义 */
  NONE_SERVER = 0x00,
  number_of_server_id,
} ServerId_t;

typedef enum {
  /* NOTE: June6 待定义 */
  number_of_server_activity,
} ServerActivity_t;

typedef enum {
  CHINESE_LANGUAGE = 0x00,
  ENGLISH_LANGUAGE,
  number_of_language,
} Language_t;

typedef enum {
  BACKGROUND_RED = 0x00,
  BACKGROUND_GREEN,
  BACKGROUND_BLUE,
  number_of_background_color,
} BackgroundColor_t;

typedef enum {
  RELAY_1 = 0x00,
  RELAY_2,
  RELAY_3,
  RELAY_4,
  RELAY_5,
  number_of_relay_serial,
} RelaySerial_t;

typedef enum {
  RELAY_4_OFF = 0x00,
  RELAY_4_LOW,
  RELAY_4_MEDIUM,
  RELAY_4_HIGH,
  number_of_relay_4_level,
} Relay4Level_t;

typedef enum {
  WEAK_OUTPUT_POWER = 0x00,
  STRONG_OUTPUT_POWER,
  number_of_output_power_type,
} OutputPowerType_t;

typedef enum {
  /* NOTE: June6 与后端应用同步 */
  COOL_MODE = 0x01,
  HEAT_MODE,
  VENTILATION_MODE,
  DEHUMIDIFICATION_MODE,
  number_of_output_mode_type,
} OutputModeType_t;

typedef enum {
  /* NOTE: June6 与后端应用同步 */
  LOW_WIND_SPEED = 0x01,
  MEDIUM_WIND_SPEED,
  HIGH_WIND_SPEED,
  AUTO_WIND_SPEED,
  number_of_wind_speed_type,
} WindSpeedType_t;

typedef enum {
  SUB_CONTROLLER = 0x00,
  MASTER_CONTROLLER,
  number_of_system_type,
} SystemType_t;

typedef enum {
  /* NOTE: June6 与后端应用同步 */
  BAUD_RATE_4800 = 0x01,
  BAUD_RATE_9600,
  number_of_baud_rate_type,
} BaudRateType_t;

typedef enum {
  TOP_GROUND_RADIATION = 0x00,
  WIND_TURBINE_GROUND_RADIATION,
  SINGLE_RADIATION,
  number_of_control_system_type,
} ControlSystemType_t;

typedef enum {
  DEW_POINT_PROTECTION = 0x00,
  HUMIDITY_PROTECTION,
  DEW_POINT_HUMIDITY_PROTECTION,
  number_of_dew_protection_mode_type,
} DewProtectionModeType_t;

/* NOTE: June6 单字节数据传输 */
typedef struct {
  ServerId_t id;
  ServerActivity_t activity;
  uint16_t param;
} ServerData_t;

/* NOTE: June6 数据集传输 */
typedef struct {
  ServerId_t id;
  ServerActivity_t activity;
  uint16_t param[SERVER_DATASET_MAX_PARAM_LEN];
  uint16_t param_len;
} ServerDataSet_t;

typedef struct {
  uint16_t sec;
  uint16_t min;
  uint16_t hour;
  uint16_t day;
  uint16_t month;
  uint16_t week;
  uint16_t century;
  uint16_t year;
} DateTime_t;

#ifdef __cplusplus
}
#endif

#endif  // PARAM_DRV_H__
