json.extract! @competition, :id, :name, :sub_title, :identifier, :bonus, :mode
json.visits_count @competition.visits
member_count = @competition.team_member_count
json.member_count member_count.zero? ? 268 : member_count

json.start_time @competition.start_time&.strftime("%Y-%m-%d")
json.end_time @competition.end_time&.strftime("%Y-%m-%d")
json.enroll_end_time @competition.enroll_end_time&.strftime("%Y-%m-%d %H:%M:%S")
json.enroll_end @competition.enroll_end_time && @competition.enroll_end_time < Time.now

json.published @competition.published?
json.nearly_published @competition.published_at.present?
json.competition_status @competition.competition_status

json.region_schools @competition.region_schools_name

json.avatar_url url_to_avatar(@competition)

json.competition_modules @competition_modules do |com_module|
  json.(com_module, :id, :name, :position, :module_type)
  json.module_url com_module.module_url
  json.has_url com_module.url.present?
end

json.stages

if @competition.mode == 2
  json.course_id @competition.competition_mode_setting&.course_id
  json.invite_code @competition.competition_mode_setting&.course&.invite_code
  json.member_of_course @user.member_of_course?(@competition.competition_mode_setting&.course)
end

json.permission do
  json.editable @user.admin_or_business? || @competition.manager?(@user)
end

