#pragma once

#include <stdint.h>
#include <string>

struct ProfinetSettingsSwRevision
{   
    /* Allowed: 'V', 'R', 'P', 'U', 'T' */
    char    prefix;
    uint8_t functional_enhancement;
    uint8_t bug_fix;
    uint8_t internal_change;
};

struct ProfinetSettingsIm0
{
    uint16_t                    vendor_id;

    uint16_t                    hw_revision;
    ProfinetSettingsSwRevision  sw_revision;

    uint16_t                    revision_counter;
    uint16_t                    profile_id;
    uint16_t                    profile_specific_type;
    /** One bit for each supported I&M1..15. I&M0 is always supported.
       Use pnet_im_supported_values_t. */
    uint16_t                    supported;

    std::string                 order_id;
    std::string                 serial_number;
};

struct ProfinetSettingsIm1
{
    std::string tag_function;
    std::string tag_location;
};

struct ProfinetSettingsIm2
{
  std::string date;  
};

struct ProfinetSettingsIm3
{
  std::string descriptor;  
};

struct ProfinetSettingsIm4
{
  std::string signature;  
};

struct ProfinetDeviceSettings {
       /**
    * Product name
    *
    * This is known as DeviceVendorValue and DeviceType in the Profinet
    * specification. It constitutes the first part of SystemIdentification
    * (sysDescr in SNMP). It may also be used to construct the Chassis ID.
    * See IEC CDV 61158-6-10 ch. 4.10.3.3.1.
    *
    * Terminated string.
    */
    std::string product_name;
    /** Default station name.*/
    std::string station_name;

    ProfinetSettingsIm0 im_0;
    ProfinetSettingsIm1 im_1;
    ProfinetSettingsIm2 im_2;
    ProfinetSettingsIm3 im_3;
    ProfinetSettingsIm4 im_4;
    
    uint16_t device_id;
    uint16_t oem_vendor_id;
    uint16_t oem_device_id;

    bool send_hello;
    uint16_t min_device_interval;
};

/// Настройки не зависящие от описания данных Profinet
struct ProfinetSettings {
    uint32_t    ticks_us = 1000;     /// Устанавливает время в мкс между вызовами pnet_handle_periodic()
    uint32_t    cyclic_ms = 100;     /// Устанавливает период в мс для циклического обмена данными
    std::string eth_dev_name = "";   /// Имя интерфейса ethernet
    std::string profinet_device_config = ""; ///Файл конфигурации profinet device
};