/*
 * Author:          Patrick-Christopher Mattulat
 * Co-Author:       Claude Sonnet 4.6 (LLM)
 * Company:         Lynar Studios
 * E-Mail:          webmaster@lynarstudios.com
 * Created:         2020-08-14
 * Changed:         2026-06-23
 *
 * */

#ifndef LS_STD_FLOAT_HPP
#define LS_STD_FLOAT_HPP

#include <ls-std/core/Class.hpp>
#include <ls-std/core/interface/IBoxing.hpp>
#include <ls-std/os/dynamic-goal.hpp>
#include <memory>
#include <string>

/*
 * @doc: class(name: 'Float', package: 'boxing')
 * @doc: boxing.Float.description('This class represents the primitive datatype float and provides functionalities for arithmetic operations, accuracy and string representation.')
 * */

namespace ls::standard::boxing
{
  class LS_STD_DYNAMIC_GOAL Float : public ls::standard::core::Class, public ls::standard::core::interface_type::IBoxing
  {
    public:

      Float();
      explicit Float(float _value);
      ~Float() noexcept override;

      // assignment operators

      ls::standard::boxing::Float &operator=(float _value);

      // arithmetic operators

      float operator-() const;
      float operator+(const ls::standard::boxing::Float &_float) const;
      float operator+(float _value) const;
      float operator*(const ls::standard::boxing::Float &_float) const;
      float operator*(float _value) const;
      float operator-(const ls::standard::boxing::Float &_float) const;
      float operator-(float _value) const;
      float operator/(const ls::standard::boxing::Float &_float) const;
      float operator/(float _value) const;

      // compound operators

      ls::standard::boxing::Float &operator+=(const ls::standard::boxing::Float &_float);
      ls::standard::boxing::Float &operator+=(float _value);
      ls::standard::boxing::Float &operator-=(const ls::standard::boxing::Float &_float);
      ls::standard::boxing::Float &operator-=(float _value);
      ls::standard::boxing::Float &operator*=(const ls::standard::boxing::Float &_float);
      ls::standard::boxing::Float &operator*=(float _value);
      ls::standard::boxing::Float &operator/=(const ls::standard::boxing::Float &_float);
      ls::standard::boxing::Float &operator/=(float _value);

      // comparison operators

      bool operator==(const ls::standard::boxing::Float &_float) const;
      bool operator==(float _value) const;
      bool operator!=(const ls::standard::boxing::Float &_float) const;
      bool operator!=(float _value) const;
      bool operator>(const ls::standard::boxing::Float &_float) const;
      bool operator>(float _value) const;
      bool operator>=(const ls::standard::boxing::Float &_float) const;
      bool operator>=(float _value) const;
      bool operator<(const ls::standard::boxing::Float &_float) const;
      bool operator<(float _value) const;
      bool operator<=(const ls::standard::boxing::Float &_float) const;
      bool operator<=(float _value) const;

      // increment / decrement operator

      void operator++();
      void operator--();

      // implementation

      void parse(const ::std::string &_parseText) override;
      [[nodiscard]] ::std::string toString() override;

      // additional functionality

      [[nodiscard]] float getEpsilon() const;
      [[nodiscard]] float getValue() const;
      void setEpsilon(float _epsilon);

    private:

      float epsilon{};
      float value{};

      void _assignEpsilon(float _epsilon);
      [[nodiscard]] static ::std::string _fetchClassName();
  };
}

#endif
