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

namespace detect.gui.Models.Entities;

[Table("dat_user")]
[Index(nameof(Username), IsUnique = true)]
public class UserEntity
{
    [Key]
    [JsonProperty(PropertyName = "id")]
    [Column("id")]
    public long? Id { get; set; }

    [NotMapped] public List<AuthorityEntity>? AuthorityList { get; set; }

    [StringLength(255), Comment("姓名")]
    [JsonProperty(PropertyName = "realName")]
    [Column("real_name")]
    public string? RealName { get; set; }

    [StringLength(255), Comment("用户名")]
    [JsonProperty(PropertyName = "username")]
    [Column("username")]
    public string? Username { get; set; }

    [StringLength(255), Comment("密码")]
    [JsonProperty(PropertyName = "password")]
    [Column("password")]
    public string? Password { get; set; }

    [Comment("创建时间")]
    [JsonProperty(PropertyName = "createTime")]
    [Column("create_time")]
    public DateTime? CreateTime { get; set; }

    [Comment("更新时间")]
    [JsonProperty(PropertyName = "updateTime")]
    [Column("update_time")]
    public DateTime? UpdateTime { get; set; }
}