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
{
///
/// Section puzzle
///
public class SectionPuzzle : Section
{
[Required]
[Column(TypeName = "jsonb")]
public List PuzzleMessageDebut { get; set; }
[Required]
[Column(TypeName = "jsonb")]
public List PuzzleMessageFin { get; set; }
public string PuzzleImageId { get; set; } // But only image is possible
public Resource PuzzleImage { get; set; } // But only image is possible
[Required]
public int PuzzleRows { get; set; } = 3;
[Required]
public int PuzzleCols { get; set; } = 3;
public PuzzleDTO ToDTO()
{
return new PuzzleDTO()
{
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,
messageDebut = PuzzleMessageDebut.Select(md => md.ToDTO()).ToList(),
messageFin = PuzzleMessageFin.Select(mf => mf.ToDTO()).ToList(),
puzzleImage = PuzzleImage.ToDTO(),
puzzleImageId = PuzzleImageId,
rows = PuzzleRows,
cols = PuzzleCols
};
}
}
}