json.leader @leader

if @leader || User.current.admin_or_business?
  json.bank_account @bank_account
  json.bank_account_editable @bank_account_editable
end

json.all_certified current_prize_user.all_certified?
json.personal_certifications do
  json.array! @self_prizes do |prize_user|
    json.url personal_competition_certificate_path(current_competition.identifier, prize_user)
  end
end

json.team_certifications do
  json.array! @team_prizes do |team|
    json.url team_competition_certificate_path(current_competition.identifier, team)
  end
end

json.teams do
  json.array! @prize_user_map do |team, prize_users|
    json.extract! team, :id, :name

    json.bank_account prize_users.find(&:leader?).extra

    json.team_members do
      json.array! prize_users do |prize_user|
        user = prize_user.user

        json.role prize_user.role_text
        json.name user.real_name

        real_name_auth =
          if user.authentication?
            'authed'
          elsif user.process_real_name_apply.present?
            'authing'
          else
            'not_authed'
          end
        json.real_name_auth real_name_auth

        professional_auth =
          if user.professional_certification?
            'authed'
          elsif user.process_professional_apply.present?
            'authing'
          else
            'not_authed'
          end
        json.professional_auth professional_auth

        json.phone_binded user.phone_binded?
        json.email_binded user.email_binded?
      end
    end
  end
end