/***************************************************************************
 *   Copyright (c) 2009  Peter Mylemans <peter.mylemans@gmail.com>         *
 *                                                                         *
 *   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 2 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, write to the                         *
 *   Free Software Foundation, Inc.,                                       *
 *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.         *
 ***************************************************************************/

#include "Movie.h"

/*!
    \class Movie

    The Movie class is a data model for movies.
*/

QString Movie::genreString(Movie::Genre genre)
{
    switch (genre)
    {
        case Action:
            return "Action";
        case Fantasy:
            return "Fantasy";
        case Sci_Fi:
            return "Sci-Fi";
        case Thriller:
            return "Thriller";
    }
}

Movie::Movie()
    : m_year(0), m_rating(0)
{
}

const QString Movie::modelId() const
{
    return "falkor-movie";
}

const QString& Movie::title() const
{
    return m_title;
}

void Movie::setTitle(const QString &title)
{
    m_title = title;
}

const QString& Movie::tagline() const
{
    return m_tagline;
}

void Movie::setTagline(const QString &tagline)
{
    m_tagline = tagline;
}

quint16 Movie::year() const
{
    return m_year;
}

void Movie::setYear(quint16 year)
{
    m_year = year;
}

const QString& Movie::plot() const
{
    return m_plot;
}

void Movie::setPlot(const QString &plot)
{
    m_plot = plot;
}

const QPixmap& Movie::poster() const
{
    return m_poster;
}

void Movie::setPoster(const QPixmap &poster)
{
    m_poster = poster;
}

const QSet<Movie::Genre>& Movie::genres() const
{
    return m_genres;
}

void Movie::setGenres(const QSet<Movie::Genre> &genres)
{
    m_genres = genres;
}

int Movie::runtime() const
{
    return m_runtime;
}

void Movie::setRuntime(int runtime)
{
    m_runtime = runtime;
}

/*!
    Returns the rating of this movie. This is a number from 0 to 100.
*/
int Movie::rating() const
{
    return m_rating;
}

/*!
    Set rating of this movie. This must be a number from 0 to 100.
*/
void Movie::setRating(int rating)
{
    m_rating = rating;
}

const QList<Movie::ActorRole>& Movie::actors() const
{
    return m_actors;
}

void Movie::addActor(const Movie::ActorRole &actorRole)
{
    m_actors.append(actorRole);
}
