using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using Newtonsoft.Json;
using Microsoft.AspNetCore.Identity;
using Yavsc.Models.Relationship;
using Yavsc.Models.Identity;
using Yavsc.Models.Chat;
using Yavsc.Models.Bank;
using Yavsc.Models.Access;
using Yavsc.Abstract.Identity;
namespace Yavsc.Models
{
[Table("AspNetUsers")]
public class ApplicationUser : IdentityUser, IApplicationUser
{
///
/// Another me, as a byte array.TG7@Eu%80rufzkhbb
/// This value points a picture that may be used
/// to present the user
///
/// the path to an user's image, relative to it's user dir
/// Startup.UserFilesOptions
///
///
[MaxLength(512)]
public string? Avatar { get; set; }
[MaxLength(512)]
public string? FullName { get; set; }
///
/// WIP Paypal
///
///
[Display(Name = "Account balance")]
public virtual AccountBalance? AccountBalance { get; set; }
///
/// User's posts
///
///
[InverseProperty("Author"), JsonIgnore]
public virtual List? Posts { get; set; }
///
/// User's contact list
///
///
[InverseProperty("Owner"), JsonIgnore]
public virtual List? Book { get; set; }
///
/// External devices using the API
///
///
[InverseProperty("DeviceOwner"), JsonIgnore]
public virtual List? DeviceDeclaration { get; set; }
[InverseProperty("Owner"), JsonIgnore]
public virtual List? Connections { get; set; }
///
/// User's circles
///
///
[InverseProperty("Owner"), JsonIgnore]
public virtual List? Circles { get; set; }
///
/// Billing postal address
///
///
[ForeignKey("PostalAddressId")]
public virtual Location? PostalAddress { get; set; }
public long? PostalAddressId { get; set; }
///
/// User's Google calendar
///
///
[MaxLength(512)]
public string? DedicatedGoogleCalendar { get; set; }
public override string ToString()
{
return this.Id + " " + this.AccountBalance?.Credits.ToString() + this.Email + " " + this.UserName + " $" + this.AccountBalance?.Credits.ToString();
}
public virtual List? BankInfo { get; set; }
public long DiskQuota { get; set; } = 512 * 1024 * 1024;
public long DiskUsage { get; set; } = 0;
public long MaxFileSize { get; set; } = 512 * 1024 * 1024;
[JsonIgnore]
[InverseProperty("Owner")]
public virtual List? BlackList { get; set; }
public bool AllowMonthlyEmail { get; set; } = false;
[JsonIgnore]
[InverseProperty("Owner")]
public virtual List? Rooms { get; set; }
[JsonIgnore]
[InverseProperty("User")]
public virtual List? RoomAccess { get; set; }
[JsonIgnore]
[InverseProperty("Member")]
public virtual List? Membership { get; set; }
IAccountBalance? IApplicationUser.AccountBalance => AccountBalance;
ILocation? IApplicationUser.PostalAddress { get => PostalAddress; }
}
}