using System;

/*
    Copyright (c) 2010 flixmonk. (http://DVDSwarm.codeplex.com)
    All Rights Reserved.
        
    Redistribution and use in source and binary forms, with or without modification,
    are permitted provided that the following conditions are met:
        
    * Redistributions of source code must retain the above copyright notice, this list
      of conditions and the following disclaimer.
        
    * Redistributions in binary form must reproduce the above copyright notice, this
    list of conditions and the following disclaimer in the documentation and/or other
    materials provided with the distribution. 
        
    * Neither the name of The Flixmonk nor the names of its contributors may be used to
    endorse or promote products derived from this software without specific prior written
    permission.
        
    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
    OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
    SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
    OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
    TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
namespace DVDSwarm.Dvd
{
    /// <summary>
    /// Contains information about a program chain program. Member of the ProgramChain class.
    /// </summary>
    sealed public class Program
    {
        #region Fields

        private Int32 _cellCount = 0;
        private Boolean _checked = true;
        private SmpteTimecode _duration = new SmpteTimecode(VideoFramerate.Fps30, true);
        private Int32 _endCell = 0;
        private Int32 _id = 0;
        private Int64 _length = 0;
        private Int32 _startCell = 0;
        
        #endregion

        #region Properties

        /// <summary>
        /// Gets and sets the number of cells in the program.
        /// </summary>
        public Int32 CellCount
        {
            get
            {
                return _cellCount;
            }
            internal set
            {
                _cellCount = value;
            }
        }
        /// <summary>
        /// Gets and sets whether the program is selected.
        /// </summary>
        public Boolean Checked
        {
            get
            {
                return _checked;
            }
            set
            {
                _checked = value;
            }
        }
        /// <summary>
        /// Gets the duration for the program.
        /// </summary>
        public SmpteTimecode Duration
        {
            get
            {
                return _duration;
            }
        }
        /// <summary>
        /// Gets and sets the ending cell number for the program.
        /// </summary>
        public Int32 EndCell
        {
            get
            {
                return _endCell;
            }
            internal set
            {
                _endCell = value;
            }
        }
        /// <summary>
        /// Gets the number of frames for the program.
        /// </summary>
        public Int64 Frames
        {
            get
            {
                return _duration.TotalFrames;
            }
        }
        /// <summary>
        /// Gets the id for the program. Values start at one.
        /// </summary>
        public Int32 ID
        {
            get
            {
                return _id;
            }
        }
        /// <summary>
        /// Gets and sets the length of the program in bytes.
        /// </summary>
        public Int64 Length
        {
            get
            {
                return _length;
            }
            internal set
            {
                _length = value;
            }
        }
        /// <summary>
        /// Gets and sets the starting cell number for the program.
        /// </summary>
        public Int32 StartCell
        {
            get
            {
                return _startCell;
            }
            internal set
            {
                _startCell = value;
            }
        }

        #endregion

        #region Methods

        /// <summary>
        /// Creates a new instance of the Program class.
        /// </summary>
        /// <param name="value">The program id. The first program has an ID of one.</param>
        public Program(Int32 value)
        {
            _id = value;
        }

        #endregion
    }
}
