// <auto-generated>
// DO NOT EDIT: generated by fsdgencsharp
// </auto-generated>
using System;
using System.Collections.Generic;
using Facility.Core;

namespace OapApi.v1.Client
{
	/// <summary>
	/// Request for CreateApplication.
	/// </summary>
	[System.CodeDom.Compiler.GeneratedCode("fsdgencsharp", "")]
	public sealed partial class CreateApplicationRequestDto : ServiceDto<CreateApplicationRequestDto>
	{
		/// <summary>
		/// Creates an instance.
		/// </summary>
		public CreateApplicationRequestDto()
		{
		}

		/// <summary>
		/// The application to create.
		/// </summary>
		public ApplicationCreateSetDto ApplicationCreateSet { get; set; }

		/// <summary>
		/// The JSON serializer.
		/// </summary>
		protected override JsonServiceSerializer JsonSerializer => SystemTextJsonServiceSerializer.Instance;

		/// <summary>
		/// Determines if two DTOs are equivalent.
		/// </summary>
		public override bool IsEquivalentTo(CreateApplicationRequestDto other)
		{
			return other != null &&
				ServiceDataUtility.AreEquivalentDtos(ApplicationCreateSet, other.ApplicationCreateSet);
		}

		/// <summary>
		/// Validates the DTO.
		/// </summary>
		public override bool Validate(out string errorMessage)
		{
			errorMessage = GetValidationErrorMessage();
			return errorMessage == null;
		}

		private string GetValidationErrorMessage()
		{
			string errorMessage;
			if (!ServiceDataUtility.ValidateFieldValue(ApplicationCreateSet, "applicationCreateSet", out errorMessage))
				return errorMessage;

			return null;
		}
	}
}
