ExBooking. Resource
(ExBooking v0.1.0)
View Source
A bookable resource.
A resource is usually a bookable person, but can also represent a pooled seat. Busy intervals, booking reservations, daily booking counts, capacity, and fairness counters are explicit inputs maintained by the consuming application, which keeps assignment stateless and repeatable.
Example
iex> resource = %ExBooking.Resource{id: "resource_1", timezone: "Etc/UTC", capacity: 2}
...> {resource.id, resource.capacity}
{"resource_1", 2}
Summary
Types
@type fairness() :: %{ assignments_count: non_neg_integer(), last_assigned_at: DateTime.t() | nil, weight: number(), priority: integer() }
Explicit fairness inputs for assignment strategies.
@type t() :: %ExBooking.Resource{ busy: [ExBooking.Interval.t()], capacity: pos_integer(), daily_booking_counts: %{optional(Date.t()) => non_neg_integer()}, fairness: fairness() | nil, id: String.t(), meta: map() | nil, reservations: [ExBooking.Reservation.t()], timezone: String.t() }
A bookable resource.