using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using SqlSugar;

namespace DHSoftware.Models
{
    [SugarTable("User")]
    public class User
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(Length = 50, IsNullable = false)]
        public string UserName { get; set; }

        [SugarColumn(Length = 100, IsNullable = false)]
        public string Password { get; set; }

        [SugarColumn(IsNullable = true)]
        public DateTime? LastLoginTime { get; set; }
    }

    [SugarTable("Role")]
    public class Role
    {
        [SugarColumn(IsPrimaryKey = true, IsIdentity = true)]
        public int Id { get; set; }

        [SugarColumn(Length = 50, IsNullable = false)]
        public string RoleName { get; set; }

        [SugarColumn(Length = 200)]
        public string Description { get; set; }
    }

    [SugarTable("Permission")]
    public class Permission
    {
        [SugarColumn(IsPrimaryKey = true, Length = 50)]
        public string Code { get; set; }

        [SugarColumn(Length = 100, IsNullable = false)]
        public string Name { get; set; }
    }

    [SugarTable("UserRole")]
    public class UserRole
    {
        [SugarColumn(IsPrimaryKey = true)]
        public int UserId { get; set; }

        [SugarColumn(IsPrimaryKey = true)]
        public int RoleId { get; set; }
    }

    [SugarTable("RolePermission")]
    public class RolePermission
    {
        [SugarColumn(IsPrimaryKey = true)]
        public int RoleId { get; set; }

        [SugarColumn(IsPrimaryKey = true)]
        public string PermissionCode { get; set; }
    }
}