| | 1 | | using System.ComponentModel.DataAnnotations; |
| | 2 | | using LGDXRobotCloud.Data.Models.Business.Navigation; |
| | 3 | | using LGDXRobotCloud.Utilities.Constants; |
| | 4 | |
|
| | 5 | | namespace LGDXRobotCloud.Data.Models.DTOs.V1.Commands; |
| | 6 | |
|
| | 7 | | public record RealmCreateDto |
| | 8 | | { |
| | 9 | | [MaxLength(50)] |
| | 10 | | [Required (ErrorMessage = "Please enter a name.")] |
| 0 | 11 | | public required string Name { get; set; } |
| | 12 | |
|
| | 13 | | [MaxLength(200)] |
| 0 | 14 | | public string? Description { get; set; } |
| | 15 | |
|
| | 16 | | [Required(ErrorMessage = "Please select a traffic control type.")] |
| 0 | 17 | | public bool HasWaypointsTrafficControl { get; set; } |
| | 18 | |
|
| | 19 | | [MaxLength(LgdxApiConstants.ImageMaxSize, ErrorMessage = "The image size is too large.")] |
| 0 | 20 | | public string? Image { get; set; } |
| | 21 | |
|
| 0 | 22 | | public double Resolution { get; set; } |
| | 23 | |
|
| 0 | 24 | | public double OriginX { get; set; } |
| | 25 | |
|
| 0 | 26 | | public double OriginY { get; set; } |
| | 27 | |
|
| 0 | 28 | | public double OriginRotation { get; set; } |
| | 29 | | } |
| | 30 | |
|
| | 31 | | public static class RealmCreateDtoExtensions |
| | 32 | | { |
| | 33 | | public static RealmCreateBusinessModel ToBusinessModel(this RealmCreateDto model) |
| | 34 | | { |
| | 35 | | return new RealmCreateBusinessModel { |
| | 36 | | Name = model.Name, |
| | 37 | | Description = model.Description, |
| | 38 | | HasWaypointsTrafficControl = model.HasWaypointsTrafficControl, |
| | 39 | | Image = model.Image, |
| | 40 | | Resolution = model.Resolution, |
| | 41 | | OriginX = model.OriginX, |
| | 42 | | OriginY = model.OriginY, |
| | 43 | | OriginRotation = model.OriginRotation, |
| | 44 | | }; |
| | 45 | | } |
| | 46 | | } |