using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using BankTV.Logger;
using BankTV.Helpers;
using System.IO;

namespace BankTV.Model
{
    public class Screen : AbstractModel
    {
        public int Id { get; set; }
        public ScreenType Type { get; set; }
        public string Abbr { get; set; }
        public string Title { get; set; }
        public string Content { get; set; }
        public string FileName { get; set; }
        public decimal Ordering { get; set; }

        public enum ScreenType
        {
            MV,
            IMG,
            NEWS,
            PD,
            SWF,
            UNKNOWN
        };

        public string GetFilePath()
        {
            if (this.Abbr == null)
            {
                return String.Empty;
            }   //if
            if (String.IsNullOrEmpty(this.FileName))
            {
                return String.Empty;
            }   //if
            switch (this.Type)
            {
                case ScreenType.IMG:
                    string imageDir = GlobalHelper.GetImagesFolder();
                    if (String.IsNullOrEmpty(imageDir))
                    {
                        return String.Empty;                            
                    }   //if
                    return Path.Combine(imageDir, this.FileName);
                case ScreenType.MV:
                    string videoDir = GlobalHelper.GetVideosFolder();
                    if (String.IsNullOrEmpty(videoDir))
                    {
                        return String.Empty;
                    }   //if
                    return Path.Combine(videoDir, this.FileName);
                case ScreenType.SWF:
                    string flashDir = GlobalHelper.GetFlashFolder();
                    if (String.IsNullOrEmpty(flashDir))
                    {
                        return String.Empty;
                    }   //if
                    return Path.Combine(flashDir, this.FileName);
                case ScreenType.NEWS:
                    string newsDir = GlobalHelper.GetNewsFolder();
                    if (String.IsNullOrEmpty(newsDir))
                    {
                        return String.Empty;
                    }   //if
                    return Path.Combine(newsDir, this.FileName);
                case ScreenType.PD:
                    return String.Empty;
                default:
                    return String.Empty;
            }   //switch
        }        

    }
}
