//------------------------------------------------------------------------------
// <auto-generated>
//    This code was generated from a template.
//
//    Manual changes to this file may cause unexpected behavior in your application.
//    Manual changes to this file will be overwritten if the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------

using System.Linq;

namespace GM.DataAccess.Entities
{
    using System;
    using System.Collections.Generic;
    
    public partial class Users1
    {
        public Users1()
        {
            this.CartItems = new HashSet<CartItems>();
            this.Rewards = new HashSet<Rewards>();
            this.Transactions = new HashSet<Transactions>();
            this.Uploads = new HashSet<Uploads>();
            this.Vouchers = new HashSet<Vouchers>();
        }
    
        public System.Guid Id { get; set; }
        public string FirstName { get; set; }
        public string LastName { get; set; }
        public string PhoneNumber { get; set; }
        public bool SendEmailOffers { get; set; }
        public bool SendEmailUpdates { get; set; }
        public int Address_Id { get; set; }
        public bool IsFBAccount { get; set; }
        public Nullable<long> FBUserId { get; set; }
        public bool IsAdditionalAccountHolder { get; set; }
        public string Sex { get; set; }
        public Nullable<System.DateTime> DateOfBirth { get; set; }
        public Nullable<int> PhotoID { get; set; }
        public bool PushNotifications { get; set; }
        public int Instance_Id { get; set; }
        public string BusinessName { get; set; }
        public string BusinessNumberABN { get; set; }
        public string BusinessType { get; set; }
        public string BussinesWebSite { get; set; }
        public string BussinesEmail { get; set; }
        public string BussinesPhone { get; set; }
        public string BussinesPhoneArea { get; set; }
        public string BussinesPhoneMobile { get; set; }
        public string BussinesLocation { get; set; }
        public Nullable<bool> EmailBussinesOnVoucherRedeem { get; set; }
        public Nullable<bool> PostToFacebook { get; set; }
        public string EmploymentType { get; set; }
    
        public virtual Users Users { get; set; }
        public virtual Addresses Addresses { get; set; }
        public virtual ICollection<CartItems> CartItems { get; set; }
        public virtual Instance Instance { get; set; }
        public virtual ICollection<Rewards> Rewards { get; set; }
        public virtual ICollection<Transactions> Transactions { get; set; }
        public virtual ICollection<Uploads> Uploads { get; set; }
        public virtual Uploads Uploads1 { get; set; }
        public virtual ICollection<Vouchers> Vouchers { get; set; }




        /// <summary>
        /// Total sum of the cost of the items in this user's cart
        /// </summary>
        public long CartTotal
        {
            get { return CartItems.Sum(i => i.Cost); }
        }

        ///// <summary>
        ///// Total cost of this item. That is, the reward price times the number of it.
        ///// </summary>
        //public long Cost
        //{
        //    get { return Rewards.Price * Quantity; }
        //}

        /// <summary>
        /// Total amount of points this user has left to spend, ie. PointsTotal - CartTotal
        /// </summary>
        public long PointsAvailable
        {
            get { return PointsTotal - CartTotal; }
        }

        /// <summary>
        /// Total amount of points this user has access to
        /// </summary>
        public long PointsTotal
        {
            get { return Addresses.Points; }
        }
    }
}
