/* 
 * Muhimbi PDF
 *
 * Convert, Merge, Watermark, Secure and OCR files.
 *
 * OpenAPI spec version: 9.15
 * 
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 */

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;

namespace Muhimbi.PDF.Online.Client.Model
{
    /// <summary>
    /// Parameters for Convert operation
    /// </summary>
    [DataContract]
    public partial class ConvertData :  IEquatable<ConvertData>, IValidatableObject
    {
        /// <summary>
        /// Output format
        /// </summary>
        /// <value>Output format</value>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum OutputFormatEnum
        {
            
            /// <summary>
            /// Enum PDF for "PDF"
            /// </summary>
            [EnumMember(Value = "PDF")]
            PDF,
            
            /// <summary>
            /// Enum XPS for "XPS"
            /// </summary>
            [EnumMember(Value = "XPS")]
            XPS,
            
            /// <summary>
            /// Enum DOCX for "DOCX"
            /// </summary>
            [EnumMember(Value = "DOCX")]
            DOCX,
            
            /// <summary>
            /// Enum DOC for "DOC"
            /// </summary>
            [EnumMember(Value = "DOC")]
            DOC,
            
            /// <summary>
            /// Enum ODT for "ODT"
            /// </summary>
            [EnumMember(Value = "ODT")]
            ODT,
            
            /// <summary>
            /// Enum RTF for "RTF"
            /// </summary>
            [EnumMember(Value = "RTF")]
            RTF,
            
            /// <summary>
            /// Enum TXT for "TXT"
            /// </summary>
            [EnumMember(Value = "TXT")]
            TXT,
            
            /// <summary>
            /// Enum MHT for "MHT"
            /// </summary>
            [EnumMember(Value = "MHT")]
            MHT,
            
            /// <summary>
            /// Enum HTML for "HTML"
            /// </summary>
            [EnumMember(Value = "HTML")]
            HTML,
            
            /// <summary>
            /// Enum XML for "XML"
            /// </summary>
            [EnumMember(Value = "XML")]
            XML,
            
            /// <summary>
            /// Enum XLS for "XLS"
            /// </summary>
            [EnumMember(Value = "XLS")]
            XLS,
            
            /// <summary>
            /// Enum XLSX for "XLSX"
            /// </summary>
            [EnumMember(Value = "XLSX")]
            XLSX,
            
            /// <summary>
            /// Enum CSV for "CSV"
            /// </summary>
            [EnumMember(Value = "CSV")]
            CSV,
            
            /// <summary>
            /// Enum ODS for "ODS"
            /// </summary>
            [EnumMember(Value = "ODS")]
            ODS,
            
            /// <summary>
            /// Enum PPT for "PPT"
            /// </summary>
            [EnumMember(Value = "PPT")]
            PPT,
            
            /// <summary>
            /// Enum PPTX for "PPTX"
            /// </summary>
            [EnumMember(Value = "PPTX")]
            PPTX,
            
            /// <summary>
            /// Enum ODP for "ODP"
            /// </summary>
            [EnumMember(Value = "ODP")]
            ODP,
            
            /// <summary>
            /// Enum PPS for "PPS"
            /// </summary>
            [EnumMember(Value = "PPS")]
            PPS,
            
            /// <summary>
            /// Enum PPSX for "PPSX"
            /// </summary>
            [EnumMember(Value = "PPSX")]
            PPSX,
            
            /// <summary>
            /// Enum TIFF for "TIFF"
            /// </summary>
            [EnumMember(Value = "TIFF")]
            TIFF,
            
            /// <summary>
            /// Enum PNG for "PNG"
            /// </summary>
            [EnumMember(Value = "PNG")]
            PNG,
            
            /// <summary>
            /// Enum GIF for "GIF"
            /// </summary>
            [EnumMember(Value = "GIF")]
            GIF,
            
            /// <summary>
            /// Enum JPG for "JPG"
            /// </summary>
            [EnumMember(Value = "JPG")]
            JPG,
            
            /// <summary>
            /// Enum BMP for "BMP"
            /// </summary>
            [EnumMember(Value = "BMP")]
            BMP,
            
            /// <summary>
            /// Enum PS for "PS"
            /// </summary>
            [EnumMember(Value = "PS")]
            PS,
            
            /// <summary>
            /// Enum PCL for "PCL"
            /// </summary>
            [EnumMember(Value = "PCL")]
            PCL,
            
            /// <summary>
            /// Enum EPS for "EPS"
            /// </summary>
            [EnumMember(Value = "EPS")]
            EPS,
            
            /// <summary>
            /// Enum FDF for "FDF"
            /// </summary>
            [EnumMember(Value = "FDF")]
            FDF,
            
            /// <summary>
            /// Enum XFDF for "XFDF"
            /// </summary>
            [EnumMember(Value = "XFDF")]
            XFDF
        }

        /// <summary>
        /// Output format
        /// </summary>
        /// <value>Output format</value>
        [DataMember(Name="output_format", EmitDefaultValue=false)]
        public OutputFormatEnum? OutputFormat { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConvertData" /> class.
        /// </summary>
        [JsonConstructorAttribute]
        protected ConvertData() { }
        /// <summary>
        /// Initializes a new instance of the <see cref="ConvertData" /> class.
        /// </summary>
        /// <param name="UseAsyncPattern">Use async behaviour for API request (required) (default to false).</param>
        /// <param name="SourceFileName">Name of the source file including extension (required).</param>
        /// <param name="SourceFileContent">Content of the file to convert (required).</param>
        /// <param name="SharepointFile">SharepointFile.</param>
        /// <param name="OutputFormat">Output format (required) (default to OutputFormatEnum.PDF).</param>
        /// <param name="CopyMetadata">Copy metadata (Only for SharePoint operations) (required) (default to false).</param>
        /// <param name="OverrideSettings">Optional settings using Muhimbi&#39;s XML syntax.</param>
        /// <param name="TemplateFileContent">Optional template file content (e.g. infopath XSN file).</param>
        /// <param name="FailOnError">Fail on error (default to true).</param>
        public ConvertData(bool? UseAsyncPattern = false, string SourceFileName = default(string), byte[] SourceFileContent = default(byte[]), SharepointFile SharepointFile = default(SharepointFile), OutputFormatEnum? OutputFormat = OutputFormatEnum.PDF, bool? CopyMetadata = false, string OverrideSettings = default(string), byte[] TemplateFileContent = default(byte[]), bool? FailOnError = true)
        {
            // to ensure "UseAsyncPattern" is required (not null)
            if (UseAsyncPattern == null)
            {
                throw new InvalidDataException("UseAsyncPattern is a required property for ConvertData and cannot be null");
            }
            else
            {
                this.UseAsyncPattern = UseAsyncPattern;
            }
            // to ensure "SourceFileName" is required (not null)
            if (SourceFileName == null)
            {
                throw new InvalidDataException("SourceFileName is a required property for ConvertData and cannot be null");
            }
            else
            {
                this.SourceFileName = SourceFileName;
            }
            // to ensure "SourceFileContent" is required (not null)
            if (SourceFileContent == null)
            {
                throw new InvalidDataException("SourceFileContent is a required property for ConvertData and cannot be null");
            }
            else
            {
                this.SourceFileContent = SourceFileContent;
            }
            // to ensure "OutputFormat" is required (not null)
            if (OutputFormat == null)
            {
                throw new InvalidDataException("OutputFormat is a required property for ConvertData and cannot be null");
            }
            else
            {
                this.OutputFormat = OutputFormat;
            }
            // to ensure "CopyMetadata" is required (not null)
            if (CopyMetadata == null)
            {
                throw new InvalidDataException("CopyMetadata is a required property for ConvertData and cannot be null");
            }
            else
            {
                this.CopyMetadata = CopyMetadata;
            }
            this.SharepointFile = SharepointFile;
            this.OverrideSettings = OverrideSettings;
            this.TemplateFileContent = TemplateFileContent;
            // use default value if no "FailOnError" provided
            if (FailOnError == null)
            {
                this.FailOnError = true;
            }
            else
            {
                this.FailOnError = FailOnError;
            }
        }
        
        /// <summary>
        /// Use async behaviour for API request
        /// </summary>
        /// <value>Use async behaviour for API request</value>
        [DataMember(Name="use_async_pattern", EmitDefaultValue=false)]
        public bool? UseAsyncPattern { get; set; }
        /// <summary>
        /// Name of the source file including extension
        /// </summary>
        /// <value>Name of the source file including extension</value>
        [DataMember(Name="source_file_name", EmitDefaultValue=false)]
        public string SourceFileName { get; set; }
        /// <summary>
        /// Content of the file to convert
        /// </summary>
        /// <value>Content of the file to convert</value>
        [DataMember(Name="source_file_content", EmitDefaultValue=false)]
        public byte[] SourceFileContent { get; set; }
        /// <summary>
        /// Gets or Sets SharepointFile
        /// </summary>
        [DataMember(Name="sharepoint_file", EmitDefaultValue=false)]
        public SharepointFile SharepointFile { get; set; }
        /// <summary>
        /// Copy metadata (Only for SharePoint operations)
        /// </summary>
        /// <value>Copy metadata (Only for SharePoint operations)</value>
        [DataMember(Name="copy_metadata", EmitDefaultValue=false)]
        public bool? CopyMetadata { get; set; }
        /// <summary>
        /// Optional settings using Muhimbi&#39;s XML syntax
        /// </summary>
        /// <value>Optional settings using Muhimbi&#39;s XML syntax</value>
        [DataMember(Name="override_settings", EmitDefaultValue=false)]
        public string OverrideSettings { get; set; }
        /// <summary>
        /// Optional template file content (e.g. infopath XSN file)
        /// </summary>
        /// <value>Optional template file content (e.g. infopath XSN file)</value>
        [DataMember(Name="template_file_content", EmitDefaultValue=false)]
        public byte[] TemplateFileContent { get; set; }
        /// <summary>
        /// Fail on error
        /// </summary>
        /// <value>Fail on error</value>
        [DataMember(Name="fail_on_error", EmitDefaultValue=false)]
        public bool? FailOnError { get; set; }
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class ConvertData {\n");
            sb.Append("  UseAsyncPattern: ").Append(UseAsyncPattern).Append("\n");
            sb.Append("  SourceFileName: ").Append(SourceFileName).Append("\n");
            sb.Append("  SourceFileContent: ").Append(SourceFileContent).Append("\n");
            sb.Append("  SharepointFile: ").Append(SharepointFile).Append("\n");
            sb.Append("  OutputFormat: ").Append(OutputFormat).Append("\n");
            sb.Append("  CopyMetadata: ").Append(CopyMetadata).Append("\n");
            sb.Append("  OverrideSettings: ").Append(OverrideSettings).Append("\n");
            sb.Append("  TemplateFileContent: ").Append(TemplateFileContent).Append("\n");
            sb.Append("  FailOnError: ").Append(FailOnError).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }
  
        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="obj">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object obj)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            return this.Equals(obj as ConvertData);
        }

        /// <summary>
        /// Returns true if ConvertData instances are equal
        /// </summary>
        /// <param name="other">Instance of ConvertData to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(ConvertData other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
                return false;

            return 
                (
                    this.UseAsyncPattern == other.UseAsyncPattern ||
                    this.UseAsyncPattern != null &&
                    this.UseAsyncPattern.Equals(other.UseAsyncPattern)
                ) && 
                (
                    this.SourceFileName == other.SourceFileName ||
                    this.SourceFileName != null &&
                    this.SourceFileName.Equals(other.SourceFileName)
                ) && 
                (
                    this.SourceFileContent == other.SourceFileContent ||
                    this.SourceFileContent != null &&
                    this.SourceFileContent.Equals(other.SourceFileContent)
                ) && 
                (
                    this.SharepointFile == other.SharepointFile ||
                    this.SharepointFile != null &&
                    this.SharepointFile.Equals(other.SharepointFile)
                ) && 
                (
                    this.OutputFormat == other.OutputFormat ||
                    this.OutputFormat != null &&
                    this.OutputFormat.Equals(other.OutputFormat)
                ) && 
                (
                    this.CopyMetadata == other.CopyMetadata ||
                    this.CopyMetadata != null &&
                    this.CopyMetadata.Equals(other.CopyMetadata)
                ) && 
                (
                    this.OverrideSettings == other.OverrideSettings ||
                    this.OverrideSettings != null &&
                    this.OverrideSettings.Equals(other.OverrideSettings)
                ) && 
                (
                    this.TemplateFileContent == other.TemplateFileContent ||
                    this.TemplateFileContent != null &&
                    this.TemplateFileContent.Equals(other.TemplateFileContent)
                ) && 
                (
                    this.FailOnError == other.FailOnError ||
                    this.FailOnError != null &&
                    this.FailOnError.Equals(other.FailOnError)
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;
                // Suitable nullity checks etc, of course :)
                if (this.UseAsyncPattern != null)
                    hash = hash * 59 + this.UseAsyncPattern.GetHashCode();
                if (this.SourceFileName != null)
                    hash = hash * 59 + this.SourceFileName.GetHashCode();
                if (this.SourceFileContent != null)
                    hash = hash * 59 + this.SourceFileContent.GetHashCode();
                if (this.SharepointFile != null)
                    hash = hash * 59 + this.SharepointFile.GetHashCode();
                if (this.OutputFormat != null)
                    hash = hash * 59 + this.OutputFormat.GetHashCode();
                if (this.CopyMetadata != null)
                    hash = hash * 59 + this.CopyMetadata.GetHashCode();
                if (this.OverrideSettings != null)
                    hash = hash * 59 + this.OverrideSettings.GetHashCode();
                if (this.TemplateFileContent != null)
                    hash = hash * 59 + this.TemplateFileContent.GetHashCode();
                if (this.FailOnError != null)
                    hash = hash * 59 + this.FailOnError.GetHashCode();
                return hash;
            }
        }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        { 
            yield break;
        }
    }

}
