#!/usr/bin/env python
# -*- coding: utf-8 -*-
import json

from alipay.aop.api.constant.ParamConstants import *


class RoyaltyDetail(object):

    def __init__(self):
        self._amount = None
        self._detail_id = None
        self._error_code = None
        self._error_desc = None
        self._execute_dt = None
        self._operation_type = None
        self._state = None
        self._trans_in = None
        self._trans_in_open_id = None
        self._trans_in_type = None
        self._trans_out = None
        self._trans_out_open_id = None
        self._trans_out_type = None

    @property
    def amount(self):
        return self._amount

    @amount.setter
    def amount(self, value):
        self._amount = value
    @property
    def detail_id(self):
        return self._detail_id

    @detail_id.setter
    def detail_id(self, value):
        self._detail_id = value
    @property
    def error_code(self):
        return self._error_code

    @error_code.setter
    def error_code(self, value):
        self._error_code = value
    @property
    def error_desc(self):
        return self._error_desc

    @error_desc.setter
    def error_desc(self, value):
        self._error_desc = value
    @property
    def execute_dt(self):
        return self._execute_dt

    @execute_dt.setter
    def execute_dt(self, value):
        self._execute_dt = value
    @property
    def operation_type(self):
        return self._operation_type

    @operation_type.setter
    def operation_type(self, value):
        self._operation_type = value
    @property
    def state(self):
        return self._state

    @state.setter
    def state(self, value):
        self._state = value
    @property
    def trans_in(self):
        return self._trans_in

    @trans_in.setter
    def trans_in(self, value):
        self._trans_in = value
    @property
    def trans_in_open_id(self):
        return self._trans_in_open_id

    @trans_in_open_id.setter
    def trans_in_open_id(self, value):
        self._trans_in_open_id = value
    @property
    def trans_in_type(self):
        return self._trans_in_type

    @trans_in_type.setter
    def trans_in_type(self, value):
        self._trans_in_type = value
    @property
    def trans_out(self):
        return self._trans_out

    @trans_out.setter
    def trans_out(self, value):
        self._trans_out = value
    @property
    def trans_out_open_id(self):
        return self._trans_out_open_id

    @trans_out_open_id.setter
    def trans_out_open_id(self, value):
        self._trans_out_open_id = value
    @property
    def trans_out_type(self):
        return self._trans_out_type

    @trans_out_type.setter
    def trans_out_type(self, value):
        self._trans_out_type = value


    def to_alipay_dict(self):
        params = dict()
        if self.amount:
            if hasattr(self.amount, 'to_alipay_dict'):
                params['amount'] = self.amount.to_alipay_dict()
            else:
                params['amount'] = self.amount
        if self.detail_id:
            if hasattr(self.detail_id, 'to_alipay_dict'):
                params['detail_id'] = self.detail_id.to_alipay_dict()
            else:
                params['detail_id'] = self.detail_id
        if self.error_code:
            if hasattr(self.error_code, 'to_alipay_dict'):
                params['error_code'] = self.error_code.to_alipay_dict()
            else:
                params['error_code'] = self.error_code
        if self.error_desc:
            if hasattr(self.error_desc, 'to_alipay_dict'):
                params['error_desc'] = self.error_desc.to_alipay_dict()
            else:
                params['error_desc'] = self.error_desc
        if self.execute_dt:
            if hasattr(self.execute_dt, 'to_alipay_dict'):
                params['execute_dt'] = self.execute_dt.to_alipay_dict()
            else:
                params['execute_dt'] = self.execute_dt
        if self.operation_type:
            if hasattr(self.operation_type, 'to_alipay_dict'):
                params['operation_type'] = self.operation_type.to_alipay_dict()
            else:
                params['operation_type'] = self.operation_type
        if self.state:
            if hasattr(self.state, 'to_alipay_dict'):
                params['state'] = self.state.to_alipay_dict()
            else:
                params['state'] = self.state
        if self.trans_in:
            if hasattr(self.trans_in, 'to_alipay_dict'):
                params['trans_in'] = self.trans_in.to_alipay_dict()
            else:
                params['trans_in'] = self.trans_in
        if self.trans_in_open_id:
            if hasattr(self.trans_in_open_id, 'to_alipay_dict'):
                params['trans_in_open_id'] = self.trans_in_open_id.to_alipay_dict()
            else:
                params['trans_in_open_id'] = self.trans_in_open_id
        if self.trans_in_type:
            if hasattr(self.trans_in_type, 'to_alipay_dict'):
                params['trans_in_type'] = self.trans_in_type.to_alipay_dict()
            else:
                params['trans_in_type'] = self.trans_in_type
        if self.trans_out:
            if hasattr(self.trans_out, 'to_alipay_dict'):
                params['trans_out'] = self.trans_out.to_alipay_dict()
            else:
                params['trans_out'] = self.trans_out
        if self.trans_out_open_id:
            if hasattr(self.trans_out_open_id, 'to_alipay_dict'):
                params['trans_out_open_id'] = self.trans_out_open_id.to_alipay_dict()
            else:
                params['trans_out_open_id'] = self.trans_out_open_id
        if self.trans_out_type:
            if hasattr(self.trans_out_type, 'to_alipay_dict'):
                params['trans_out_type'] = self.trans_out_type.to_alipay_dict()
            else:
                params['trans_out_type'] = self.trans_out_type
        return params

    @staticmethod
    def from_alipay_dict(d):
        if not d:
            return None
        o = RoyaltyDetail()
        if 'amount' in d:
            o.amount = d['amount']
        if 'detail_id' in d:
            o.detail_id = d['detail_id']
        if 'error_code' in d:
            o.error_code = d['error_code']
        if 'error_desc' in d:
            o.error_desc = d['error_desc']
        if 'execute_dt' in d:
            o.execute_dt = d['execute_dt']
        if 'operation_type' in d:
            o.operation_type = d['operation_type']
        if 'state' in d:
            o.state = d['state']
        if 'trans_in' in d:
            o.trans_in = d['trans_in']
        if 'trans_in_open_id' in d:
            o.trans_in_open_id = d['trans_in_open_id']
        if 'trans_in_type' in d:
            o.trans_in_type = d['trans_in_type']
        if 'trans_out' in d:
            o.trans_out = d['trans_out']
        if 'trans_out_open_id' in d:
            o.trans_out_open_id = d['trans_out_open_id']
        if 'trans_out_type' in d:
            o.trans_out_type = d['trans_out_type']
        return o


