# -*- coding: utf-8 -*-
#
# Copyright (c) ZeroC, Inc. All rights reserved.
#
#
# Ice version 3.7.2
#
# <auto-generated>
#
# Generated from file `bank.ice'
#
# Warning: do not edit this file.
#
# </auto-generated>
#

from sys import version_info as _version_info_
import Ice, IcePy

# Start of module Bank
_M_Bank = Ice.openModule('Bank')
__name__ = 'Bank'

if 'AccountType' not in _M_Bank.__dict__:
    _M_Bank.AccountType = Ice.createTempClass()
    class AccountType(Ice.EnumBase):

        def __init__(self, _n, _v):
            Ice.EnumBase.__init__(self, _n, _v)

        def valueOf(self, _n):
            if _n in self._enumerators:
                return self._enumerators[_n]
            return None
        valueOf = classmethod(valueOf)

    AccountType.STANDARD = AccountType("STANDARD", 0)
    AccountType.PREMIUM = AccountType("PREMIUM", 1)
    AccountType._enumerators = { 0:AccountType.STANDARD, 1:AccountType.PREMIUM }

    _M_Bank._t_AccountType = IcePy.defineEnum('::Bank::AccountType', AccountType, (), AccountType._enumerators)

    _M_Bank.AccountType = AccountType
    del AccountType

if 'Currency' not in _M_Bank.__dict__:
    _M_Bank.Currency = Ice.createTempClass()
    class Currency(Ice.EnumBase):

        def __init__(self, _n, _v):
            Ice.EnumBase.__init__(self, _n, _v)

        def valueOf(self, _n):
            if _n in self._enumerators:
                return self._enumerators[_n]
            return None
        valueOf = classmethod(valueOf)

    Currency.PLN = Currency("PLN", 0)
    Currency.USD = Currency("USD", 1)
    Currency.EURO = Currency("EURO", 2)
    Currency._enumerators = { 0:Currency.PLN, 1:Currency.USD, 2:Currency.EURO }

    _M_Bank._t_Currency = IcePy.defineEnum('::Bank::Currency', Currency, (), Currency._enumerators)

    _M_Bank.Currency = Currency
    del Currency

if 'Account' not in _M_Bank.__dict__:
    _M_Bank.Account = Ice.createTempClass()
    class Account(object):
        def __init__(self, pesel=0, name='', surname='', income=0, type=_M_Bank.AccountType.STANDARD, password=''):
            self.pesel = pesel
            self.name = name
            self.surname = surname
            self.income = income
            self.type = type
            self.password = password

        def __hash__(self):
            _h = 0
            _h = 5 * _h + Ice.getHash(self.pesel)
            _h = 5 * _h + Ice.getHash(self.name)
            _h = 5 * _h + Ice.getHash(self.surname)
            _h = 5 * _h + Ice.getHash(self.income)
            _h = 5 * _h + Ice.getHash(self.type)
            _h = 5 * _h + Ice.getHash(self.password)
            return _h % 0x7fffffff

        def __compare(self, other):
            if other is None:
                return 1
            elif not isinstance(other, _M_Bank.Account):
                return NotImplemented
            else:
                if self.pesel is None or other.pesel is None:
                    if self.pesel != other.pesel:
                        return (-1 if self.pesel is None else 1)
                else:
                    if self.pesel < other.pesel:
                        return -1
                    elif self.pesel > other.pesel:
                        return 1
                if self.name is None or other.name is None:
                    if self.name != other.name:
                        return (-1 if self.name is None else 1)
                else:
                    if self.name < other.name:
                        return -1
                    elif self.name > other.name:
                        return 1
                if self.surname is None or other.surname is None:
                    if self.surname != other.surname:
                        return (-1 if self.surname is None else 1)
                else:
                    if self.surname < other.surname:
                        return -1
                    elif self.surname > other.surname:
                        return 1
                if self.income is None or other.income is None:
                    if self.income != other.income:
                        return (-1 if self.income is None else 1)
                else:
                    if self.income < other.income:
                        return -1
                    elif self.income > other.income:
                        return 1
                if self.type is None or other.type is None:
                    if self.type != other.type:
                        return (-1 if self.type is None else 1)
                else:
                    if self.type < other.type:
                        return -1
                    elif self.type > other.type:
                        return 1
                if self.password is None or other.password is None:
                    if self.password != other.password:
                        return (-1 if self.password is None else 1)
                else:
                    if self.password < other.password:
                        return -1
                    elif self.password > other.password:
                        return 1
                return 0

        def __lt__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r < 0

        def __le__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r <= 0

        def __gt__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r > 0

        def __ge__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r >= 0

        def __eq__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r == 0

        def __ne__(self, other):
            r = self.__compare(other)
            if r is NotImplemented:
                return r
            else:
                return r != 0

        def __str__(self):
            return IcePy.stringify(self, _M_Bank._t_Account)

        __repr__ = __str__

    _M_Bank._t_Account = IcePy.defineStruct('::Bank::Account', Account, (), (
        ('pesel', (), IcePy._t_int),
        ('name', (), IcePy._t_string),
        ('surname', (), IcePy._t_string),
        ('income', (), IcePy._t_int),
        ('type', (), _M_Bank._t_AccountType),
        ('password', (), IcePy._t_string)
    ))

    _M_Bank.Account = Account
    del Account

if 'LoanRates' not in _M_Bank.__dict__:
    _M_Bank.LoanRates = Ice.createTempClass()
    class LoanRates(object):
        def __init__(self, loanPayment=0.0, loanForeignPayment=0.0):
            self.loanPayment = loanPayment
            self.loanForeignPayment = loanForeignPayment

        def __eq__(self, other):
            if other is None:
                return False
            elif not isinstance(other, _M_Bank.LoanRates):
                return NotImplemented
            else:
                if self.loanPayment != other.loanPayment:
                    return False
                if self.loanForeignPayment != other.loanForeignPayment:
                    return False
                return True

        def __ne__(self, other):
            return not self.__eq__(other)

        def __str__(self):
            return IcePy.stringify(self, _M_Bank._t_LoanRates)

        __repr__ = __str__

    _M_Bank._t_LoanRates = IcePy.defineStruct('::Bank::LoanRates', LoanRates, (), (
        ('loanPayment', (), IcePy._t_float),
        ('loanForeignPayment', (), IcePy._t_float)
    ))

    _M_Bank.LoanRates = LoanRates
    del LoanRates

if 'AccountException' not in _M_Bank.__dict__:
    _M_Bank.AccountException = Ice.createTempClass()
    class AccountException(Ice.UserException):
        def __init__(self, message=''):
            self.message = message

        def __str__(self):
            return IcePy.stringifyException(self)

        __repr__ = __str__

        _ice_id = '::Bank::AccountException'

    _M_Bank._t_AccountException = IcePy.defineException('::Bank::AccountException', AccountException, (), False, None, (('message', (), IcePy._t_string, False, 0),))
    AccountException._ice_type = _M_Bank._t_AccountException

    _M_Bank.AccountException = AccountException
    del AccountException

_M_Bank._t_BankHandler = IcePy.defineValue('::Bank::BankHandler', Ice.Value, -1, (), False, True, None, ())

if 'BankHandlerPrx' not in _M_Bank.__dict__:
    _M_Bank.BankHandlerPrx = Ice.createTempClass()
    class BankHandlerPrx(Ice.ObjectPrx):

        def signUp(self, pesel, name, surname, income, context=None):
            return _M_Bank.BankHandler._op_signUp.invoke(self, ((pesel, name, surname, income), context))

        def signUpAsync(self, pesel, name, surname, income, context=None):
            return _M_Bank.BankHandler._op_signUp.invokeAsync(self, ((pesel, name, surname, income), context))

        def begin_signUp(self, pesel, name, surname, income, _response=None, _ex=None, _sent=None, context=None):
            return _M_Bank.BankHandler._op_signUp.begin(self, ((pesel, name, surname, income), _response, _ex, _sent, context))

        def end_signUp(self, _r):
            return _M_Bank.BankHandler._op_signUp.end(self, _r)

        def getState(self, context=None):
            return _M_Bank.BankHandler._op_getState.invoke(self, ((), context))

        def getStateAsync(self, context=None):
            return _M_Bank.BankHandler._op_getState.invokeAsync(self, ((), context))

        def begin_getState(self, _response=None, _ex=None, _sent=None, context=None):
            return _M_Bank.BankHandler._op_getState.begin(self, ((), _response, _ex, _sent, context))

        def end_getState(self, _r):
            return _M_Bank.BankHandler._op_getState.end(self, _r)

        def requestLoan(self, currency, loanAmount, months, context=None):
            return _M_Bank.BankHandler._op_requestLoan.invoke(self, ((currency, loanAmount, months), context))

        def requestLoanAsync(self, currency, loanAmount, months, context=None):
            return _M_Bank.BankHandler._op_requestLoan.invokeAsync(self, ((currency, loanAmount, months), context))

        def begin_requestLoan(self, currency, loanAmount, months, _response=None, _ex=None, _sent=None, context=None):
            return _M_Bank.BankHandler._op_requestLoan.begin(self, ((currency, loanAmount, months), _response, _ex, _sent, context))

        def end_requestLoan(self, _r):
            return _M_Bank.BankHandler._op_requestLoan.end(self, _r)

        @staticmethod
        def checkedCast(proxy, facetOrContext=None, context=None):
            return _M_Bank.BankHandlerPrx.ice_checkedCast(proxy, '::Bank::BankHandler', facetOrContext, context)

        @staticmethod
        def uncheckedCast(proxy, facet=None):
            return _M_Bank.BankHandlerPrx.ice_uncheckedCast(proxy, facet)

        @staticmethod
        def ice_staticId():
            return '::Bank::BankHandler'
    _M_Bank._t_BankHandlerPrx = IcePy.defineProxy('::Bank::BankHandler', BankHandlerPrx)

    _M_Bank.BankHandlerPrx = BankHandlerPrx
    del BankHandlerPrx

    _M_Bank.BankHandler = Ice.createTempClass()
    class BankHandler(Ice.Object):

        def ice_ids(self, current=None):
            return ('::Bank::BankHandler', '::Ice::Object')

        def ice_id(self, current=None):
            return '::Bank::BankHandler'

        @staticmethod
        def ice_staticId():
            return '::Bank::BankHandler'

        def signUp(self, pesel, name, surname, income, current=None):
            raise NotImplementedError("servant method 'signUp' not implemented")

        def getState(self, current=None):
            raise NotImplementedError("servant method 'getState' not implemented")

        def requestLoan(self, currency, loanAmount, months, current=None):
            raise NotImplementedError("servant method 'requestLoan' not implemented")

        def __str__(self):
            return IcePy.stringify(self, _M_Bank._t_BankHandlerDisp)

        __repr__ = __str__

    _M_Bank._t_BankHandlerDisp = IcePy.defineClass('::Bank::BankHandler', BankHandler, (), None, ())
    BankHandler._ice_type = _M_Bank._t_BankHandlerDisp

    BankHandler._op_signUp = IcePy.Operation('signUp', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), IcePy._t_long, False, 0), ((), IcePy._t_string, False, 0), ((), IcePy._t_string, False, 0), ((), IcePy._t_int, False, 0)), (), ((), IcePy._t_string, False, 0), (_M_Bank._t_AccountException,))
    BankHandler._op_getState = IcePy.Operation('getState', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (), (), ((), _M_Bank._t_Account, False, 0), (_M_Bank._t_AccountException,))
    BankHandler._op_requestLoan = IcePy.Operation('requestLoan', Ice.OperationMode.Normal, Ice.OperationMode.Normal, False, None, (), (((), _M_Bank._t_Currency, False, 0), ((), IcePy._t_float, False, 0), ((), IcePy._t_int, False, 0)), (), ((), _M_Bank._t_LoanRates, False, 0), (_M_Bank._t_AccountException,))

    _M_Bank.BankHandler = BankHandler
    del BankHandler

# End of module Bank
