using Knoks.Core.Entities.Interfaces;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Text;

namespace Knoks.Core.Entities
{
    public class Knok: IApiResult
    {
        public const string KnokUidKey = "hjrthjrthjyjhyy";
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public long? KnokId { get; set; }
        [JsonConverter(typeof(UidConverter), KnokUidKey, typeof(Knok))]
        public string KnokUid { get { return KnokId.ToString(); } set { KnokId = (value == null ? null : (long?)Int64.Parse(value)); } }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public long? CreatorUserId { get; set; }
        public string Currency1 { get; set; }
        public string Currency2 { get; set; }
        public string Currency { get; set; }
        public short ExchangeId { get; set; }
        [JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
        public int? TickerId { get; set; }
        public decimal EntryPriceFrom { get; set; }
        public decimal EntryPriceTo { get; set; }
        public decimal ExitPriceFrom { get; set; }
        public decimal ExitPriceTo { get; set; }
        public decimal StopLoss { get; set; }
        public int Duration { get; set; }
        public decimal PotentialProfitValue { get; set; }
        public PotentialProfit PotentialProfit { get; set; }
        public decimal CurrentProfitPercent { get; set; }
        [JsonIgnoreAttribute]
        public decimal? PrevPrice { get; set; }
        public bool HasTechnical { get; set; }
        public bool HasFundamental { get; set; }
        public KnokAnalysis Technical { get; set; }
        public KnokAnalysis Fundamental { get; set; }
        public DateTime? CreateDate { get; set; }
        public DateTime? PublishedDate { get; set; }
        public DateTime? SellFinishDate { get; set; }
        public int? KnokStatusId { get; set; }
        public string  ExchangeName { get; set; }
        public decimal? CurrentPrice { get; set; }
        public DateTime?  BuyDate { get; set; }
        public bool EntryPriceTouched { get; set; }
        public bool ExitPriceTouched { get; set; }
        public bool StopLossTouched { get; set; }
        public decimal? CloseRate { get; set; }
        public decimal HighRate { get; set; }
        public decimal LowRate { get; set; }
        public decimal? Price { get; set; }
        public short Precision { get; set; }
        public short RatesGranularityHours { get; set; }
        public decimal? DistanceFromTarget { get; set; }
        public int Purchases { get; set; }
        public KnokEndedStatus EndedStatus { get; set; }
        public decimal PricePool
        {
            get
            {
                return this.PricePoolData.HasValue ? this.PricePoolData.Value * Constants.knokserCommission : 0;
            }
            set { }
        }
        [JsonIgnore]
        public decimal? PricePoolData { get; set; }
        public decimal UserReview { get; set; }
        public decimal? UserReviewClarity { get; set; }
        public decimal? UserReviewUsefulness { get; set; }
        public decimal? UserReviewProfitability { get; set; }
        public int BuyerReviews { get; set; }
        public int MinutesLeftOnFeed { get; set; }
    }
}
