using System.Text.Json; namespace Tnsu.ApprovalRoute.Application.Reports; /// /// Строка списка «Прием на работу — данные» в том объёме, в каком она нужна отчёту: /// на какую заявку на подбор ссылается, кого и когда приняли. /// internal sealed record HireLinkRow( int SelectionRequestId, string? SelectionRequestListId, string Status, string? CandidateName, string? ReplacedEmployee, DateOnly? HireDate) { public const string Select = "$select=Id,RequestStatus,SelectionRequestId,SelectionRequestListId," + "CandidateName,ReplacedEmployee,HireDate&$top=5000"; /// Заявка на приём без ссылки на подбор отчёту бесполезна — её отбрасываем. public static HireLinkRow? TryParse(JsonElement item) { var selectionId = SharePointJson.Int(item, "SelectionRequestId"); if (selectionId is null or <= 0) return null; return new HireLinkRow( selectionId.Value, SharePointJson.String(item, "SelectionRequestListId"), SharePointJson.String(item, "RequestStatus") ?? string.Empty, SharePointJson.String(item, "CandidateName"), SharePointJson.String(item, "ReplacedEmployee"), SharePointJson.Date(item, "HireDate")); } }