using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Video_Club
{
    class Movie
    {
        
        string movieName;
        int myTop = -1;
        int num = 0;
        string[] persons;
        string[] date;

        public void setSize(int size)
        {
            num = size; //manzoor az size tedade noskhe has !
            myTop = -1;
            persons = new string[size]; //'size' ta moteqayere 'persons' besaz
            date = new string[size]; //'size' ta moteqayere 'date' besaz
        } // moshakhas kardane tedad noskhe haye film
        bool zeroSize() //age tedade noskhe ha 0 bood
        {
            if (num == 0)
                return true;
            else
                return false;
        }

        bool empty()
        {
            if (myTop == -1)
                return true;
            else
                return false;
        } 

        bool full()
        {
            if (myTop == num-1)
                return true;
            else
                return false;
        }

        public void setName(string name)
        {
            movieName = name;
        }

        public string print()
        {
            string whatWillReturn; //chizi ke qarare print beshe !
            if (!empty()) //age poshte khali nabood
            {
                whatWillReturn = "\r\n" + movieName + "\r\n"; //to chizi ke qarare print beshe ye Enter bezan esme filmo bezan bad dobare ye Enter bezan

                for (int a = 0; a <= myTop; a++) 
                {
                    whatWillReturn += "No." + (a + 1).ToString() + " Person : " + persons[a] + ". Date : " + date[a] + "\r\n";
                    // be chizi ke qarare print beshe ina ro ezafe kon "No.shomareFilm Person : farde[a]. Date : " tarikhe[a] bad Enter bezan
                }
            }
            else //age khali bood poshtamoon !
            {
                whatWillReturn = "\r\n***Movie " + movieName + " stack is empty." + (myTop + 1).ToString() + "/" + num + ".***\r\n";
            }
            return whatWillReturn;
        }

        public string push(string person,string date)
        {
            if (!zeroSize()) //age tedad noskhe ha 0 nabood !
            {
                if (!full()) //age poshte por nabood !
                {
                    myTop++; // be poshte yeki ezafe kon
                    persons[myTop] = person;
                    this.date[myTop] = date;

                    return "\r\nMovie " + movieName + " Pushed ! " + (myTop + 1).ToString() + "/" + num + ".\r\n";
                }
                else
                    return "\r\n***Movie " + movieName + " stack is Full." + (myTop + 1).ToString() + "/" + num + ".***\r\n";
            }
            else
                return "\r\n***Stack Size is 0 ! Please set a stack size.*** \r\n";

        }

        public string pop()
        {
            if (!zeroSize())
            {
                if (!empty())
                {
                    string tmp = "\r\nMovie " + movieName + " Poped!.\r\nNumber : " + (myTop+1).ToString() + "\r\nPerson : " + persons[myTop] + ".\r\nDate : " + date[myTop] + ".\r\n" + (myTop + 1).ToString() + "/" + num + ".\r\n";
                    myTop--;
                    return tmp;
                }
                else
                    return "\r\n***Movie " + movieName + " stack is empty." + (myTop + 1).ToString() + "/" + num + ".***\r\n";
            }
            else
                return "\r\n***Stack Size is 0 ! Please set a stack size.*** \r\n";
        }

        public string top()
        {
            if (!zeroSize())
            {
                if (!empty())
                    return "\r\nMovie " + movieName + " Top is :\r\nNumber : " + (myTop+1).ToString() + "\r\nPerson : " + persons[myTop] + ".\r\nDate : " + date[myTop] + "\r\n";
                else
                    return "\r\n***Movie " + movieName + " stack is empty." + (myTop+1).ToString() + "/" + num + ".***\r\n";
            }
            else
                return "\r\n***Stack Size is 0 ! Please set a stack size.*** \r\n";
        }
    }
}
