using Manager.DTOs; using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Linq; using static ManagerService.Data.SectionText; namespace ManagerService.Data.SubSection { /// /// Section video /// public class SectionVideo : Section { [Required] public string VideoSource { get; set; } // url to resource id (local) or on internet public override string GetEmbeddableText(string language) => BaseText(language); // VideoSource porte soit un id de ressource uploadée, soit une URL YouTube/Vimeo — // seule la première est téléchargeable hors ligne. public override IEnumerable GetReferencedResourceIds(string language = null) => BaseResourceIds() .Concat(VideoSource != null && VideoSource.StartsWith("http", StringComparison.OrdinalIgnoreCase) ? Enumerable.Empty() : ResourceId(VideoSource)); public VideoDTO ToDTO() { return new VideoDTO() { 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, source = VideoSource }; } } }