// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Ivan Baidakou

#pragma once

#include <cstddef>
#include <cstdint>
#include <limits>

namespace rotor_light {

/** \brief actor states */
enum class State { off, initializing, initialized, operational, shutting_down };

namespace details {

enum class StateCommand { init, start, shutdown };

}

// clang-format off
/** \brief actor fail policy
 *
 *  It defines the supervisor behavior upon actor shutdown.
 *
 */
enum class FailPolicy {
    restart        = 0b00000001,
    force_restart  = 0b00000011,
    escalate       = 0b00000100,
    force_escalate = 0b00001100,
    ignore         = 0b00010000,
};
// clang-format on

using MessageTypeId = ROTOR_LIGHT_MESSAGE;
using Index = ROTOR_LIGHT_INDEX;
using ActorId = ROTOR_LIGHT_ACTOR;
using EventId = ROTOR_LIGHT_EVENT;

static constexpr size_t default_queue = ROTOR_LIGHT_FW_QUEUE;

static constexpr auto broadcast = std::numeric_limits<ActorId>::max();

using TimePoint = ROTOR_LIGHT_TIMEPOINT;
using Duration = ROTOR_LIGHT_DURATION;
using NowFunction = TimePoint (*)();
using Callback = void (*)(void *);

namespace ctx {
struct thread {};
struct interrupt {};
} // namespace ctx

} // namespace rotor_light
