using FI.FIC;
using FI.FIC.Contracts.DataObjects.BaseObject;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace IronIntel.Contractor.Users
{
    public class UserInfo
    {
        private static string[] ContactTypeNames = { "Foreman", "Driver", "Inventory Manager", "Rental Manager", "Service Manager", "Fleet Manager", "Technician", "Other" };
        public string IID { get; set; }
        public string ID { get; set; }
        public string DisplayName { get; set; }
        public string TextAddress { get; set; }
        public bool IsUser { get; set; }
        public ContactTypes ContactType { get; set; }
        public string Mobile { get; set; }
        public string BusinessPhone { get; set; }
        public string Notes { get; set; }
        public bool Active { get; set; }
        public UserTypes UserType { get; set; }
        public string TransPass { get; set; }
        public string ManagerIID { get; set; }
        public string ManagerName { get; set; }
        public bool EmailOptOut { get; set; }
        public bool InspectEmailList { get; set; }
        public bool TeamIntelligenceUser { get; set; }
        public string FOB { get; set; }
        public decimal HourlyRate { get; set; }
        public string[] GroupIDs { get; set; }
        public string[] GroupNames { get; set; }
        public string GroupNamesStr { get { return (GroupNames == null || GroupNames.Length == 0) ? "" : string.Join(",", GroupNames); } }

        public string ContactTypeName
        {
            get
            {
                int cType = (int)ContactType;
                if (cType > 7)
                    cType = 7;
                return ContactTypeNames[cType];
            }
        }
    }

    public class UserObject
    {
        public UserInfo UserInfo { get; set; }
        public SubscribeMessageByEmail Subscribe { get; set; }
        public KeyValuePair<int, Foresight.Fleet.Services.User.Permissions[]>[] Features { get; set; }

        public EmailSchedule Schedule { get; set; }

    }

    public enum UserTypes
    {
        Readonly = 0,
        Common = 1,
        Admin = 2,
        SupperAdmin = 3
    }
    public enum ContactTypes
    {
        Foreman = 0,
        Driver = 1,
        InventoryManager = 2,
        RentalManager = 3,
        ServiceManager = 4,
        FleetManager = 5,
        Technician = 6,
        Other = 100
    }

    public class UserNameInfoItem
    {
        public string IID { get; set; }
        public string ID { get; set; }
        public string Name { get; set; }
    }
}
