31 lines
1.2 KiB
C#
31 lines
1.2 KiB
C#
using SmallSoftwareContracts.Exceptions;
|
|
using SmallSoftwareContracts.Extensions;
|
|
using SmallSoftwareContracts.Infrastructure;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace SmallSoftwareContracts.DataModels;
|
|
|
|
public class InstallationRequestDataModel(string softwareId, string requestId, int count) : IValidation
|
|
{
|
|
public string SoftwareId { get; private set; } = softwareId;
|
|
public string RequestId { get; private set; } = requestId;
|
|
public int Count { get; private set; } = count;
|
|
public void Validate()
|
|
{
|
|
if (SoftwareId.IsEmpty())
|
|
throw new ValidationException("Field SoftwareId is empty");
|
|
if (!SoftwareId.IsGuid())
|
|
throw new ValidationException("The value in the field SoftwareId is not a unique identifier");
|
|
if (RequestId.IsEmpty())
|
|
throw new ValidationException("Field RequestId is empty");
|
|
if (!RequestId.IsGuid())
|
|
throw new ValidationException("The value in the field RequestId is not a unique identifier");
|
|
if (Count <= 0)
|
|
throw new ValidationException("Field Count is less than or equal to 0");
|
|
}
|
|
}
|