// Code generated by Microsoft (R) AutoRest Code Generator 0.16.0.0
// Changes may cause incorrect behavior and will be lost if the code is
// regenerated.

namespace LanBackupAgent.Models
{
    using System;
    using System.Linq;
    using System.Collections.Generic;
    using Newtonsoft.Json;
    using Microsoft.Rest;
    using Microsoft.Rest.Serialization;

    public partial class BackupConfiguration
    {
        /// <summary>
        /// Initializes a new instance of the BackupConfiguration class.
        /// </summary>
        public BackupConfiguration() { }

        /// <summary>
        /// Initializes a new instance of the BackupConfiguration class.
        /// </summary>
        public BackupConfiguration(string clientIP, string id = default(string), byte[] rowVersion = default(byte[]), string srcFolder = default(string), string srcUser = default(string), string srcPass = default(string), string destLanFolder = default(string), string destUser = default(string), string destPass = default(string), bool? isActive = default(bool?), string crontab = default(string))
        {
            Id = id;
            RowVersion = rowVersion;
            ClientIP = clientIP;
            SrcFolder = srcFolder;
            SrcUser = srcUser;
            SrcPass = srcPass;
            DestLanFolder = destLanFolder;
            DestUser = destUser;
            DestPass = destPass;
            IsActive = isActive;
            Crontab = crontab;
        }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "id")]
        public string Id { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "rowVersion")]
        public byte[] RowVersion { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "clientIP")]
        public string ClientIP { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "srcFolder")]
        public string SrcFolder { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "srcUser")]
        public string SrcUser { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "srcPass")]
        public string SrcPass { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "destLanFolder")]
        public string DestLanFolder { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "destUser")]
        public string DestUser { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "destPass")]
        public string DestPass { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "isActive")]
        public bool? IsActive { get; set; }

        /// <summary>
        /// </summary>
        [JsonProperty(PropertyName = "crontab")]
        public string Crontab { get; set; }

        /// <summary>
        /// Validate the object. Throws ValidationException if validation fails.
        /// </summary>
        public virtual void Validate()
        {
            if (ClientIP == null)
            {
                throw new ValidationException(ValidationRules.CannotBeNull, "ClientIP");
            }
            if (this.ClientIP != null)
            {
                if (!System.Text.RegularExpressions.Regex.IsMatch(this.ClientIP, "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$"))
                {
                    throw new ValidationException(ValidationRules.Pattern, "ClientIP", "^(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})$");
                }
            }
        }
    }
}
