# Set the host name for URL creation
SitemapGenerator::Sitemap.default_host = Rails.application.config.external_root_url

SitemapGenerator::Sitemap.create do
  # Put links creation logic here.
  #
  # The root path '/' and sitemap index file are added automatically for you.
  # Links are added to the Sitemap in the order they are specified.
  #
  # Usage: add(path, options={})
  #        (default options are used if you don't specify)
  #
  # Defaults: :priority => 0.5, :changefreq => 'weekly',
  #           :lastmod => Time.now, :host => default_host
  #
  # Examples:
  #
  # Add '/articles'
  #
  #   add articles_path, :priority => 0.7, :changefreq => 'daily'
  #
  # Add all articles:
  #
  #   Article.find_each do |article|
  #     add article_path(article), :lastmod => article.updated_at
  #   end

  add(signup_path, priority: 0.9)
  add(signin_path, priority: 0.9)
  add(downloads_path, priority: 0.9)
  add(product_jamblaster_path, priority: 0.9)
  add(product_platform_path, priority: 0.9)
  add(product_jamtracks_path, priority: 0.9)
  add(corp_about_path, priority: 0.9)
  add(buy_gift_card_path, priority: 0.9)
  add(jamclass_student_signup_path, priority:0.9)
  add(jamclass_teacher_signup_path, priority:0.9)
  add(jam_class_schools_path, priority:0.9)
  add(jam_class_retailers_path, priority:0.9)
  add(jam_class_education_path, priority:0.9)
  add(landing_simple_jamtracks_path, priority:0.5)
  add(landing_simple_jamclass_path, priority:0.5)

  JamTrack.all.each do |jam_track|
    slug = jam_track.slug
    add(individual_jamtrack_path(slug), priority:0.9)
    add(individual_jamtrack_band_path(slug), priority:0.9)
  end

  Recording.popular_recordings.each do |recording|
    add(recording_detail_path(recording.id), priority:0.8)
  end

  Teacher.find_each do |teacher|
    if teacher.user
      add("/client#/profile/teacher/#{teacher.user.id}")
    end
  end

  add(reset_password_path)
  add(corp_news_path)
  add(corp_media_center_path)
  add(corp_overview_path)
  add(corp_features_path)
  add(corp_faqs_path)
  add(corp_screenshots_path)
  add(corp_photos_path)
  add(corp_logos_path)
  add(corp_testimonials_path)
  add(corp_audio_path)
  add(corp_videos_path)
  add(corp_contact_path)
  add(corp_privacy_path)
  add(corp_terms_path)
  add(corp_help_path)
  add(corp_cookie_policy_path)

  School.where("name IS NOT NULL AND name != ''").each do |school|
    school_student_register_path(school.id, priority: 0.4)
    school_teacher_register_path(school.id, priority: 0.4)
  end

end
