91 lines
2.3 KiB
C#

using ManagerService.DTOs;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
namespace ManagerService.Data
{
/// <summary>
/// Section Information
/// </summary>
public class Section
{
[Key]
[Required]
public string Id { get; set; }
[Required]
public string Label { get; set; } // Use in manager
[Required]
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Title { get; set; }
[Column(TypeName = "jsonb")]
public List<TranslationDTO> Description { get; set; }
public int Order { get; set; }
[Required]
public string ConfigurationId { get; set; } // Parent id
public string ImageId { get; set; }
public string ImageSource { get; set; }
[Required]
public SectionType Type { get; set; }
[Required]
public bool IsSubSection { get; set; }
public string ParentId { get; set; } // only if it's an subsection
public DateTime DateCreation { get; set; }
[Required]
public string InstanceId { get; set; }
public bool IsBeacon { get; set; }
public int? BeaconId { get; set; }
public string Latitude { get; set; }
public string Longitude { get; set; }
public int? MeterZoneGPS { get; set; }
public bool IsActive { get; set; } = true;
public SectionDTO ToDTO()
{
return new SectionDTO()
{
id = Id,
label = Label,
title = Title,
description = Description,
isActive = IsActive,
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,
};
}
}
}