using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using NetworkResurrector.Api.Domain.Entities.Security;

namespace NetworkResurrector.Api.Domain.Data.EntityTypeConfiguration.Security
{
    class UserRoleAuthorizationConfiguration : IEntityTypeConfiguration<UserRoleAuthorization>
    {
        public void Configure(EntityTypeBuilder<UserRoleAuthorization> builder)
        {
            builder.ToTable("UserRoleAuthorization").HasKey(z => new { z.UserRoleId, z.PermissionId });
            builder.HasOne(z => z.Permission).WithMany().HasForeignKey(z => z.PermissionId);
        }
    }
}
