39 lines
1.6 KiB
C#
39 lines
1.6 KiB
C#
using UniVerse.Application.DTOs.Sync;
|
|
using System.Text.Json.Serialization;
|
|
|
|
namespace UniVerse.Application.Interfaces;
|
|
|
|
public interface IScheduleSyncService
|
|
{
|
|
Task<SyncResultDto> SyncScheduleAsync(SyncScheduleRequest request);
|
|
Task<SyncResultDto> SyncRoomsAsync();
|
|
Task<List<EmployeeDto>> SearchEmployeesAsync(string fullname);
|
|
Task<SyncStatusDto> GetLastSyncStatusAsync();
|
|
}
|
|
|
|
public interface IModeusApiClient
|
|
{
|
|
Task<ModeusEventsResponse> SearchEventsAsync(SyncScheduleRequest request);
|
|
Task<ModeusRoomsResponse> SearchRoomsAsync();
|
|
Task<List<ModeusEmployee>> SearchEmployeeAsync(string fullname);
|
|
}
|
|
|
|
// Modeus API response models
|
|
public record ModeusEvent(string Id, string Name, DateTime StartsAt, DateTime EndsAt, string? RoomId, string? TeacherId, string? TypeId);
|
|
public record ModeusEventsResponse(List<ModeusEvent> Events);
|
|
public record ModeusBuilding(string? Id, string? Name, string? NameShort, string? Address);
|
|
public record ModeusRoom(string Id, string Name, string? NameShort, ModeusBuilding? Building, int? TotalCapacity, int? WorkingCapacity);
|
|
public record ModeusRoomsEmbedded(List<ModeusRoom>? Rooms);
|
|
public record ModeusPage(int Size, int TotalElements, int TotalPages, int Number);
|
|
public class ModeusRoomsResponse
|
|
{
|
|
[JsonPropertyName("_embedded")]
|
|
public ModeusRoomsEmbedded? Embedded { get; init; }
|
|
public ModeusPage? Page { get; init; }
|
|
public List<ModeusRoom>? Rooms { get; init; }
|
|
|
|
[JsonIgnore]
|
|
public IReadOnlyList<ModeusRoom> RoomItems => Embedded?.Rooms ?? Rooms ?? [];
|
|
}
|
|
public record ModeusEmployee(string? Id, string FullName, string? Department);
|