using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace FLY.Thick.FilmCasting.Server.Model
{
    /// <summary>
    /// 正在生产的数据，或之前生产完的数据
    /// </summary>
    public class LocalDb : INotifyPropertyChanged
    {
        public Db_Profile CurrProfile;

        /// <summary>
        /// 当前生产，开始产生数据时间
        /// </summary>
        public DateTime ProfileStartTime
        {
            get
            {
                if (CurrProfile == null)
                    return DateTime.MinValue;
                else
                {
                    return CurrProfile.StartTime;
                }
            }
        }

        /// <summary>
        /// 当前生产，最后产生数据时间
        /// </summary>
        public DateTime ProfileEndTime
        {
            get
            {
                if (CurrProfile == null)
                    return DateTime.MinValue;
                else
                {
                    return CurrProfile.EndTime;
                }
            }
        }

        /// <summary>
        /// 当前生产，已经结束，已经下辊了
        /// </summary>
        public bool IsProfileFinished 
        {
            get {
                if (CurrProfile == null)
                    return true;
                else {
                    return CurrProfile.IsFinished;
                }
            }
        }


        public void NotifyPropertyChanged(string propertyName) {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
        }
        public event PropertyChangedEventHandler PropertyChanged;
    }
}
