using Newtonsoft.Json;

namespace ChatController.LoginKlassen
{
    public class UserDaten
    {
        public string Token { get; set; }

        public OwnChatLoginResponse Response { get; set; }

        public string Message { get; set; }

        [JsonProperty("errors")]
        public OwnChatLoginError Error { get; set; }

        public bool Success { get; set; }
    }

    public class OwnChatLoginResponse
    {
        [JsonProperty("file_upload_max_size")]
        public long FileUploadMaxSize { get; set; }

        public string Token { get; set; }

        public OwnChatUser User { get; set; }
    }

    public class OwnChatLoginError
    {
        [JsonProperty("chatcode_failed")]
        public string[] ChatCodeFailed { get; set; }

        [JsonProperty("login_failed")]
        public string[] LoginFailed { get; set; }
    }

    public class OwnChatUser
    {
        public long Oid { get; set; }

        public string UserId { get; set; }

        public string Firstname { get; set; }

        public string Lastname { get; set; }

        public string Mobile { get; set; }

        public string Picture { get; set; }

        [JsonProperty("is_employee")]
        public bool IsEmployee { get; set; }

        public string Token { get; set; }

        public string UserName
        {
            get
            {
                var result = string.Empty;

                if(!string.IsNullOrWhiteSpace(Firstname))
                {
                    result = $"{Firstname} ";
                }

                if(!string.IsNullOrWhiteSpace(Lastname))
                {
                    result += Lastname;
                }

                return result;
            }
        }
    }
}
