from IFikomObject import IFikomObject

class ISistemKonfigurasyonu(IFikomObject):
    def __init__(self, obj=None, sahip=None):
        super(ISistemKonfigurasyonu, self).__init__(obj, sahip)
        # ---> Standart Degiskenler
        self.sahip = self
        self.tipi = "ISistemKonfigurasyonu"
        self.parent = obj
        self.anaProgram = sahip

    @property
    def isletimSistemi(self)->str:
        return self.catNesne.OperatingSystem

    @property
    def urunSayisi(self)->int:
        return self.catNesne.ProductCount

    @property
    def versiyon(self)->int:
        return self.catNesne.Version

    @property
    def servisPaketi(self)->int:
        return self.catNesne.ServicePack

    @property
    def surum(self)->int:
        return self.catNesne.Release

    @property
    def urunListesi(self):
        EvalCode = """
            Dim SystemConfiguration1
            Set SystemConfiguration1 = Catia.SystemConfiguration
            ReDim NameArray(SystemConfiguration1.ProductCount-1)
            SystemConfiguration1.GetProductNames(NameArray)
            return = NameArray
        """
        rslt = self.anaProgram.eval(EvalCode , "Catia" , [self.sahip.anaProgram.catNesne])
        return rslt

    def urunLisanslimi(self, urun:str)->bool:
        return True if urun in self.urunListesi else False