ExBooking.Decision (ExBooking v0.1.0)

View Source

The result of a booking decision.

A decision is returned for both accepted and rejected booking attempts. For rejections, reasons explain what failed and alternatives can be shown to the invitee. For accepted transitions, events and intents tell the consumer application what to persist, publish, or execute.

Example

iex> decision = %ExBooking.Decision{status: :ok, resource_ids: ["resource_1"]}
...> {decision.status, decision.resource_ids}
{:ok, ["resource_1"]}

Summary

Types

A side effect for the consumer to execute, in order.

Machine-readable rejection reason.

Decision outcome.

t()

A booking decision.

Types

intent()

@type intent() ::
  {:reserve, ExBooking.Hold.t()}
  | {:release, String.t()}
  | {:calendar_event, :create | :cancel | :move, map()}
  | {:notify, atom(), map()}
  | {:emit, ExBooking.Event.t()}

A side effect for the consumer to execute, in order.

reason()

@type reason() :: tuple() | atom()

Machine-readable rejection reason.

status()

@type status() :: :ok | :conflict | :policy_reject | :needs_routing

Decision outcome.

t()

@type t() :: %ExBooking.Decision{
  alternatives: [ExBooking.Interval.t()],
  events: [ExBooking.Event.t()],
  intents: [intent()],
  meeting_type_id: String.t() | nil,
  reasons: [reason()],
  resource_ids: [String.t()],
  seat_allocations: [
    %{resource_id: String.t(), capacity_consumed: pos_integer()}
  ],
  slot: ExBooking.Interval.t() | nil,
  status: status()
}

A booking decision.