|  |  | 1 |  | using LGDXRobotCloud.API.Authorisation; | 
|  |  | 2 |  | using LGDXRobotCloud.API.Services.Navigation; | 
|  |  | 3 |  | using LGDXRobotCloud.Data.Models.Business.Navigation; | 
|  |  | 4 |  | using LGDXRobotCloud.Data.Models.DTOs.V1.Commands; | 
|  |  | 5 |  | using LGDXRobotCloud.Data.Models.DTOs.V1.Responses; | 
|  |  | 6 |  | using LGDXRobotCloud.Utilities.Constants; | 
|  |  | 7 |  | using Microsoft.AspNetCore.Authentication.JwtBearer; | 
|  |  | 8 |  | using Microsoft.AspNetCore.Authorization; | 
|  |  | 9 |  | using Microsoft.AspNetCore.Mvc; | 
|  |  | 10 |  |  | 
|  |  | 11 |  | namespace LGDXRobotCloud.API.Areas.Navigation.Controllers; | 
|  |  | 12 |  |  | 
|  |  | 13 |  | [ApiController] | 
|  |  | 14 |  | [Area("Navigation")] | 
|  |  | 15 |  | [Route("[area]/[controller]")] | 
|  |  | 16 |  | [Authorize(AuthenticationSchemes = LgdxRobotCloudAuthenticationSchemes.ApiKeyOrCertificateScheme)] | 
|  |  | 17 |  | [Authorize(AuthenticationSchemes = JwtBearerDefaults.AuthenticationScheme)] | 
|  |  | 18 |  | [ValidateLgdxUserAccess] | 
|  | 0 | 19 |  | public class MapEditorController( | 
|  | 0 | 20 |  |     IMapEditorService mapEditService | 
|  | 0 | 21 |  |   ) : ControllerBase | 
|  |  | 22 |  | { | 
|  | 0 | 23 |  |   private readonly IMapEditorService _mapEditService = mapEditService ?? throw new ArgumentNullException(nameof(mapEditS | 
|  |  | 24 |  |  | 
|  |  | 25 |  |   [HttpGet("{realmId}")] | 
|  |  | 26 |  |   [ProducesResponseType(typeof(MapEditorDto), StatusCodes.Status200OK)] | 
|  |  | 27 |  |   [ProducesResponseType(StatusCodes.Status404NotFound)] | 
|  |  | 28 |  |   public async Task<ActionResult<MapEditorDto>> GetMap(int realmId) | 
|  | 0 | 29 |  |   { | 
|  | 0 | 30 |  |     var mapEdit = await _mapEditService.GetMapAsync(realmId); | 
|  | 0 | 31 |  |     return Ok(mapEdit.ToDto()); | 
|  | 0 | 32 |  |   } | 
|  |  | 33 |  |  | 
|  |  | 34 |  |   [HttpPost("{realmId}")] | 
|  |  | 35 |  |   [ProducesResponseType(StatusCodes.Status204NoContent)] | 
|  |  | 36 |  |   [ProducesResponseType(StatusCodes.Status404NotFound)] | 
|  |  | 37 |  |   public async Task<ActionResult> UpdateMap(int realmId, MapEditorUpdateDto mapEditUpdateDto) | 
|  | 0 | 38 |  |   { | 
|  | 0 | 39 |  |     if (!await _mapEditService.UpdateMapAsync(realmId, mapEditUpdateDto.ToBusinessModel())) | 
|  | 0 | 40 |  |     { | 
|  | 0 | 41 |  |       return NotFound(); | 
|  |  | 42 |  |     } | 
|  | 0 | 43 |  |     return NoContent(); | 
|  | 0 | 44 |  |   } | 
|  |  | 45 |  | } |