using MisIngredientesVue.Core.Attributes; using MisIngredientesVue.Core.Services; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; using System.Text; namespace MisIngredientesVue.Core.Models { [DisplayColumn("FullName")] public class User : RepositoryEntity { [MaxLength(255)] public string ProfileImgSrc { get; set; } [Required] public string FirstName { get; set; } [Required] public string LastName { get; set; } public string Phone { get; set; } [Required] public string Email { get; set; } public bool ResetPassword { get; set; } public bool IsConfirmed { get; set; } public bool SendExternalOrderEmail { get; set; } public SystemUserRole Role { get; set; } [MaxLength(255)] [Required] public string Password { get; set; } //Este se usa para determinar si el usuario es proveedor o restaurante, true = restaurante public bool IsClient { get; set; } [NotMapped] [IgnoreRelationship] public int? ClientOrSupplierId { get; set; } [DoNotUpdate] [IgnoreRelationship] public string TenantId { get; set; } [IncludeTime] [DoNotUpdate] public DateTime Created { get; set; } [DoNotUpdate] public bool IsActive { get; set; } //Aquí se guarda el valor del enum de PlanType public string StripePlanId { get; set; } //Aquí se guarda el ID de la subscripción de usuario. Cada subscripción es única para cada usuario. [MaxLength(50)] public string StripeSubscriptionId { get; set; } //Aquí se guarda la subscripción de los folios (metered subscription) para llevar la cuenta de los folios consumidos. //Todos los usuarios del tenant deben tener este mismo valor. //Se guarda el ID de la subscripción (de usuario) y el ID del primer ID item (separados por '?'), éste último se usa para reportar el uso (ReportUsage) //Por ejemplo: sub_HyE9KYyg6VnW8l?si_HyE9j2tuuD7Z5W [MaxLength(50)] public string StripeSubSubscriptionId { get; set; } public string StripeCustomerId { get; set; } [IncludeTime] public DateTime? TrialPeriodEnd { get; set; } [DoNotUpdate] public int? ModifiedById { get; set; } public UserRole CustomRole { get; set; } public int? CustomRoleId { get; set; } public string FullName { get { return $"{FirstName} {LastName}"; } } [NotMapped] public int[] ClientBranchIds { get; set; } } public class UserRoleEditData { [Required] public int UserRoleId { get; set; } } public class UserEditData { [Required] public int Id { get; set; } [Required] public string FirstName { get; set; } [Required] public string LastName { get; set; } [Required] public string Email { get; set; } } [DisplayColumn("FullName")] [Table("users")] public class UserData { public int Id { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public string Email { get; set; } public string Phone { get; set; } public SystemUserRole Role { get; set; } public int CustomRoleId { get; set; } public string CustomRoleName { get; set; } public bool SendExternalOrderEmail { get; set; } public string FullName { get { return $"{FirstName} {LastName}"; } } public string TenantId { get; set; } } //Se llama Client pero no tiene que ver con los restaurantes public class ClientUserData { public string AppVersion { get; set; } public int Id { get; set; } public string TenantId { get; set; } public string FirstName { get; set; } public string LastName { get; set; } public bool IsClient { get; set; } public string Email { get; set; } public string ProfileImgSrc { get; set; } public string CompanyLogoImgSrc { get; set; } public string CompanyLogoImg { get; set; } public int SubscriptionLevel { get; set; } //enum SubscriptionLevelType public string PlanId { get; set; } public bool IsPlanMonthly { get; set; } public int? Folios { get; set; } //Folios totales usados public DateTime? TrialPeriodEnd { get; set; } public int TrialDaysLeft { get; set; } public bool HasFreePlan { get; set; } public bool HasDefaultPaymentMethodId { get; set; } public SystemUserRole Role { get; set; } public ClientInvoicingInfo InvoicingInfo { get; set; } public string CompanyName { get; set; } public DateTime CurrentDateTime { get; set; } public bool IsTokenVersionCurrent { get; set; } public string ShareId { get; set; } public int ClientOrSupllierId { get; set; } //Indica que el usuario tiene asignados 2 o más sucursales public bool IsBranchManager { get; set; } public int[] Permissions { get; set; } } public enum SystemUserRole { Owner = 0, Member = 1 } }