Files
CROWLER/Models/InstrumentModels.cs
2026-04-04 10:52:30 +03:00

151 lines
4.8 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
namespace CRAWLER.Models;
internal sealed class InstrumentSummary
{
public long Id { get; set; }
public string RegistryNumber { get; set; }
public string Name { get; set; }
public string TypeDesignation { get; set; }
public string Manufacturer { get; set; }
public string VerificationInterval { get; set; }
public string SourceSystem { get; set; }
public DateTime UpdatedAt { get; set; }
}
internal sealed class InstrumentRecord
{
public long Id { get; set; }
public string RegistryNumber { get; set; }
public string Name { get; set; }
public string TypeDesignation { get; set; }
public string Manufacturer { get; set; }
public string VerificationInterval { get; set; }
public string CertificateOrSerialNumber { get; set; }
public string AllowsBatchVerification { get; set; }
public string HasPeriodicVerification { get; set; }
public string TypeInfo { get; set; }
public string Purpose { get; set; }
public string Description { get; set; }
public string Software { get; set; }
public string MetrologicalCharacteristics { get; set; }
public string Completeness { get; set; }
public string Verification { get; set; }
public string RegulatoryDocuments { get; set; }
public string Applicant { get; set; }
public string TestCenter { get; set; }
public string DetailUrl { get; set; }
public string SourceSystem { get; set; } = "Manual";
public DateTime? LastImportedAt { get; set; }
public DateTime CreatedAt { get; set; }
public DateTime UpdatedAt { get; set; }
public List<PdfAttachment> Attachments { get; set; } = new List<PdfAttachment>();
public InstrumentRecord Clone()
{
var copy = (InstrumentRecord)MemberwiseClone();
copy.Attachments = new List<PdfAttachment>();
foreach (var attachment in Attachments)
{
copy.Attachments.Add(attachment.Clone());
}
return copy;
}
}
internal sealed class PdfAttachment
{
public long Id { get; set; }
public long InstrumentId { get; set; }
public string Kind { get; set; }
public string Title { get; set; }
public string SourceUrl { get; set; }
public string LocalPath { get; set; }
public bool IsManual { get; set; }
public DateTime CreatedAt { get; set; }
public string DisplayName
{
get
{
if (!string.IsNullOrWhiteSpace(Title))
{
return Title;
}
if (!string.IsNullOrWhiteSpace(LocalPath))
{
return Path.GetFileName(LocalPath);
}
return SourceUrl ?? string.Empty;
}
}
public PdfAttachment Clone()
{
return (PdfAttachment)MemberwiseClone();
}
}
internal sealed class PendingPdfFile
{
public string SourcePath { get; set; }
public string DisplayName { get; set; }
}
internal sealed class CatalogListItem
{
public string RegistryNumber { get; set; }
public string Name { get; set; }
public string TypeDesignation { get; set; }
public string Manufacturer { get; set; }
public string VerificationInterval { get; set; }
public string CertificateOrSerialNumber { get; set; }
public string DetailUrl { get; set; }
public string DescriptionTypePdfUrl { get; set; }
public string MethodologyPdfUrl { get; set; }
}
internal sealed class ParsedInstrumentDetails
{
public string RegistryNumber { get; set; }
public string Name { get; set; }
public string TypeDesignation { get; set; }
public string Manufacturer { get; set; }
public string VerificationInterval { get; set; }
public string CertificateOrSerialNumber { get; set; }
public string AllowsBatchVerification { get; set; }
public string HasPeriodicVerification { get; set; }
public string TypeInfo { get; set; }
public string Purpose { get; set; }
public string Description { get; set; }
public string Software { get; set; }
public string MetrologicalCharacteristics { get; set; }
public string Completeness { get; set; }
public string Verification { get; set; }
public string RegulatoryDocuments { get; set; }
public string Applicant { get; set; }
public string TestCenter { get; set; }
public string DescriptionTypePdfUrl { get; set; }
public string MethodologyPdfUrl { get; set; }
}
internal sealed class SyncResult
{
public int PagesScanned { get; set; }
public int ProcessedItems { get; set; }
public int AddedRecords { get; set; }
public int UpdatedRecords { get; set; }
public int DownloadedPdfFiles { get; set; }
public int FailedPdfFiles { get; set; }
public int FailedPages { get; set; }
public int FailedItems { get; set; }
public int SkippedDetailRequests { get; set; }
}