# This file should contain all the record creation needed to seed the database with its default values.
# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
#
# Examples:
#
#   cities = City.create([{ name: 'Chicago' }, { name: 'Copenhagen' }])
#   Mayor.create(name: 'Emanuel', city: cities.first)

Constants::ADMIN_USER_EMAILS.each do |admin_email|
  if AdminUser.find_by_email(admin_email).nil?
    if 'production' == Rails.env
      pw = Utils::random_password(16)
    else
      pw = 'jam123'
    end
    AdminUser.create!(:email => admin_email,
                      :password => pw, 
                      :password_confirmation => pw) 
  end
end

AdminUser::sync_users
