using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using taloyhtio.idp.parser.common.domain;
namespace taloyhtio.idp.parser.common.model
{
[Table("mdbFlats")]
public class Flat : Entity, IAggregateRoot
{
public Flat() { }
///
/// i.e.
/// Church street 4 A 1 (usually high-rise has this form)
/// Church street 4 A(usually terraced house has this form, letter actually points to a flat)
/// NOTE: flat titles which are loaded to AzureDB table should be the same as used in PMS
///
public string FlatTitle { get; set; }
///
/// Parent Condo of the flat in the same format as returned from PMS
///
public string CondoPMS { get; set; }
///
/// Taloyhtio PMC Id of condo to which current flat belongs to
///
public Guid PMCTaloyhtioId { get; set; }
public List Users { get; private set; } = new List();
///
///Depending on actual method which will be used for loading flats to AzureDB (see below) there also may be information about users which live in each flat
///
public string FlatUsers
{
get { return Users == null || !Users.Any() ? null : JsonConvert.SerializeObject(Users); }
set
{
try
{
Users = JsonConvert.DeserializeObject>(value);
}
catch (Exception)
{
Users = new List();
}
}
}
}
}