class LimitForbidControl::CompetitionApiScoreNew < LimitForbidControl::Base
  attr_reader :team_id, :times, :day

  def initialize(team_id, times = 1, day = 1)
    super()
    @team_id = team_id
    @times = times
    @day = day
  end

  def allow_times
    @times.to_i || 1
  end

  def forbid_expires
    return 3.minutes if EduSetting.get("code_debug")
    @day.days || 1.hours
  end

  def cumulative_expires
    @day.days || 1.days
  end

  def cache_key
    @_cache_key ||= "limit_forbid_control:#{Time.current.strftime('%Y%m%d')}:competition_api_score:#{team_id}"
  end
end