from PySide6.QtWidgets import QWidget, QLabel
from PySide6.QtGui import QPixmap
from typing import final

@final
class Movie:
    """
    Describes a movie which will be displayed in the GUI.
    Usage:
        Movie("Movie name", <Movie price>, "Path to movie cover image")
    """
    def __init__(self, name: str, price: float, image_path: str, description: str):
        self.name = name
        self.price = price
        self.image_path = image_path
        self.description = description

    def __repr__(self):
        return f"Movie(name={self.name}, price={self.price}, image_path={self.image_path}, description={self.description})"
        
def createImage(filename: str) -> QLabel:
    """
    Creates an image (in form of a QLabel) from a provided filename.
    The filename must be a path to the image file.
    It does not have to be an absolute path.
    """
    label = QLabel()    
    pixmap = QPixmap(filename)
    label.setPixmap(pixmap.scaled(300, 450))
    return label

"""
Dictionary mapping strings (movie ID's) to Movie() objects.
"""
movies = {
    "spiderman": Movie("Spider-Man: Very far from home", 39.95, "resources/spiderman.png", "🕷️ Sure! Here’s a fun and engaging description for the movie Spider-Man: Very Far From Home! 🌍✨\n\nIn Spider-Man: Very Far From Home, everyone’s favorite web-slinging hero, Spider-Man, embarks on his most distant adventure yet! 🚀🌎 After the events that shook the world in Spider-Man: Far From Home and the multiversal chaos of Spider-Man: No Way Home, Peter Parker must once again step up to protect the planet—and possibly the universe. 😱🕸️\n\nThis time, the friendly neighborhood hero isn’t just far from home… he’s VERY far from home! 🌌 When a mysterious cosmic anomaly opens portals across space, Peter Parker finds himself traveling to strange new worlds, meeting unexpected allies, and facing villains unlike anything he’s ever encountered before. 👾⚡\n\nAlong the way, Peter must balance being a teenage hero with the enormous responsibility of saving reality itself. With humor, heart, and plenty of high-flying web action, the film explores what it truly means to be a hero when home is millions of miles away. 💫\n\nFeaturing thrilling battles, emotional moments, and surprising cameos from across the Marvel Cinematic Universe, Spider-Man: Very Far From Home is an epic adventure packed with action, friendship, and lots of spectacular web-slinging! 🕷️🎥🍿\n\nWill Spider-Man find his way back home… or is this one trip that might take him farther than ever before? 🤔🌠\n\nIf you want, I can make it even more action packed, or talk about a new villain (maybe The Viper?)"),
    "cars2": Movie("Cars 2", 79.95, "resources/cars2.png", "Cars 2 is a 2011 American animated comedy film[3] produced by Pixar Animation Studios for Walt Disney Pictures. It is the sequel to Cars (2006) and the second film in the Cars franchise. The film was directed by John Lasseter, and written by Ben Queen, Lasseter, Brad Lewis, and Dan Fogelman. Owen Wilson, Larry the Cable Guy, Tony Shalhoub, Guido Quaroni, Bonnie Hunt, and John Ratzenberger reprise their roles from the first film, with Michael Caine, Emily Mortimer, John Turturro and Eddie Izzard joining the voice cast. In the film, Mater (Cable Guy) unintentionally gets caught up in a risky espionage mission that threatens both his and Lightning McQueen's (Wilson) lives during the World Grand Prix, an international racing event showcasing a new alternative fuel called Allinol.\n\nA sequel to Cars was first announced in April 2008 with a tentative summer 2012 release date, which was later moved up to the summer of 2011.[4] Lasseter was confirmed to be returning as director, while Lewis was designated as co-director in June 2010. The film's story was conceived by Lasseter while he was traveling around the world promoting the first film. Michael Giacchino composed the film's score, with artists such as Weezer, Robbie Williams, Brad Paisley and Bénabar contributing tracks for the film. This was the final Pixar film animated using its old software system, Marionette, before being officially replaced with Presto in 2012. With an estimated budget of $200 million, Cars 2 is one of the most expensive films ever made.\n\nCars 2 premiered at the El Capitan Theatre in Los Angeles on June 18, 2011, and was released in the United States on June 24, in Disney Digital 3D and IMAX 3D as well as traditional two-dimensional and IMAX formats. It received mixed reviews from critics, and grossed over $559 million worldwide, becoming the tenth-highest-grossing film of 2011 and the highest-grossing film of the Cars franchise. The film was nominated for Best Animated Feature Film at the 69th Golden Globe Awards, but lost to The Adventures of Tintin. A sequel, Cars 3, was released on June 16, 2017. "),
    "leo": Movie("The Nerd Movie", -189.95, "resources/leo.png", "Did you know that the quadratic formula is negative b plus or minus square root of b squared minus 4 a c all divided by 2 a"),
    "hairypotty": Movie("Harry Potter and the Deathly Weapons", 447.95, "resources/hairypotty.png", "Dobby's got a glock")
}
