using Microsoft.EntityFrameworkCore;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace AsbCloudDb.Model
{
    [Table("t_user_role"), Comment("Роли пользователей в системе")]
    public class UserRole : IId
    {
        [Key]
        [Column("id")]
        public int Id { get; set; }

        [Column("caption"), Comment("Название")]
        [StringLength(255, MinimumLength = 2)]
        public string Caption { get; set; } = null!;

        [Column("id_type"), Comment("0-роль из стандартной матрицы, \n1-специальная роль для какого-либо пользователя")]
        public int IdType { get; set; }

        [InverseProperty(nameof(RelationUserRoleUserRole.Role))]
        public virtual ICollection<RelationUserRoleUserRole> RelationUserRoleUserRoles { get; set; } = null!;

        [InverseProperty(nameof(RelationUserUserRole.UserRole))]
        public virtual ICollection<RelationUserUserRole> RelationUsersUserRoles { get; set; } = null!;

        [InverseProperty(nameof(RelationUserRolePermission.UserRole))]
        public virtual ICollection<RelationUserRolePermission> RelationUserRolePermissions { get; set; } = null!;
    }

}