using Bp.Sync.Domain.Elastics.BaseEntities;
using System;
using System.ComponentModel.DataAnnotations;

namespace Bp.Sync.Domain.Elastics.FcBusinesses.Products
{
    public class FcProductOutboundElastic : ElasticBaseEntityWithKey<long>
    {
        public string InventoryCode { get; set; }

        public string ProductName { get; set; }

        public string ProductCode { get; set; }

        public long ProductStorageId { get; set; }
        public int OutboundBaseUnitId { get; set; }
        public long ProductId { get; set; }
        public long BillId { get; set; }
        public long ShipmentId { get; set; }
        public long PositionId { get; set; }
        public decimal OutboundBaseUnitQuantity { get; set; }
        public int BranchId { get; set; }
        public decimal OutboundQuantity { get; set; }
        public int OutboundUnitId { get; set; }

        [MaxLength(256)]
        public string OutboundUnitName { get; set; }

        public decimal OutboundCost { get; set; }
        public decimal OutboundBaseUnitCost { get; set; }
        public decimal OutboundTotalCost { get; set; }
        public decimal OutboundPrice { get; set; }
        public decimal OutboundBaseUnitPrice { get; set; }
        public decimal OutboundTotalPrice { get; set; }
        public float OutboundDiscount { get; set; }
        public float OutboundTax { get; set; }
        public int NumberOfEdit { get; set; }

        /// <summary>
        /// Lí do trả hàng về kho tổng
        /// Bắt buộc có trước khi submit phiếu
        /// </summary>
        public int? ReasonReturnId { get; set; }

        [MaxLength(1024)]
        public string ReasonReturnName { get; set; }

        [MaxLength(1024)]
        public string OutboundNote { get; set; }

        public ProductInventoryStatus? OutboundStatus { get; set; }
        public decimal WarehouseBaseUnitQuantity { get; set; }
        public decimal WarehouseQuantity { get; set; }

        //them vao

        //Lợi nhuận dự kiến
        public decimal OutboundRevenue => OutboundTotalPrice - OutboundTotalCost;

        //them vao bao cao
        public Entities.FcBusinesses.Bills.OutboundBillStatus? BillStatus { get; set; }

        public Entities.FcBusinesses.Bills.BillType? BillType { get; set; }
        public DateTimeOffset? BillCreatedTime { get; set; }
        public DateTimeOffset? BillCompletedDate { get; set; }
        public bool? BillIsDeleted { get; set; }
        public int? BillOriginBranchId { get; set; }
        public int? BillDestinationBranchId { get; set; }
        public int? BillPartnerId { get; set; }
    }
}