class LimitForbidControl::CompetitionApiScore < LimitForbidControl::Base
  attr_reader :team_id

  def initialize(team_id)
    super()
    @team_id = team_id
  end

  def allow_times
    EduSetting.find_by(name: 'daily_api_score_times')&.value.presence || 1
  end

  def forbid_expires
    num = EduSetting.get('daily_api_score_forbid_time').presence.to_i
    num.zero? ? 1.hours : num.to_i.minutes
  end

  def cumulative_expires
    1.days
  end

  def cache_key
    @_cache_key ||= "limit_forbid_control:#{day}:competition_api_score:#{team_id}"
  end
end