class Theatre < ApplicationRecord
  include MyDiscard

  has_many :comments, class_name: 'TheatreComment'
  has_many :theatre_watching_users, dependent: :delete_all
  has_many :active_theatre_watching_users, -> { active },
           class_name: 'TheatreWatchingUser', inverse_of: :theatre
  has_many :watching_users, through: :active_theatre_watching_users, source: :user

  has_many :programmes, class_name: 'TheatreProgramme'
  has_many :skip_votes, class_name: 'TheatreSkipVote', dependent: :delete_all
  has_many :skip_events, class_name: 'TheatreSkipEvent', dependent: :delete_all

  belongs_to :host_user, class_name: 'User', optional: true
  belongs_to :current_post, class_name: 'Post', optional: true
  belongs_to :created_by_user, class_name: 'User'
end
