// Copyright (C) 2024-2025  ilobilo

#pragma once

#include <string>

namespace std
{
    struct error_code { error_code(auto ...) { } };
    struct error_category { error_category(auto ...) { } };
    inline const error_category generic_category() noexcept { return error_category(); }

    class system_error : public exception
    {
        private:
        string _str;

        public:
        system_error(auto);
        system_error(auto, const string &what_arg) : _str { what_arg } { }
        system_error(auto, const char *what_arg) : _str { what_arg } { }
        system_error(auto, auto &);
        system_error(auto, auto &, const string &what_arg) : _str { what_arg } { }
        system_error(auto, auto &, const char *what_arg) : _str { what_arg } { }

        system_error(const system_error &) noexcept = default;

        system_error &operator=(const system_error &) noexcept = default;
        const error_code code() const noexcept { return error_code(); }

        const char *what() const noexcept { return _str.c_str(); }
    };
} // namespace std