def pack(self, packer: Packer) -> None:
        self.type.pack(packer)
        if self.type == OperationType.CREATE_ACCOUNT:
            if self.create_account_op is None:
                raise ValueError("create_account_op should not be None.")
            self.create_account_op.pack(packer)
            return
        if self.type == OperationType.PAYMENT:
            if self.payment_op is None:
                raise ValueError("payment_op should not be None.")
            self.payment_op.pack(packer)
            return
        if self.type == OperationType.PATH_PAYMENT_STRICT_RECEIVE:
            if self.path_payment_strict_receive_op is None:
                raise ValueError("path_payment_strict_receive_op should not be None.")
            self.path_payment_strict_receive_op.pack(packer)
            return
        if self.type == OperationType.MANAGE_SELL_OFFER:
            if self.manage_sell_offer_op is None:
                raise ValueError("manage_sell_offer_op should not be None.")
            self.manage_sell_offer_op.pack(packer)
            return
        if self.type == OperationType.CREATE_PASSIVE_SELL_OFFER:
            if self.create_passive_sell_offer_op is None:
                raise ValueError("create_passive_sell_offer_op should not be None.")
            self.create_passive_sell_offer_op.pack(packer)
            return
        if self.type == OperationType.SET_OPTIONS:
            if self.set_options_op is None:
                raise ValueError("set_options_op should not be None.")
            self.set_options_op.pack(packer)
            return
        if self.type == OperationType.CHANGE_TRUST:
            if self.change_trust_op is None:
                raise ValueError("change_trust_op should not be None.")
            self.change_trust_op.pack(packer)
            return
        if self.type == OperationType.ALLOW_TRUST:
            if self.allow_trust_op is None:
                raise ValueError("allow_trust_op should not be None.")
            self.allow_trust_op.pack(packer)
            return
        if self.type == OperationType.ACCOUNT_MERGE:
            if self.destination is None:
                raise ValueError("destination should not be None.")
            self.destination.pack(packer)
            return
        if self.type == OperationType.INFLATION:
            return
        if self.type == OperationType.MANAGE_DATA:
            if self.manage_data_op is None:
                raise ValueError("manage_data_op should not be None.")
            self.manage_data_op.pack(packer)
            return
        if self.type == OperationType.BUMP_SEQUENCE:
            if self.bump_sequence_op is None:
                raise ValueError("bump_sequence_op should not be None.")
            self.bump_sequence_op.pack(packer)
            return
        if self.type == OperationType.MANAGE_BUY_OFFER:
            if self.manage_buy_offer_op is None:
                raise ValueError("manage_buy_offer_op should not be None.")
            self.manage_buy_offer_op.pack(packer)
            return
        if self.type == OperationType.PATH_PAYMENT_STRICT_SEND:
            if self.path_payment_strict_send_op is None:
                raise ValueError("path_payment_strict_send_op should not be None.")
            self.path_payment_strict_send_op.pack(packer)
            return
        if self.type == OperationType.CREATE_CLAIMABLE_BALANCE:
            if self.create_claimable_balance_op is None:
                raise ValueError("create_claimable_balance_op should not be None.")
            self.create_claimable_balance_op.pack(packer)
            return
        if self.type == OperationType.CLAIM_CLAIMABLE_BALANCE:
            if self.claim_claimable_balance_op is None:
                raise ValueError("claim_claimable_balance_op should not be None.")
            self.claim_claimable_balance_op.pack(packer)
            return
        if self.type == OperationType.BEGIN_SPONSORING_FUTURE_RESERVES:
            if self.begin_sponsoring_future_reserves_op is None:
                raise ValueError(
                    "begin_sponsoring_future_reserves_op should not be None."
                )
            self.begin_sponsoring_future_reserves_op.pack(packer)
            return
        if self.type == OperationType.END_SPONSORING_FUTURE_RESERVES:
            return
        if self.type == OperationType.REVOKE_SPONSORSHIP:
            if self.revoke_sponsorship_op is None:
                raise ValueError("revoke_sponsorship_op should not be None.")
            self.revoke_sponsorship_op.pack(packer)
            return
        if self.type == OperationType.CLAWBACK:
            if self.clawback_op is None:
                raise ValueError("clawback_op should not be None.")
            self.clawback_op.pack(packer)
            return
        if self.type == OperationType.CLAWBACK_CLAIMABLE_BALANCE:
            if self.clawback_claimable_balance_op is None:
                raise ValueError("clawback_claimable_balance_op should not be None.")
            self.clawback_claimable_balance_op.pack(packer)
            return
        if self.type == OperationType.SET_TRUST_LINE_FLAGS:
            if self.set_trust_line_flags_op is None:
                raise ValueError("set_trust_line_flags_op should not be None.")
            self.set_trust_line_flags_op.pack(packer)
            return
        if self.type == OperationType.LIQUIDITY_POOL_DEPOSIT:
            if self.liquidity_pool_deposit_op is None:
                raise ValueError("liquidity_pool_deposit_op should not be None.")
            self.liquidity_pool_deposit_op.pack(packer)
            return
        if self.type == OperationType.LIQUIDITY_POOL_WITHDRAW:
            if self.liquidity_pool_withdraw_op is None:
                raise ValueError("liquidity_pool_withdraw_op should not be None.")
            self.liquidity_pool_withdraw_op.pack(packer)
            return