using System;
using System.Collections.Generic;
using System.Linq;

namespace demo0411.Models;

public partial class Partner
{
    public int Id { get; set; }

    public string? Name { get; set; }

    public string? Director { get; set; }

    public string? Email { get; set; }

    public string? Phone { get; set; }

    public string? Addres { get; set; }

    public string? Inn { get; set; }

    public int? Raiting { get; set; }

    public int? PartnerTypeId { get; set; }
    public int Sale
    {
        get
        {
            switch (PartnerProducts.Select(c => c.Amount).Sum())
            {
                case < 10000:
                    return 0;
                case < 50000:
                    return 5;
                case < 300000:
                    return 10;
                case > 300000:
                    return 15;
            }
            return 0;
        }
    }
    public virtual ICollection<PartnerProduct> PartnerProducts { get; set; } = new List<PartnerProduct>();

    public virtual PartnerType? PartnerType { get; set; }
}
