using OnlineSalesAutoCrop.CoreAPI.Models.Objects.Systems;
using System;
using System.Collections.Generic;

namespace OnlineSalesAutoCrop.CoreAPI.Models.Responses.Systems
{
	public class FindAccountResponse : BooleanResponse
	{
		public int UserId { get; set; }
		public string PhoneNo { get; set; }
		public string EmailAddress { get; set; }
		public string PhoneNoMasked { get; set; }
		public string EmailAddressMasked { get; set; }
	}

	public class LoginResponse : ResponseBase1
	{
		public int Id { get; private set; }
		public EnumLoginStatus LoginStatus { get; set; }
		public string LoginId { get; set; }
		public string UserName { get; set; }
		public bool ValidUser { get; set; }
		public bool AuthRequiredAtLogin { get; set; }
		public EnumAuthenticationMethod AuthMethod { get; set; }
		public string AuthenticationToken { get; set; }
		public bool PwdChangeRequired { get; set; }
		public DateTime? Expires { get; set; }
		public DateTime SystemDate { get; set; }
		public string LoginTime { get; set; }
		public int LogId { get; set; }
		public DateTime? LogoutTime { get; private set; }
		public string MenuLayout { get; set; }
		public string ThemeName { get; set; }
		public string SchemeName { get; set; }
		public bool DbOnStartup { get; set; }
		public bool ViewOwnTaskOnly { get; private set; }
		public int? EmployeeId { get; private set; }
		public int NotificationCount { get; private set; }
		public int IdleTime { get; set; }
		public int PingTime { get; set; }
		public int TimeoutTime { get; set; }
		public bool BatchEnabled { get; private set; }
		public int BmProcessId { get; private set; }
		public int PrProcessId { get; private set; }
		public string IdsValue { get; set; }
		
		//public List<string> ModuleIds { get; set; } = [];

		public void Map(User source)
		{
			Id = source.UserId;
			LoginId = source.LoginId;
			UserName = source.UserName;
			ThemeName = source.ThemeName;
			//ModuleIds = source.ModuleIds;
			LogoutTime = source.LogoutTime;
			SchemeName = source.SchemeName;
			MenuLayout = source.MenuLayout;
			LoginStatus = source.LoginStatus;
			//DbOnStartup = source.DbOnStartup;
			//TimeoutTime = source.TimeoutTime;
			//BmProcessId = source.BmProcessId;
			//PrProcessId = source.PrProcessId;
			//BatchEnabled = source.BatchEnabled;
			//ViewOwnTaskOnly = source.ViewOwnTaskOnly;
			//NotificationCount = source.NotificationCount;
			//AuthRequiredAtLogin = source.AuthRequiredAtLogin;
			//IdsValue = Newtonsoft.Json.JsonConvert.SerializeObject(source.ModuleIds);
		}
	}

	public class MenuResponse
	{
		public MenuItem Item { get; set; }
	}

	public class UserProfileBase : ResponseBase
	{
		public int UserId { get; set; }
		public string LoginId { get; set; }
		public string EmployeeCode { get; set; }
		public string UserName { get; set; }
		public string Designation { get; set; }
		public string MobileNo { get; set; }
		public string EmailAddress { get; set; }
	}

	public class UserGetResponse : UserProfileBase
	{
		public bool IsLocked { get; set; }
		public bool NeverExpire { get; set; }
		public EnumStatus Status { get; set; }
		public short SeqId { get; set; }
		public bool CanUseAttendanceSystem { get; set; }
		public bool ViewToAll { get; set; }
		public bool AuthRequiredAtLogin { get; set; }
		public EnumAuthenticationMethod AuthMethod { get; set; }
		public EnumAccessStatus AccessStatus { get; set; }
		public bool DbOnStartup { get; set; }
		public bool DisallowMultiLogin { get; set; }
		public List<int> GroupIds { get; set; } = [];
	}

	public class UserProfileResponse : UserProfileBase
	{
		public bool HasAIApiKey { get; set; }
		public bool HasPayslipPath { get; set; }
		public string Address { get; set; }
		public string ContactNo { get; set; }
		public DateTime? NextPwdDate { get; set; }
		public DateTime? PwdLastChangedTime { get; set; }
		public List<LoginHistory> LoginHistories { get; set; }
	}



	public class UserForceLogoutResponse : ResponseBase
	{
		public List<UserForceLogout> Value { get; set; } = [];
	}

	public class UserAttributesResponse : ResponseBase
	{
		public int UserId { get; set; }
		public string LoginId { get; set; }
		public List<string> UkIds { get; set; }
		public bool HasSetup { get; set; }
	}

	public class AccessLogResponse : ResponseBase
	{
		public List<AccessLog> Value { get; set; }
	}

	public class UserBasicInfoResponse : ResponseBase
	{
		public List<UserBasicInfo> Value { get; set; } = [];
	}

	public class UserAuthorizeLimitResponse : ResponseBase
	{
		public string LoginId { get; set; }
		public decimal Value { get; set; }
	}
}