__author__ = 'CAM'

from win32com.client import CDispatch

from IFikomObject import IFikomObject
from IDokuman import IDokuman
from IMfgProcessler import IMfgProcessler
from IPPRProductlar import IPPRProductlar


class IPPRDokuman(IDokuman):
    def __init__(self, obj:CDispatch, sahip:IFikomObject=None):
        EvalCode = """
            Dim myProcessDocument
            Set myProcessDocument = Doc

            Dim myPPRDocument As PPRDocument
            Set myPPRDocument = myProcessDocument.PPRDocument
            Set return = myPPRDocument
		"""
        # --->Mirasci Sinif
        super(IPPRDokuman, self).__init__(obj, sahip)
        self.sahip = sahip
        self.tipi = "IPPRDokuman"
        # --->Sabit Degiskenler
        self.obj = self.catNesne =  self.asType("PPRDocument").PPRDocument
        # self.catNesne = self.obj = self.anaProgram.eval(EvalCode, "Doc As Object", [self.catNesne])
        # self.catNesne = self.anaProgram.scriptCalistir("DocToPPR", [self.obj])

    @property
    def processler(self):
        return IMfgProcessler(obj=self.catNesne.Processes, sahip=self)

    @property
    def productlar(self) -> IPPRProductlar:
        return IPPRProductlar(obj=self.catNesne.Products, sahip=self)

    @property
    def kaynaklar(self) -> IPPRProductlar:
        return IPPRProductlar(obj=self.catNesne.Resources, sahip=self)