using Entities.Contracts;
using Microsoft.AspNetCore.Identity;

namespace TechHelper.Server.Context
{
	public class DbInitializer
	{
		public static async Task SeedRoles(RoleManager<IdentityRole<Guid>> roleManager)
		{
			string[] defaultRoleName = { "Admin", "Teacher", "Student" };

			foreach (var roleName in defaultRoleName)
			{
				if (!await roleManager.RoleExistsAsync(roleName))
				{
					await roleManager.CreateAsync(new IdentityRole<Guid>(roleName));
					Console.WriteLine($"Default role '{roleName}' created successfully.");
				}
			}
		}
	}
}
