# -*- coding:utf-8 -*-

__projet__ = "Corrections"
__nom_fichier__ = "tirage"
__author__ = "Christine Fay-Varnier"
__date__ = "avril 2023"

from photo import Photo
from photoNumerique import PhotoNumerique
from photoTraditionnelle import PhotoTraditionnelle
from date import Date

class Tirage:
    """ modélise les tirages photos """

    def __init__(self, photo, largeur, hauteur):
        self.photo_ = photo
        self.largeur_ = largeur
        self.hauteur_ = hauteur
        
    def qualite(self):
        """

        :return: calcule la resolution à choisir pour obtenir la dimension souhaite
                 Excellent > 300dpi
                 Correct > 200dpi
                 Déconseillé < 200dpi
        """

        resolution = self.photo_.nbpixelsL_ / self.largeur_
        resolution = resolution * 2.54
        
        if resolution > 300:
            return "Excellent"

        elif resolution > 200:
            return "Correct"

        return "Déconseillé"

if __name__ == '__main__':
    date = Date(13, 2, 2022)
    photo = Photo("Toto", date, 3872, 2592, ["paysage", "montagne", "neige", "ski"])
    tirage = Tirage(photo, 13, 10)
    print(tirage.qualite())

    tirage = Tirage(photo, 18, 13)
    print(tirage.qualite())

    date = Date(13, 2, 2022)
    photo = PhotoNumerique("Alfred", date, 1536, ["paysage", "montagne", "neige", "ski"])
    tirage = Tirage(photo, 13, 10)
    print(tirage.qualite())
    tirage = Tirage(photo, 18, 13)
    print(tirage.qualite())

    date = Date(13, 2, 2022)
    photo = PhotoTraditionnelle("Alfred", date, 400, ["paysage", "montagne", "neige", "ski"])
    tirage = Tirage(photo, 113, 15)
    print(tirage.qualite())
    tirage = Tirage(photo, 18, 13)
