/* This file is part of AHD Subtitles Maker Professional
   A program can create and edit subtitles

   Copyright © Ala I Hadid 2009 - 2012

   This program is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
   the Free Software Foundation, either version 3 of the License, or
   (at your option) any later version.

   This program is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU General Public License for more details.

   You should have received a copy of the GNU General Public License
   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AHD.SM.ASMP
{
    /// <summary>
    /// AHD Subtitles Maker Project class.
    /// </summary>
    [Serializable()]
    public class Project
    {
        /* AHD Subtitles Maker Project "ASMP" version 5 */

        /// <summary>
        /// AHD Subtitles Maker Project class.
        /// </summary>
        /// <param name="name">The name of this project</param>
        public Project(string name)
        {
            this.name = name;
            this.description = "";
            this.log = "";
            this.mediaPath = "";
            this.subtitleTracks = new List<SubtitlesTrack>();
            this.timeMarks = new List<TimeMark>();
        }

        const string version = "5.0.0.0";
        string name;
        string description;
        string log;
        string mediaPath;
        List<SubtitlesTrack> subtitleTracks;
        List<TimeMark> timeMarks;

        //Properties
        /// <summary>
        /// Get or set the name of this project
        /// </summary>
        public string Name
        { get { return name; } set { name = value; } }
        /// <summary>
        /// Get or set the description of this project
        /// </summary>
        public string Description
        { get { return description; } set { description = value; } }
        /// <summary>
        /// Get or set the Log of this project
        /// </summary>
        public string Log
        { get { return log; } set { log = value; } }
        /// <summary>
        /// Get current ASMP version.
        /// </summary>
        public string Version
        { get { return version; } }
        /// <summary>
        /// Get or set the media path associated with this project
        /// </summary>
        public string MediaPath
        { get { return mediaPath; } set { mediaPath = value; } }
        /// <summary>
        /// Get or set the Subtitle Tracks collection
        /// </summary>
        public List<SubtitlesTrack> SubtitleTracks
        { get { return subtitleTracks; } set { subtitleTracks = value; } }
        /// <summary>
        /// Get or set the time marks
        /// </summary>
        public List<TimeMark> TimeMarks
        { get { return timeMarks; } set { timeMarks = value; } }
        
        /// <summary>
        /// Search Subtitle Tracks to find if givin track exists
        /// </summary>
        /// <param name="Name">Subtitles Track name to search for, not case sensitive</param>
        /// <returns>True if exists, False if not</returns>
        public bool IsSubtitlesTrackExist(string Name)
        {
            foreach (SubtitlesTrack track in subtitleTracks)
                if (track.Name.ToLower() == Name.ToLower())
                    return true;
            return false;
        }
    }
}
