using Manager.DTOs;
using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using static ManagerService.Data.SectionText;
namespace ManagerService.Data.SubSection
{
///
/// Section weather
///
public class SectionWeather : Section
{
public string WeatherCity { get; set; } // Weather City
public DateTimeOffset? WeatherUpdatedDate { get; set; } // Weather date update (to only refresh)
public string WeatherResult { get; set; } // Weather result
// WeatherResult est un instantané réécrit à chaque rafraîchissement : l'indexer
// ferait re-calculer les embeddings en boucle pour une météo déjà périmée.
public override string GetEmbeddableText(string language) =>
JoinText(BaseText(language), WeatherCity);
public override IEnumerable GetReferencedResourceIds(string language = null) => BaseResourceIds();
public WeatherDTO ToDTO()
{
return new WeatherDTO()
{
id = Id,
label = Label,
title = Title.ToList(),
description = Description.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,
city = WeatherCity,
updatedDate = WeatherUpdatedDate,
result = WeatherResult,
};
}
}
}