# frozen_string_literal: true module Discorb # # Represents an event in guild. # class ScheduledEvent < DiscordModel # @private # @return [{Integer => Symbol}] The mapping of privacy level. PRIVACY_LEVEL = { 2 => :guild_only, }.freeze # @private # @return [{Integer => Symbol}] The mapping of status. STATUS = { 1 => :scheduled, 2 => :active, 3 => :completed, 4 => :canceled, }.freeze # @private # @return [{Integer => Symbol}] The mapping of entity_type. ENTITY_TYPE = { 1 => :stage_instance, 2 => :voice, 3 => :external, }.freeze # @!visibility private def initialize(client, data) @client = client @data = data _set_data(data) end # # Represents the metadata of the event. # class Metadata # @return [String, nil] The location of the event. Only present if the event is a external event. attr_reader :location # @!visibility private def initialize(data) @location = data[:location] end def inspect "#<#{self.class.name} #{@name}>" end end # @return [Discorb::Snowflake] The ID of the event. attr_reader :id # @return [String] The name of the event. attr_reader :name # @return [String] The description of the event. attr_reader :description # @return [Time] The time the event starts. attr_reader :scheduled_start_time alias start_time scheduled_start_time alias start_at scheduled_start_time # @return [Time] The time the event ends. attr_reader :scheduled_end_time alias end_time scheduled_end_time alias end_at scheduled_end_time # @return [:guild_only] The privacy level of the event. attr_reader :privacy_level # @return [:scheduled, :active, :completed, :canceled] The status of the event. attr_reader :status # @return [:stage_instance, :voice, :external] The type of the event. attr_reader :entity_type # @return [Discorb::Snowflake] The ID of the entity the event is for. attr_reader :entity_id # @return [Discorb::ScheduledEvent::Metadata] The metadata of the event. attr_reader :metadata # @return [Integer] The user count of the event. attr_reader :user_count # @!attribute [r] guild # @return [Discorb::Guild, nil] The guild of the event. # @!attribute [r] channel # @return [Discorb::Channel, nil] The channel of the event. # Only present if the event will do in stage instance or voice channel. # @!attribute [r] creator # @return [Discorb::User] The user who created the event.# # @!attribute [r] time # @return [Range