using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using GreenTree.Maschinenbestellungen.Core.Domain.Rights;
using System;
using System.Collections.Generic;
using System.Text;

namespace GreenTree.Maschinenbestellungen.Domain.Model.Rights
{
    public class UserPolicyMapping : IEntityTypeConfiguration<UserPolicy>
    {
        public void Configure(EntityTypeBuilder<UserPolicy> builder)
        {
            builder.ToTable("UserPolicies");

            builder.HasKey(up => new { up.UserId, up.PolicyName });

            builder.HasOne(rp => rp.User)
                .WithMany(r => r.Policies);
        }
    }
}
