/*
 * 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_DOUBLE_HPP
#define LS_STD_DOUBLE_HPP

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

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

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

      Double();
      explicit Double(double _value);
      ~Double() noexcept override;

      // assignment operators

      ls::standard::boxing::Double &operator=(double _value);

      // arithmetic operators

      double operator-() const;
      double operator+(const ls::standard::boxing::Double &_double) const;
      double operator+(double _value) const;
      double operator*(const ls::standard::boxing::Double &_double) const;
      double operator*(double _value) const;
      double operator-(const ls::standard::boxing::Double &_double) const;
      double operator-(double _value) const;
      double operator/(const ls::standard::boxing::Double &_double) const;
      double operator/(double _value) const;

      // compound operators

      ls::standard::boxing::Double &operator+=(const ls::standard::boxing::Double &_double);
      ls::standard::boxing::Double &operator+=(double _value);
      ls::standard::boxing::Double &operator-=(const ls::standard::boxing::Double &_double);
      ls::standard::boxing::Double &operator-=(double _value);
      ls::standard::boxing::Double &operator*=(const ls::standard::boxing::Double &_double);
      ls::standard::boxing::Double &operator*=(double _value);
      ls::standard::boxing::Double &operator/=(const ls::standard::boxing::Double &_double);
      ls::standard::boxing::Double &operator/=(double _value);

      // comparison operators

      bool operator==(const ls::standard::boxing::Double &_double) const;
      bool operator==(double _value) const;
      bool operator!=(const ls::standard::boxing::Double &_double) const;
      bool operator!=(double _value) const;
      bool operator>(const ls::standard::boxing::Double &_double) const;
      bool operator>(double _value) const;
      bool operator>=(const ls::standard::boxing::Double &_double) const;
      bool operator>=(double _value) const;
      bool operator<(const ls::standard::boxing::Double &_double) const;
      bool operator<(double _value) const;
      bool operator<=(const ls::standard::boxing::Double &_double) const;
      bool operator<=(double _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]] double getEpsilon() const;
      [[nodiscard]] double getValue() const;
      void setEpsilon(double _epsilon);

    private:

      double epsilon{};
      double value{};

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

#endif
