2025-03-19 08:57:29 +01:00

113 lines
3.5 KiB
C#

using Manager.DTOs;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
namespace ManagerService.Data.SubSection
{
/// <summary>
/// Section map
/// </summary>
public class SectionMap : Section
{
public int Zoom { get; set; } // Default = 18
public MapTypeApp? MapType { get; set; } // Default = Hybrid for Google
public MapTypeMapBox? MapTypeMapbox { get; set; } // Default = standard for MapBox
public MapProvider? MapProvider { get; set; } // Default = Google
public List<GeoPoint> Points { get; set; }
public string ResourceId { get; set; }
public Resource Resource { get; set; } // Icon
public List<Categorie> Categories { get; set; }
public string CenterLatitude { get; set; } // Center on
public string CenterLongitude { get; set; } // Center on
public MapDTO ToDTO()
{
return new MapDTO()
{
id = Id,
label = Label,
title = Title.OrderBy(t => t.Language).Select(l => l.ToDTO()).ToList(),
description = Description.OrderBy(d => d.Language).Select(l => l.ToDTO()).ToList(),
order = Order,
type = Type,
imageId = ImageId,
imageSource = ImageSource,
configurationId = ConfigurationId,
isSubSection = IsSubSection,
parentId = ParentId,
dateCreation = DateCreation,
instanceId = InstanceId,
isBeacon = IsBeacon,
beaconId = BeaconId,
latitude = Latitude,
longitude = Longitude,
meterZoneGPS = MeterZoneGPS,
zoom = Zoom,
mapType = MapType,
mapTypeMapbox = MapTypeMapbox,
mapProvider = MapProvider,
//points = Points.Select(p => p.ToDTO()).ToList(), // TODO
iconResourceId = ResourceId,
categories = Categories.Select(c => c.ToDTO()).ToList(),
centerLatitude = CenterLatitude,
centerLongitude = CenterLongitude
};
}
}
public class GeoPoint
{
[Required]
public int? Id { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Title { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<Translation> Description { get; set; }
//TODO
[Required]
[Column(TypeName = "jsonb")]
public List<Resource> Contents { get; set; } // Contentsgeopoint
public int? CategorieId { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public string ImageResourceId { get; set; }
public string ImageUrl { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Schedules { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Prices { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Phone { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Email { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Site { get; set; }
}
}