using GTANetworkAPI;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Text;

namespace ReallifeGamemode.Server.Entities
{
    public class Interior
    {
        [NotMapped]
        private Vector3 _enterPosition;
        [NotMapped]
        private Vector3 _exitPosition;

        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int Id { get; set; }
        public string Name { get; set; }

        [Column("EnterPosition")]
        public string EnterPositionStr
        {
            get
            {
                return JsonConvert.SerializeObject(this._enterPosition);
            }
            set
            {
                this._enterPosition = JsonConvert.DeserializeObject<Vector3>(value);
            }
        }

        [Column("ExitPosition")]
        public string ExitPositionStr
        {
            get
            {
                return JsonConvert.SerializeObject(this._exitPosition);
            }
            set
            {
                this._exitPosition = JsonConvert.DeserializeObject<Vector3>(value);
            }
        }

        [NotMapped]
        public Vector3 EnterPosition
        {
            get
            {
                return this._enterPosition;
            }
            set
            {
                this._enterPosition = value;
            }
        }

        [NotMapped]
        public Vector3 ExitPosition
        {
            get
            {
                return this._exitPosition;
            }
            set
            {
                this._exitPosition = value;
            }
        }
    }
}
